diff options
authorJeenu Viswambharan <jeenu.viswambharan@arm.com>2014-05-16 11:38:10 +0100
committerJeenu Viswambharan <jeenu.viswambharan@arm.com>2014-05-16 17:11:27 +0100
commit289e0dadbdc4dbe4ac78110f93262dc785d24418 (patch)
parentc5c9b69c132c823aabc1e29c2ff6f30323c85483 (diff)
Introduce convenience functions to build
This patch introduces two convenience functions to the build system: - assert_boolean: asserts that a given option is assigned either 0 or 1 as values - add_define: helps add/append macro definitions to build tool command line. This also introduces the variable DEFINES which is used to collect and pass all relevant configurations to build tools Change-Id: I3126894b034470d39858ebb3bd183bda681c7126
1 files changed, 13 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 3064aa4..93f8941 100644
--- a/Makefile
+++ b/Makefile
@@ -83,6 +83,19 @@ PLATFORMS := $(shell ls -I common plat/)
SPDS := $(shell ls -I none services/spd)
HELP_PLATFORMS := $(shell echo ${PLATFORMS} | sed 's/ /|/g')
+# Convenience function for adding build definitions
+# $(eval $(call add_define,FOO)) will have:
+# -DFOO if $(FOO) is empty; -DFOO=$(FOO) otherwise
+define add_define
+DEFINES += -D$(1)$(if $(value $(1)),=$(value $(1)),)
+# Convenience function for verifying option has a boolean value
+# $(eval $(call assert_boolean,FOO)) will assert FOO is 0 or 1
+define assert_boolean
+$(and $(patsubst 0,,$(value $(1))),$(patsubst 1,,$(value $(1))),$(error $(1) must be boolean))
ifeq (${PLAT},)
$(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform.")
@@ -131,7 +144,6 @@ endif
.PHONY: all msg_start clean realclean distclean cscope locate-checkpatch checkcodebase checkpatch fiptool fip
INCLUDES += -Iinclude/bl1 \
-Iinclude/bl2 \
-Iinclude/bl31 \