blob: 048d56d0542ec8fe2bdd4e9b388fe8a6a61f8440 [file] [log] [blame]
Joey Armstrong216b04b2023-09-29 16:31:19 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
3# Copyright 2023 Open Networking Foundation (ONF) and the ONF 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 Open Networking Foundation (ONF) and the ONF Contributors
18# SPDX-License-Identifier: Apache-2.0
19# -----------------------------------------------------------------------
20
21$(if $(DEBUG),$(warning ENTER))
22
23## -----------------------------------------------------------------------
24## Intent: Target lint-make* undef var warnings:
25## o This helper makefile defines var := $(null) for known variables.
26## o Definitions only exist for lint target use.
27## o Decrease warning volume until undef sources can be cleaned up.
28## -----------------------------------------------------------------------
29$(if $(findstring --warn-undefined-variables,$(MAKEFLAGS)),\
30 $(eval IS-WARN-UNDEFINED-VARIABLES := true))
31
32ifdef IS-WARN-UNDEFINED-VARIABLES
33 export null :=#
34
35 # ----------------------------------------
36 # Helper macro
37 # Usage: $(call define-if-undef,{varname})
38 # ----------------------------------------
39 define-if-undef =\
40 $(if $(findstring undef,$(flavor $(1))),\
41 $(if $(DEBUG),$(info ** $$(eval export $(1) := $$(null))))\
42 $(eval export $(1) := $(null))\
43 )
44
45 # ----------------------------------------------
46 # Faux defines used to shorten lint error volume
47 # ----------------------------------------------
48 $(call define-if-undef,WORKSPACE)# Jenkins: yes, interactive: no
49 $(call define-if-undef,NULL)# s/NULL/null
50 $(call define-if-undef,UNSTABLE)# enable raw bulk warnings for pylint
51 $(call define-if-undef,JJB_DEBUG)
52
53 # Helpers for transition of local makefiles to repo:onf-make
54 $(call define-if-undef,USE-ONF-DOCKER-MK)
55 $(call define-if-undef,USE-ONF-GERRIT-MK)
56 $(call define-if-undef,USE-VOLTHA-RELEASE-MK)
57
58 # ------------------------------------------------------------------
59 # Future make:
60 # o detect available sources
61 # o enable features based on source detection
62 # o conditional makefile library loading based on source detection
63 # ------------------------------------------------------------------
64 $(call define-if-undef,DOC8_SOURCE)
65 $(call define-if-undef,have-python-files)
66
67endif # IS-WARN-UNDEFINED-VARIABLES
68
69$(if $(DEBUG),$(warning LEAVE))
70
71# [EOF]