[make] Add ability to deny modules from being used

Certain projects may want to prevent the usage of certain modules from
being used. Here are two examples of when this may occur:

1. The Project has it's own fdt library and does not want developer's
   using the version of libfdt included with LK

2. The project does not want developers using mincrypt.

`DENY_MODULES` is a list which developers can set in their own project
makefiles which is checked on each module inclusion. If that module is
on the deny list, it causes a build failure.
This commit is contained in:
Matt Schulte
2023-11-07 11:03:59 -08:00
committed by Travis Geiselbrecht
parent 94a15119b2
commit b0b2665cea
2 changed files with 7 additions and 0 deletions

View File

@@ -165,6 +165,9 @@ BUILDID ?=
# comment out or override if you want to see the full output of each command
NOECHO ?= @
# Any modules you want to explictly prevent from being used
DENY_MODULES :=
# try to include the project file
-include project/$(PROJECT).mk
ifndef TARGET

View File

@@ -46,6 +46,10 @@ $(error MODULE $(MODULE) is probably setting OBJS, change to MODULE_SRCS)
endif
endif
ifneq ($(filter $(MODULE),$(DENY_MODULES)),)
$(error MODULE $(MODULE) is not allowed by PROJECT $(PROJECT)'s DENY_MODULES list)
endif
MODULE_SRCDIR := $(MODULE)
MODULE_BUILDDIR := $(call TOBUILDDIR,$(MODULE_SRCDIR))