blob: 1b10cff9631e81f9579a79aa22c1835d5a19f928 [file] [log] [blame]
Joey Armstrong19dad062024-08-23 10:46:26 -04001# -*- makefile -*-
2# -----------------------------------------------------------------------
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# -----------------------------------------------------------------------
20
21$(if $(DEBUG),$(warning ENTER))
22
23## -----------------------------------------------------------------------
24## Infer path to cloned sandbox root
25## [TODO] Deprecate TOP=
26## -----------------------------------------------------------------------
27lf-sbx-root := $(abspath $(lastword $(MAKEFILE_LIST)))
28lf-sbx-root := $(subst /lf/include.mk,$(null),$(lf-sbx-root))
29
30## -----------------------------------------------------------------------
31## Define vars based on relative import (normalize symlinks)
32## Usage: include makefiles/onf/include.mk
33## -----------------------------------------------------------------------
34onf-mk-abs := $(abspath $(lastword $(MAKEFILE_LIST)))
35onf-mk-top := $(subst /include.mk,$(null),$(onf-mk-abs))
36onf-mk-lib := $(onf-mk-top)/onf-make/makefiles
37onf-mk-loc := $(onf-mk-top)/local
38
39## -----------------------------------------------------------------------
40## Load per-repository conditionals, enable/disable lint targets
41## Load late else alter MAKEFILE_LIST
42## NOTE: config.mk can be removed if dynamic feature detection by file
43## extension is added. See detect.mk
44## -----------------------------------------------------------------------
45include $(wildcard $(lf-sbx-root)/config.mk $(lf-sbx-root)/lf/config.mk)
46
47## -----------------------------------------------------------------------
48## This variable is a bridge to help transition away from legacy makefiles.
49## -----------------------------------------------------------------------
50legacy-mk := $(lf-sbx-root)/makefiles
51
52## -----------------------------------------------------------------------
53## Legacy variables
54## -----------------------------------------------------------------------
55TOP ?= $(lf-sbx-root)
56ONF_MAKEDIR ?= $(onf-mk-lib)
57MAKEDIR ?= $(onf-mk-loc)
58
59## -----------------------------------------------------------------------
60## Command macros
61## -----------------------------------------------------------------------
62GIT ?= /usr/bin/env git
63
64## -----------------------------------------------------------------------
65## Usage: make DEBUG=1
66## -----------------------------------------------------------------------
67$(if $(DEBUG),\
68 $(info **-----------------------------------------------------------------------) \
69 $(warning **) \
70 $(info ** TOP : $(TOP))\
71 $(info ** ONF_MAKE : $(ONF_MAKE))\
72 $(info ** MAKEDIR : $(MAKEDIR))\
73 $(info ** legacy-mk : $(legacy-mk))\
74 $(info **-----------------------------------------------------------------------) \
75)
76ifdef DEBUG
77
78$(if $(DEBUG),$(warning LEAVE))
79
80# [EOF]