blob: ada8cd0c6c40f1a95b725f790a26475ddeb5316b [file] [log] [blame]
Joey Armstronga6890342023-06-01 17:07:51 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
3# Intent: Dependency-free macros used to source library makefiles
4# and define the build environment.
5# -----------------------------------------------------------------------
6
7$(if $(DEBUG-bootstrap_mk),$(warning ENTER))
8
9##---------------------##
10##---] CONSTANTS [---##
11##---------------------##
12is-false = $(if $(1),true,$(null))
13is-true = $(if $(1),$(null),true)
14
15##--------------------------##
16##---] LIBRARY MACROS [---##
17##--------------------------##
Joey Armstrong7ad5c362023-07-09 19:10:16 -040018is-null = $(if $(1),$(null),$(error $(1)= is undef))
19is-null-var = $(if $$(1),$(null),$(error $(1)= is undef))
20is-null-var-indirect = $(if $(1),$(null),$(error $(1)= is undef))
21
22## variable flavor:
23# origin - undefned
24# default
25# environment
26# environment override
27# automatic
28# null(blah) ? - true
Joey Armstronga6890342023-06-01 17:07:51 -040029
30## -----------------------------------------------------------------------
31## Intent: Given an indirect var containing varname of a makefile *_ROOT
32## parent director, derive a *_MKDIR variable and conditionally
33## include the makefile hierarchy.
34## -----------------------------------------------------------------------
35## Given:
36## o var containing OPT_ROOT=path
37## Return:
38## o OPT_MKDIR=$(OPT_ROOT)/makefiles
39## o If exists include $(OPT_MKDIR)/include.mk
40## -----------------------------------------------------------------------
Joey Armstrong1e07f882023-07-08 19:28:49 -040041# library-include := $(call mk-library-include,blah)
42
43mk-library-include=$(error revisit mk-library-include)
44
45#$(strip \
46# $(warning mk-library-include: $$1[$(1)] = [$($(1))]))\
47# $(call is-null-var,1)\
48# $(foreach var,$($(1)),\
49# $(info var=$(var) is-null=$(call is-null-var,var))\
50# $(foreach val,$$(var),\
51# $(info val=$(val))\
52# $(foreach makedir,$(subst _ROOT,_MKDIR,$(var)),\
53#$(warning makedir=$(makedir))\
54# $(if $($(makedir)),$(null),\
55# $(eval $(makedir)=$$$$($(var))/makefiles)\
56#$(warning $(makedir) = $($($(makedir))))\
57#$(info $$(wildcard $(val)/makefiles/include.mk) = $(wildcard $(val)/makefiles/include.mk))\
58# $(foreach mf,$(wildcard $(wildcard $(val)/makefiles/include.mk)),\
59#$(warning $$(eval include $(mf)))\
60## $(eval include $(mf)))\
61# )
Joey Armstronga6890342023-06-01 17:07:51 -040062
63$(if $(DEBUG-bootstrap_mk),$(warning LEAVE))
64
65# [EOF]