Makefile: place defaults values and macro defs in a separate folder
Although there are not many variable default values and macros
definitions, for modularity and scalability, place these two into a
separate folder.
Change-Id: If916a69edda07aaeaa77d60ce482e002effd7f9f
Signed-off-by: Leonardo Sandoval <leonardo.sandoval@linaro.org>
diff --git a/Makefile b/Makefile
index b09e749..77b89fa 100644
--- a/Makefile
+++ b/Makefile
@@ -8,11 +8,14 @@
VERSION_MAJOR := 2
VERSION_MINOR := 3
+MAKE_HELPERS_DIRECTORY := make_helpers/
+include ${MAKE_HELPERS_DIRECTORY}build_macros.mk
+
################################################################################
# Default values for build configurations, and their dependencies
################################################################################
-include defaults.mk
+include ${MAKE_HELPERS_DIRECTORY}defaults.mk
PLAT := ${DEFAULT_PLAT}
@@ -80,31 +83,6 @@
DOCS_PATH := docs
-# Convenience function for adding build definitions
-# $(eval $(call add_define,BAR_DEFINES,FOO)) will have:
-# -DFOO if $(FOO) is empty; -DFOO=$(FOO) otherwise
-# inside the BAR_DEFINES variable.
-define add_define
-$(1) += -D$(2)$(if $(value $(2)),=$(value $(2)),)
-endef
-
-# 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))
-endef
-
-# CREATE_SEQ is a recursive function to create sequence of numbers from 1 to
-# $(2) and assign the sequence to $(1)
-define CREATE_SEQ
-$(if $(word $(2), $($(1))),\
- $(eval $(1) += $(words $($(1))))\
- $(eval $(1) := $(filter-out 0,$($(1)))),\
- $(eval $(1) += $(words $($(1))))\
- $(call CREATE_SEQ,$(1),$(2))\
-)
-endef
-
ifeq (${PLAT},)
$(error "Error: Unknown platform. Please use PLAT=<platform name> to specify the platform")
endif
diff --git a/make_helpers/build_macros.mk b/make_helpers/build_macros.mk
new file mode 100644
index 0000000..0ac1505
--- /dev/null
+++ b/make_helpers/build_macros.mk
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+
+# Convenience function for adding build definitions
+# $(eval $(call add_define,BAR_DEFINES,FOO)) will have:
+# -DFOO if $(FOO) is empty; -DFOO=$(FOO) otherwise
+# inside the BAR_DEFINES variable.
+define add_define
+$(1) += -D$(2)$(if $(value $(2)),=$(value $(2)),)
+endef
+
+# 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))
+endef
+
+# CREATE_SEQ is a recursive function to create sequence of numbers from 1 to
+# $(2) and assign the sequence to $(1)
+define CREATE_SEQ
+$(if $(word $(2), $($(1))),\
+ $(eval $(1) += $(words $($(1))))\
+ $(eval $(1) := $(filter-out 0,$($(1)))),\
+ $(eval $(1) += $(words $($(1))))\
+ $(call CREATE_SEQ,$(1),$(2))\
+)
+endef
diff --git a/defaults.mk b/make_helpers/defaults.mk
similarity index 100%
rename from defaults.mk
rename to make_helpers/defaults.mk