Skip to content

Commit

Permalink
[make] Add ability to deny modules from being used
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
schultetwin1 authored and travisg committed Dec 4, 2023
1 parent 94a1511 commit b0b2665
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions engine.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions make/module.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down

0 comments on commit b0b2665

Please sign in to comment.