Joey Armstrong | 449ce7a | 2023-07-18 18:32:24 -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 | mk-library-include=$(strip \ |
| 42 | $(warning mk-library-include: $(1) = $($(1)))\ |
| 43 | $(call is-null-var,1)\ |
| 44 | $(foreach var,$$(1),\ |
| 45 | $(info var=$(var) is-null=$(call is-null-var,var))\ |
| 46 | $(foreach val,$$(var),\ |
| 47 | $(info val=$(val))\ |
| 48 | $(foreach makedir,$(subst _ROOT,_MKDIR,$(var)),\ |
| 49 | $(warning makedir=$(makedir))\ |
| 50 | $(if $($(makedir)),$(null),\ |
Joey Armstrong | b5a5e8c | 2023-09-20 12:05:03 -0400 | [diff] [blame] | 51 | $(eval $(makedir)=$$$$($(var))/makefiles-orig)\ |
Joey Armstrong | 449ce7a | 2023-07-18 18:32:24 -0400 | [diff] [blame] | 52 | $(warning $(makedir) = $($($(makedir))))\ |
Joey Armstrong | b5a5e8c | 2023-09-20 12:05:03 -0400 | [diff] [blame] | 53 | $(info $$(wildcard $(val)/makefiles-orig/include.mk) = $(wildcard $(val)/makefiles-orig/include.mk))\ |
| 54 | $(foreach mf,$(wildcard $(wildcard $(val)/makefiles-orig/include.mk)),\ |
Joey Armstrong | 449ce7a | 2023-07-18 18:32:24 -0400 | [diff] [blame] | 55 | $(warning $$(eval include $(mf)))\ |
| 56 | $(eval include $(mf)))\ |
| 57 | ) |
| 58 | |
| 59 | $(if $(DEBUG-bootstrap_mk),$(warning LEAVE)) |
| 60 | |
| 61 | # [EOF] |