[VOL-5285] - JJB Upgrade toward v5
makefiles/include.mk
--------------------
o Define new lib var sandbox-root= pointing at the build directory.
o Added a comment section at the bottom to document declared vars.
makefiles/virtualenv/requirements-txt.mk
----------------------------------------
o Rework pip -r requirements.txt logic to be dependency driven.
o pip install will be run when requirements.txt is modified.
makefiles/virtualenv/include.mk
-------------------------------
o Populate venv-abs-path= with sandbox-root= to insulate against
$(PWD) path changes.
o Split logic into separate makefiles so include.mk remains small.
o Rework dependencies to leverage the new requirements-txt.mk logic.
Misc
----
o Rework help help-* targets to not display everything, all the time.
o make help : display venv (primary target).
o make venv-help : display exteneded help, venv targets and flags.
[HOWTO: test]
% git clone onf-make
% cd onf-make
% touch requirements.txt
% make help | grep venv
% make venv-help
% make venv
% make venv-requirements
% touch requirements.txt
% make venv-requirements
Change-Id: I9e12bc45c73a0e2bc90b1fd11c87ccffc7ebe57a
diff --git a/makefiles/virtualenv/requirements-txt.mk b/makefiles/virtualenv/requirements-txt.mk
new file mode 100644
index 0000000..c524449
--- /dev/null
+++ b/makefiles/virtualenv/requirements-txt.mk
@@ -0,0 +1,59 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 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: 2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+## Intent: pip install with dependencies
+## ----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+venv-requirements := $(venv-abs-path)/makedep/requirements.txt.ts
+
+## -----------------------------------------------------------------------
+## Intent: Define a makefile target able to install venv python modules
+## when changes are made within the requirements.txt file.
+## -----------------------------------------------------------------------
+## [MAKEFILE TARGETS]
+## venv-requirements
+## Named target used to abstract underlying dependency filename.
+## $(venv-requirements-txt)
+## Make macro used to detect changes in requirements.txt file.
+## Timestamp filename is also the primary target for invoking pip install.
+## -----------------------------------------------------------------------
+.PHONY: venv-requirements
+venv-requirements : $(venv-requirements)
+$(venv-requirements) : requirements.txt
+
+ $(call banner-enter,venv-requirements)
+
+ $(activate) && python -m pip install -r 'requirements.txt'
+ @mkdir -p $(dir $@)
+ @touch $@
+
+ $(call banner-leave,venv-requirements)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+venv-help ::
+ @printf ' %-33.33s %s\n' 'venv-requirements' \
+ 'pip install -r requirements.txt (dependency driven)'
+
+# [EOF]