Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
Joey Armstrong | dc04c93 | 2024-04-01 12:14:21 -0400 | [diff] [blame] | 3 | # Copyright 2023-2024 Open Networking Foundation Contributors |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http:#www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # ----------------------------------------------------------------------- |
| 17 | # SPDX-FileCopyrightText: 2023-2024 Open Networking Foundation Contributors |
| 18 | # SPDX-License-Identifier: Apache-2.0 |
| 19 | # ----------------------------------------------------------------------- |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 20 | # Intent: Dependency-free macros used to source library makefiles |
| 21 | # and define the build environment. |
| 22 | # ----------------------------------------------------------------------- |
| 23 | |
| 24 | $(if $(DEBUG-bootstrap_mk),$(warning ENTER)) |
| 25 | |
| 26 | ##---------------------## |
| 27 | ##---] CONSTANTS [---## |
| 28 | ##---------------------## |
| 29 | is-false = $(if $(1),true,$(null)) |
| 30 | is-true = $(if $(1),$(null),true) |
| 31 | |
| 32 | ##--------------------------## |
| 33 | ##---] LIBRARY MACROS [---## |
| 34 | ##--------------------------## |
Joey Armstrong | 7ad5c36 | 2023-07-09 19:10:16 -0400 | [diff] [blame] | 35 | is-null = $(if $(1),$(null),$(error $(1)= is undef)) |
| 36 | is-null-var = $(if $$(1),$(null),$(error $(1)= is undef)) |
| 37 | is-null-var-indirect = $(if $(1),$(null),$(error $(1)= is undef)) |
| 38 | |
| 39 | ## variable flavor: |
| 40 | # origin - undefned |
| 41 | # default |
| 42 | # environment |
| 43 | # environment override |
| 44 | # automatic |
| 45 | # null(blah) ? - true |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 46 | |
| 47 | ## ----------------------------------------------------------------------- |
| 48 | ## Intent: Given an indirect var containing varname of a makefile *_ROOT |
| 49 | ## parent director, derive a *_MKDIR variable and conditionally |
| 50 | ## include the makefile hierarchy. |
| 51 | ## ----------------------------------------------------------------------- |
| 52 | ## Given: |
| 53 | ## o var containing OPT_ROOT=path |
| 54 | ## Return: |
| 55 | ## o OPT_MKDIR=$(OPT_ROOT)/makefiles |
| 56 | ## o If exists include $(OPT_MKDIR)/include.mk |
| 57 | ## ----------------------------------------------------------------------- |
Joey Armstrong | 1e07f88 | 2023-07-08 19:28:49 -0400 | [diff] [blame] | 58 | # library-include := $(call mk-library-include,blah) |
| 59 | |
| 60 | mk-library-include=$(error revisit mk-library-include) |
| 61 | |
| 62 | #$(strip \ |
| 63 | # $(warning mk-library-include: $$1[$(1)] = [$($(1))]))\ |
| 64 | # $(call is-null-var,1)\ |
| 65 | # $(foreach var,$($(1)),\ |
| 66 | # $(info var=$(var) is-null=$(call is-null-var,var))\ |
| 67 | # $(foreach val,$$(var),\ |
| 68 | # $(info val=$(val))\ |
| 69 | # $(foreach makedir,$(subst _ROOT,_MKDIR,$(var)),\ |
| 70 | #$(warning makedir=$(makedir))\ |
| 71 | # $(if $($(makedir)),$(null),\ |
| 72 | # $(eval $(makedir)=$$$$($(var))/makefiles)\ |
| 73 | #$(warning $(makedir) = $($($(makedir))))\ |
| 74 | #$(info $$(wildcard $(val)/makefiles/include.mk) = $(wildcard $(val)/makefiles/include.mk))\ |
| 75 | # $(foreach mf,$(wildcard $(wildcard $(val)/makefiles/include.mk)),\ |
| 76 | #$(warning $$(eval include $(mf)))\ |
| 77 | ## $(eval include $(mf)))\ |
| 78 | # ) |
Joey Armstrong | a689034 | 2023-06-01 17:07:51 -0400 | [diff] [blame] | 79 | |
| 80 | $(if $(DEBUG-bootstrap_mk),$(warning LEAVE)) |
| 81 | |
| 82 | # [EOF] |