blob: 36e25f9f2c271e7c07db42e9ab60bd74ebded6c4 [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## -----------------------------------------------------------------------
Joey Armstrong95a52432024-04-29 15:26:18 -040029$(if $(findstring $(MAKEFLAGS),--warn-undefined-variables),\
30 $(eval IS-WARN-UNDEFINED-VARIABLES := true))
31$(if $(findstring $(MAKECMDGOALS),int lint-make),\
Joey Armstrong216b04b2023-09-29 16:31:19 -040032 $(eval IS-WARN-UNDEFINED-VARIABLES := true))
33
34ifdef IS-WARN-UNDEFINED-VARIABLES
35 export null :=#
36
37 # ----------------------------------------
38 # Helper macro
39 # Usage: $(call define-if-undef,{varname})
40 # ----------------------------------------
41 define-if-undef =\
42 $(if $(findstring undef,$(flavor $(1))),\
43 $(if $(DEBUG),$(info ** $$(eval export $(1) := $$(null))))\
44 $(eval export $(1) := $(null))\
45 )
46
47 # ----------------------------------------------
48 # Faux defines used to shorten lint error volume
49 # ----------------------------------------------
50 $(call define-if-undef,WORKSPACE)# Jenkins: yes, interactive: no
51 $(call define-if-undef,NULL)# s/NULL/null
52 $(call define-if-undef,UNSTABLE)# enable raw bulk warnings for pylint
53 $(call define-if-undef,JJB_DEBUG)
54
55 # Helpers for transition of local makefiles to repo:onf-make
56 $(call define-if-undef,USE-ONF-DOCKER-MK)
57 $(call define-if-undef,USE-ONF-GERRIT-MK)
58 $(call define-if-undef,USE-VOLTHA-RELEASE-MK)
59
60 # ------------------------------------------------------------------
61 # Future make:
62 # o detect available sources
63 # o enable features based on source detection
64 # o conditional makefile library loading based on source detection
65 # ------------------------------------------------------------------
66 $(call define-if-undef,DOC8_SOURCE)
67 $(call define-if-undef,have-python-files)
68
Joey Armstrong95a52432024-04-29 15:26:18 -040069 $(call define-if-undef,DEBUG-onf-mk-paths)
70 $(call define-if-undef,LINT_DOC8_DEBUG)
71
72 $(call define-if-undef,lint-shell-all)
73 $(call define-if-undef,lint-shell-mod)
74 $(call define-if-undef,lint-shell-src)
75
Joey Armstrong216b04b2023-09-29 16:31:19 -040076endif # IS-WARN-UNDEFINED-VARIABLES
77
78$(if $(DEBUG),$(warning LEAVE))
79
80# [EOF]