Joey Armstrong | a689034 | 2023-06-01 17:07:51 -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)) |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 19 | is-null-var = $(if $$(1),$(null),$(error $(1)= is undef)) |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 20 | |
| 21 | ## ----------------------------------------------------------------------- |
| 22 | ## Intent: Given an indirect var containing varname of a makefile *_ROOT |
| 23 | ## parent director, derive a *_MKDIR variable and conditionally |
| 24 | ## include the makefile hierarchy. |
| 25 | ## ----------------------------------------------------------------------- |
| 26 | ## Given: |
| 27 | ## o var containing OPT_ROOT=path |
| 28 | ## Return: |
| 29 | ## o OPT_MKDIR=$(OPT_ROOT)/makefiles |
| 30 | ## o If exists include $(OPT_MKDIR)/include.mk |
| 31 | ## ----------------------------------------------------------------------- |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 32 | mk-library-include=$(strip \ |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 33 | $(warning mk-library-include: $(1) = $($(1)))\ |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 34 | $(call is-null-var,1)\ |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 35 | $(foreach var,$$(1),\ |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 36 | $(info var=$(var) is-null=$(call is-null-var,var))\ |
| 37 | $(foreach val,$$(var),\ |
Joey Armstrong | d26858f | 2023-07-08 15:52:16 -0400 | [diff] [blame^] | 38 | $(info val=$(val))\ |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 39 | $(foreach makedir,$(subst _ROOT,_MKDIR,$(var)),\ |
| 40 | $(warning makedir=$(makedir))\ |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 41 | $(if $($(makedir)),$(null),\ |
| 42 | $(eval $(makedir)=$$$$($(var))/makefiles)\ |
| 43 | $(warning $(makedir) = $($($(makedir))))\ |
| 44 | $(info $$(wildcard $(val)/makefiles/include.mk) = $(wildcard $(val)/makefiles/include.mk))\ |
| 45 | $(foreach mf,$(wildcard $(wildcard $(val)/makefiles/include.mk)),\ |
| 46 | $(warning $$(eval include $(mf)))\ |
| 47 | $(eval include $(mf)))\ |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 48 | ) |
| 49 | |
| 50 | $(if $(DEBUG-bootstrap_mk),$(warning LEAVE)) |
| 51 | |
| 52 | # [EOF] |