blob: 104f569b8b6a892a614bc8831b3ec1ee59d9c122 [file] [log] [blame]
Joey Armstronga6890342023-06-01 17:07:51 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
Joey Armstrongdc04c932024-04-01 12:14:21 -04003# 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 Armstronga6890342023-06-01 17:07:51 -040020# 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##---------------------##
29is-false = $(if $(1),true,$(null))
30is-true = $(if $(1),$(null),true)
31
32##--------------------------##
33##---] LIBRARY MACROS [---##
34##--------------------------##
Joey Armstrong7ad5c362023-07-09 19:10:16 -040035is-null = $(if $(1),$(null),$(error $(1)= is undef))
36is-null-var = $(if $$(1),$(null),$(error $(1)= is undef))
37is-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 Armstronga6890342023-06-01 17:07:51 -040046
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 Armstrong1e07f882023-07-08 19:28:49 -040058# library-include := $(call mk-library-include,blah)
59
60mk-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 Armstronga6890342023-06-01 17:07:51 -040079
80$(if $(DEBUG-bootstrap_mk),$(warning LEAVE))
81
82# [EOF]