Joey Armstrong | 7f8436c | 2023-07-09 20:23:27 -0400 | [diff] [blame] | 1 | # -*- 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 | ##---------------------## |
| 12 | is-false = $(if $(1),true,$(null)) |
| 13 | is-true = $(if $(1),$(null),true) |
| 14 | |
| 15 | ##--------------------------## |
| 16 | ##---] LIBRARY MACROS [---## |
| 17 | ##--------------------------## |
| 18 | is-null = $(if $(1),$(null),$(error $(1)= is undef)) |
| 19 | is-null-var = $(if $$(1),$(null),$(error $(1)= is undef)) |
| 20 | is-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 |
| 29 | |
| 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 | ## ----------------------------------------------------------------------- |
| 41 | # library-include := $(call mk-library-include,blah) |
| 42 | |
| 43 | mk-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 | # ) |
| 62 | |
| 63 | $(if $(DEBUG-bootstrap_mk),$(warning LEAVE)) |
| 64 | |
| 65 | # [EOF] |