VOL-5358 - Build & test on the new AMI image
.gitmodules
lf/
lf/include.mk
lf/onf-make
lf/README.md
-------------
o Add repo:onf-make as a git submodule for the repository.
o include.mk contains generic path macros and logic used to
recursively checkout git submodules when needed.
config.mk -> lf/config.mk
-------------------------
o Re-home config.mk
o Update contents to cover all flags supported by repo:onf-make.
o config.mk manually enables/disables linting targets and makefile logic.
lf/bridge.mk
------------
o Temporary transition makefile.
o This makefile helps break dependencies on makefiles/* so includes
can transition to library makefiles in repo:onf-make.
Signed-off-by: Joey Armstrong <jarmstrong@linuxfoundation.org>
Change-Id: I9d499d5624f40366384dc4912aa4465ca7a4b8bb
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..0b23d6f
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "lf/onf-make"]
+ path = lf/onf-make
+ url = https://gerrit.opencord.org/onf-make
diff --git a/lf/README.md b/lf/README.md
new file mode 100644
index 0000000..20e0a3d
--- /dev/null
+++ b/lf/README.md
@@ -0,0 +1,17 @@
+# repo:onf-make - Library makefiles
+
+> $(sandbox-root)/include.mk
+>> Source this makefile to import all makefile logic.
+>
+> $(sandbox-root)/lf/onf-make/
+> $(sandbox-root)/lf/onf-make/include.mk
+>> repo:onf-make contains common library makefile logic.
+>> tag based checkout (frozen) as a git submodule.
+>
+> $(sandbox-root)/lf/local/
+> $(sandbox-root)/lf/local/include.mk
+>> per-repository targets and logic to customize makefile behavior.
+
+> $(sandbox-root)/lf/bridge.mk
+>> Temporary makefile to help with transition to repo:onf-make.
+>> Slowly replace include makefiles/* with include lf/onf-make/makefiles/*
diff --git a/lf/bridge.mk b/lf/bridge.mk
new file mode 100644
index 0000000..1b10cff
--- /dev/null
+++ b/lf/bridge.mk
@@ -0,0 +1,80 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023-2024 Open Networking Foundation Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+# SPDX-FileCopyrightText: 2023-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Infer path to cloned sandbox root
+## [TODO] Deprecate TOP=
+## -----------------------------------------------------------------------
+lf-sbx-root := $(abspath $(lastword $(MAKEFILE_LIST)))
+lf-sbx-root := $(subst /lf/include.mk,$(null),$(lf-sbx-root))
+
+## -----------------------------------------------------------------------
+## Define vars based on relative import (normalize symlinks)
+## Usage: include makefiles/onf/include.mk
+## -----------------------------------------------------------------------
+onf-mk-abs := $(abspath $(lastword $(MAKEFILE_LIST)))
+onf-mk-top := $(subst /include.mk,$(null),$(onf-mk-abs))
+onf-mk-lib := $(onf-mk-top)/onf-make/makefiles
+onf-mk-loc := $(onf-mk-top)/local
+
+## -----------------------------------------------------------------------
+## Load per-repository conditionals, enable/disable lint targets
+## Load late else alter MAKEFILE_LIST
+## NOTE: config.mk can be removed if dynamic feature detection by file
+## extension is added. See detect.mk
+## -----------------------------------------------------------------------
+include $(wildcard $(lf-sbx-root)/config.mk $(lf-sbx-root)/lf/config.mk)
+
+## -----------------------------------------------------------------------
+## This variable is a bridge to help transition away from legacy makefiles.
+## -----------------------------------------------------------------------
+legacy-mk := $(lf-sbx-root)/makefiles
+
+## -----------------------------------------------------------------------
+## Legacy variables
+## -----------------------------------------------------------------------
+TOP ?= $(lf-sbx-root)
+ONF_MAKEDIR ?= $(onf-mk-lib)
+MAKEDIR ?= $(onf-mk-loc)
+
+## -----------------------------------------------------------------------
+## Command macros
+## -----------------------------------------------------------------------
+GIT ?= /usr/bin/env git
+
+## -----------------------------------------------------------------------
+## Usage: make DEBUG=1
+## -----------------------------------------------------------------------
+$(if $(DEBUG),\
+ $(info **-----------------------------------------------------------------------) \
+ $(warning **) \
+ $(info ** TOP : $(TOP))\
+ $(info ** ONF_MAKE : $(ONF_MAKE))\
+ $(info ** MAKEDIR : $(MAKEDIR))\
+ $(info ** legacy-mk : $(legacy-mk))\
+ $(info **-----------------------------------------------------------------------) \
+)
+ifdef DEBUG
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/config.mk b/lf/config.mk
similarity index 100%
rename from config.mk
rename to lf/config.mk
diff --git a/lf/include.mk b/lf/include.mk
new file mode 100644
index 0000000..5d52907
--- /dev/null
+++ b/lf/include.mk
@@ -0,0 +1,109 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2023-2024 Open Networking Foundation Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+# SPDX-FileCopyrightText: 2023-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+## -----------------------------------------------------------------------
+## Infer path to cloned sandbox root
+## [TODO] Deprecate TOP=
+## -----------------------------------------------------------------------
+lf-sbx-root := $(abspath $(lastword $(MAKEFILE_LIST)))
+lf-sbx-root := $(subst /lf/include.mk,$(null),$(lf-sbx-root))
+
+## -----------------------------------------------------------------------
+## Define vars based on relative import (normalize symlinks)
+## Usage: include makefiles/onf/include.mk
+## -----------------------------------------------------------------------
+onf-mk-abs := $(abspath $(lastword $(MAKEFILE_LIST)))
+onf-mk-top := $(subst /include.mk,$(null),$(onf-mk-abs))
+onf-mk-lib := $(onf-mk-top)/onf-make/makefiles
+onf-mk-loc := $(onf-mk-top)/local
+
+TOP ?= $(patsubst %/makefiles/include.mk,%,$(onf-mk-abs))
+
+## -----------------------------------------------------------------------
+## This variable is a bridge to help transition away from legacy makefiles.
+## -----------------------------------------------------------------------
+legacy-mk := $(lf-sbx-root)/makefiles
+
+## ------------------------------------------------------
+## Two distinct vars needed to access library or project
+## ------------------------------------------------------
+ONF_MAKEDIR ?= $(onf-mk-lib)
+MAKEDIR ?= $(onf-mk-loc)
+
+# -----------------------------------------------------------------------
+# Load per-repository conditionals
+# Load late else alter MAKEFILE_LIST
+# NOTE: config.mk can be removed if dynamic feature detection by
+# file extension is added.
+# -----------------------------------------------------------------------
+include $(wildcard $(lf-sbx-root)/config.mk $(lf-sbx-root)/lf/config.mk)
+
+## -----------------------------------------------------------------------
+## Load makefiles in order:
+## 1) Library constants and logic loaded first
+## 2) Parameterize and augment targets from local (repo specific)
+## -----------------------------------------------------------------------
+include $(onf-mk-lib)/include.mk
+include $(onf-mk-loc)/include.mk
+
+## Define late so caller (?- env --ignore-environment -?)
+GIT ?= /usr/bin/env git
+
+## -----------------------------------------------------------------------
+## Intent: This target will update dependent git-submodule to the latest
+## version available from the remote repository. Subsequently
+## a checkin will be needed to make the submodule update permanent.
+## -----------------------------------------------------------------------
+.PHONY: update-git-submodules
+update-git-submodules:
+ $(GIT) submodule foreach git pull
+
+## -----------------------------------------------------------------------
+## Intent: On-demand cloning of git submodule(s).
+## -----------------------------------------------------------------------
+## Trigger: include $(onf-mk-lib)/include.mk
+## - When the make command attempts to include a makefile from the
+## repo:onf-make submodule, this target/dependency will initialize
+## and checkout all submodules the current repository depends on.
+## -----------------------------------------------------------------------
+.PHONY: git-submodules
+git-submodules : $(onf-mk-lib)/include.mk
+
+$(onf-mk-lib)/include.mk:
+
+ $(call banner-enter,(Checkout git submodules))
+
+ $(GIT) submodule update --init --recursive
+
+ $(call banner-leave,(Checkout git submodules))
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help-git :
+ @printf ' %-33.33s %s\n' 'git-submodules' \
+ 'Init and recursive checkout of git submodule(s)'
+ @printf ' %-33.33s %s\n' 'update-git-submodules' \
+ 'Update git submodule(s) to the latest version'
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/lf/onf-make b/lf/onf-make
new file mode 160000
index 0000000..8d1dbde
--- /dev/null
+++ b/lf/onf-make
@@ -0,0 +1 @@
+Subproject commit 8d1dbde5ff6f329893182abfa9d869af0d71a5d5