makefiles/consts.mk
-------------------
o Define a non-verbose (no -t) xargs macro.
makefiles/include.mk
--------------------
o Define a path variable (local-mk-dir=) to access per-repo macros.
o Change global ONF_MAKEDIR= path to $(onf-mk-dir).
makefiles/lint/doc8/doc8.ini
makefiles/lint/doc8/doc8.mk
makefiles/lint/doc8/help.mk
makefiles/lint/doc8/include.mk
makefiles/lint/doc8/ini.mk
makefiles/lint/doc8/README.md
-----------------------------
o per-repository exclusions require using multiple --config doc8.ini.
o doc8 --config only accepts one flag.
o lint logic will merge configs into one.
o Added a conditional var to facilitate using --config doc8.ini.
makefiles/main/tempdir/
-----------------------
o Added logic to create and cleanup a tempdir for internal use.
Signed-off-by: Joey Armstrong <jarmstrong@linuxfoundation.org>
Change-Id: Ic1c54e982d6e24465bd38f02f60a3b700a7d9e33
diff --git a/makefiles/consts.mk b/makefiles/consts.mk
index 21f9fbc..7bb882d 100644
--- a/makefiles/consts.mk
+++ b/makefiles/consts.mk
@@ -86,7 +86,8 @@
# lint-shell:
# <tab>find . -name '*.sh' -print0 | $(xargs-n1-clean) shellcheck $(args)
# -----------------------------------------------------------------------
-xargs-cmd := xargs -0 -t --no-run-if-empty
+xargs-cmd0 := xargs -0 --no-run-if-empty
+xargs-cmd := $(xargs-cmd0) -t
xargs-n1 := $(xargs-cmd) -n1
xargs-n1-clean := $(env-clean) $(xargs-n1)
xargs-cmd-clean := $(env-clean) $(xargs-cmd)
diff --git a/makefiles/include.mk b/makefiles/include.mk
index 6280735..ddcc857 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -42,55 +42,60 @@
## Missing required vars are fatal
onf-mk-dir ?= $(error onf-mk-dir= is required)
onf-mk-top ?= $(error onf-mk-top= is required)
-onf-mk-tmp := $(onf-mk-top)/tmp
+onf-mk-tmp := $(onf-mk-top)/tmp# # TODO: Replace with lf-mk-tmp
+
+# per-repository paths: mirror repo:onf-make
+local-mk-top := $(onf-mk-top)
+local-mk-dir := $(dir $(onf-mk-dir))local
ONF_MAKEDIR := $(onf-mk-dir)# # TODO: Deprecate ONF_MAKEDIR and MAKEDIR
#--------------------##
##---] INCLUDES [---##
##--------------------##
-include $(ONF_MAKEDIR)/lint/make/warn-undef-vars.mk # target lint-make helper
+include $(onf-mk-dir)/lint/make/warn-undef-vars.mk # target lint-make helper
-include $(ONF_MAKEDIR)/consts.mk
-include $(ONF_MAKEDIR)/help/include.mk # render target help
-include $(ONF_MAKEDIR)/utils/include.mk # dependency-less helper macros
-include $(ONF_MAKEDIR)/etc/include.mk # banner macros
+include $(onf-mk-dir)/consts.mk
+include $(onf-mk-dir)/help/include.mk # render target help
+include $(onf-mk-dir)/utils/include.mk # dependency-less helper macros
+include $(onf-mk-dir)/etc/include.mk # banner macros
+include $(onf-mk-dir)/main/include.mk # tempdir
-include $(ONF_MAKEDIR)/virtualenv/include.mk# # python, lint, JJB dependency
-# include $(ONF_MAKEDIR)/patches/include.mk# # Patch when python 3.10+ in use
+include $(onf-mk-dir)/virtualenv/include.mk# # python, lint, JJB dependency
+# include $(onf-mk-dir)/patches/include.mk# # Patch when python 3.10+ in use
-include $(ONF_MAKEDIR)/commands/include.mk # Tools and local installers
-include $(ONF_MAKEDIR)/lint/include.mk
+include $(onf-mk-dir)/commands/include.mk # Tools and local installers
+include $(onf-mk-dir)/lint/include.mk
-include $(ONF_MAKEDIR)/gerrit/include.mk
-include $(ONF_MAKEDIR)/git/include.mk
-include $(ONF_MAKEDIR)/jjb/include.mk
+include $(onf-mk-dir)/gerrit/include.mk
+include $(onf-mk-dir)/git/include.mk
+include $(onf-mk-dir)/jjb/include.mk
$(if $(USE-VOLTHA-RELEASE-MK),\
- $(eval include $(ONF_MAKEDIR)/release/include.mk))
+ $(eval include $(onf-mk-dir)/release/include.mk))
-include $(ONF_MAKEDIR)/todo.mk
-include $(ONF_MAKEDIR)/help/variables.mk
+include $(onf-mk-dir)/todo.mk
+include $(onf-mk-dir)/help/variables.mk
##------------------------------------##
##---] Languages & Interpreters [---##
##------------------------------------##
# [TODO] $(if $(golang-mode),$(eval include))
-include $(ONF_MAKEDIR)/golang/include.mk
+include $(onf-mk-dir)/golang/include.mk
##---------------------##
##---] ON_DEMAND [---##
##---------------------##
-$(if $(USE-ONF-GERRIT-MK),$(eval include $(ONF_MAKEDIR)/gerrit/include.mk))
-$(if $(USE-ONF-DOCKER-MK),$(eval include $(ONF_MAKEDIR)/docker/include.mk))
+$(if $(USE-ONF-GERRIT-MK),$(eval include $(onf-mk-dir)/gerrit/include.mk))
+$(if $(USE-ONF-DOCKER-MK),$(eval include $(onf-mk-dir)/docker/include.mk))
##-------------------##
##---] TARGETS [---##
##-------------------##
-include $(ONF_MAKEDIR)/targets/include.mk # clean, sterile
+include $(onf-mk-dir)/targets/include.mk # clean, sterile
## Display make help text late
-include $(ONF_MAKEDIR)/help/trailer.mk
+include $(onf-mk-dir)/help/trailer.mk
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/lint/doc8/README.md b/makefiles/lint/doc8/README.md
new file mode 100644
index 0000000..0596967
--- /dev/null
+++ b/makefiles/lint/doc8/README.md
@@ -0,0 +1,17 @@
+doc8
+====
+
+The doc8 tool can be configured by modifying doc8.ini files.
+Common config changes can be added in repo:onf-make/makefiles/lint/doc8.
+per-repository changes can be added in lf/local/makefiles/lint/doc8/doc8.ini.
+
+The makefile target lint-doc8 will merge these two config files into
+a single config prior to invoking the doc8 tool.
+
+Common exclusions are added in repo:onf-make/makefiles/lint/doc8/doc.ini.
+
+[TODO]
+ - Deploy repo:onf-make to all voltha repositories.
+ - Create lf/local/lib/makefiles/doc8/doc.ini and configure.
+ - Once all repositories have been updated delete lint/doc8/excl.mk
+
diff --git a/makefiles/lint/doc8/doc8.ini b/makefiles/lint/doc8/doc8.ini
index 3fe7969..fd87fdc 100644
--- a/makefiles/lint/doc8/doc8.ini
+++ b/makefiles/lint/doc8/doc8.ini
@@ -1,26 +1,5 @@
[doc8]
-# -----------------------------------------------------------------------
-# Copyright 2017-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: 2017-2024 Open Networking Foundation Contributors
-# SPDX-License-Identifier: Apache-2.0
-# -----------------------------------------------------------------------
-# Intent:
-# -----------------------------------------------------------------------
-
## -----------------------------------------------------------------------
# $ doc8 -h
#
diff --git a/makefiles/lint/doc8/doc8.mk b/makefiles/lint/doc8/doc8.mk
index 9bb71fc..2c499ac 100644
--- a/makefiles/lint/doc8/doc8.mk
+++ b/makefiles/lint/doc8/doc8.mk
@@ -1,12 +1,12 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2017-2024 Open Networking Foundation Contributors
+# Copyright 2017-2022 Open Networking Foundation
#
# 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
+# 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,
@@ -14,11 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------
-# SPDX-FileCopyrightText: 2017-2024 Open Networking Foundation Contributors
-# SPDX-License-Identifier: Apache-2.0
-# -----------------------------------------------------------------------
-# Intent:
-# -----------------------------------------------------------------------
$(if $(DEBUG),$(eval LINT_DOC8_DEBUG=1))
@@ -37,7 +32,9 @@
# use only one. Repos have more special exclusions so pass onf-make
# doc8 config as command line args so local makefiles to use --config
# -----------------------------------------------------------------------
-# lint-doc8-args += --config $(ONF_MAKEDIR)/lint/doc8/doc8.ini
+ifdef USE_DOC8_INI
+ lint-doc8-args += --config $(ONF_MAKEDIR)/lint/doc8/doc8.ini
+endif
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
@@ -72,7 +69,9 @@
## -----------------------------------------------------------------------
## Usage: make lint-doc8 LINT_DOC8_DEBUG=1
## -----------------------------------------------------------------------
-lint-doc8: lint-doc8-cmd-version
+lint-doc8: \
+ lint-doc8-cmd-version \
+ lint-doc8-ini-tmp
$(call banner-enter,Target $@)
$(activate) && doc8 $(lint-doc8-excl) $(lint-doc8-args)
diff --git a/makefiles/lint/doc8/help.mk b/makefiles/lint/doc8/help.mk
index 5dbd23a..1ec6cb8 100644
--- a/makefiles/lint/doc8/help.mk
+++ b/makefiles/lint/doc8/help.mk
@@ -1,12 +1,12 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2023-2024 Open Networking Foundation Contributors
+# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF 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
+# 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,
@@ -14,11 +14,6 @@
# 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
-# -----------------------------------------------------------------------
-# Intent:
-# -----------------------------------------------------------------------
$(if $(DEBUG),$(warning ENTER))
diff --git a/makefiles/lint/doc8/include.mk b/makefiles/lint/doc8/include.mk
index d1b69cb..83bbcbf 100644
--- a/makefiles/lint/doc8/include.mk
+++ b/makefiles/lint/doc8/include.mk
@@ -1,12 +1,12 @@
# -*- makefile -*-
# -----------------------------------------------------------------------
-# Copyright 2017-2024 Open Networking Foundation Contributors
+# Copyright 2017-2022 Open Networking Foundation
#
# 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
+# 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,
@@ -14,11 +14,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
# -----------------------------------------------------------------------
-# SPDX-FileCopyrightText: 2017-2024 Open Networking Foundation Contributors
-# SPDX-License-Identifier: Apache-2.0
-# -----------------------------------------------------------------------
-# Intent:
-# -----------------------------------------------------------------------
# NOTE: The doc8 command runs recursively on directories so targets
# *-mod and *-src are not yet supported.
# -----------------------------------------------------------------------
@@ -26,9 +21,11 @@
##--------------------##
##---] INCLUDES [---##
##--------------------##
-include $(ONF_MAKEDIR)/lint/doc8/doc8.mk
-include $(ONF_MAKEDIR)/lint/doc8/excl.mk
-include $(ONF_MAKEDIR)/lint/doc8/help.mk
-include $(ONF_MAKEDIR)/lint/doc8/install.mk
+include $(onf-mk-top)/lint/doc8/ini.mk
+include $(onf-mk-top)/lint/doc8/excl.mk
+include $(onf-mk-top)/lint/doc8/help.mk
+include $(onf-mk-top)/lint/doc8/install.mk
+
+include $(onf-mk-top)/lint/doc8/doc8.mk
# [EOF]
diff --git a/makefiles/lint/doc8/ini.mk b/makefiles/lint/doc8/ini.mk
index 7a2393f..971bfb4 100644
--- a/makefiles/lint/doc8/ini.mk
+++ b/makefiles/lint/doc8/ini.mk
@@ -17,7 +17,9 @@
# SPDX-FileCopyrightText: 2023-2024 Open Networking Foundation Contributors
# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
-# Intent:
+# Intent: doc8(s) --config switch will only accept one argument and
+# config(s)/exclusion(s) are needed from multiple sources.
+# This target will merge doc8.ini from onf-make/ and local/ for use.
# -----------------------------------------------------------------------
##-------------------##
@@ -32,18 +34,12 @@
lint-doc8-ini-tmp : $(lint-doc8-ini-tmp)
# -----------------------------------------------------------------------
-# Intent: Doc8(s) --config switch will only accept one argument and
-# configs/exclusions are needed from multiple sources.
-# This target will merge doc8.ini from onf-make/ and local/ for use.
+# doc8 config files to merge: lf/makefiles/{onf-make,local}/
# -----------------------------------------------------------------------
-# repo:onf-make is special, MAKEDIR=makefiles/local does not exist.
-# -----------------------------------------------------------------------
-lint-doc8-ini-raw := $(ONF_MAKEDIR)/lint/doc8/doc8.ini
-ifneq ($(--repo-name--),onf-make)
- lint-doc8-ini-raw += $(MAKEDIR)/lint/doc8/doc8.ini
-endif
+lint-doc8-ini-raw := $(onf-mk-dir)/lint/doc8/doc8.ini
+lint-doc8-ini-raw += $(local-mk-dir)/lint/doc8/doc8.ini
-lint-doc8-ini-src = $(wildcard $(lint-doc8-ini-raw))
+lint-doc8-ini-src = $(wildcard $(sort $(lint-doc8-ini-raw)))
$(lint-doc8-ini-tmp):
$(call banner,Target $@)
diff --git a/makefiles/main/include.mk b/makefiles/main/include.mk
new file mode 100644
index 0000000..5030758
--- /dev/null
+++ b/makefiles/main/include.mk
@@ -0,0 +1,33 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-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: 2022-2024 Open Networking Foundation (ONF) Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+ifndef lf-mk-seen--main # guard macro, include once
+
+ $(if $(DEBUG),$(warning ENTER))
+
+# include $(onf-mk-dir)/main/tempdir.mk
+ include $(onf-mk-dir)/main/tempdir/include.mk
+ lf-mk-seen--main := true
+
+ $(if $(DEBUG),$(warning LEAVE))
+
+endif # lf-mk-seen--main
+
+# [EOF]
diff --git a/makefiles/main/tempdir/debug.mk b/makefiles/main/tempdir/debug.mk
new file mode 100644
index 0000000..2fb9148
--- /dev/null
+++ b/makefiles/main/tempdir/debug.mk
@@ -0,0 +1,38 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF 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: 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+ifdef DEBUG
+
+$(info )
+$(warning ** IAM)
+$(info -----------------------------------------------------------------------)
+$(info ** lf-mk-tmp = $(lf-mk-tmp))
+$(info ** lf-mk-tmp-name = $(lf-mk-tmp-name))
+$(info ** lf-mk-tmp-create = $(lf-mk-tmp-create))
+$(info )
+$(info ** lf-mk-user-meta = $(lf-mk-user-meta))
+$(info ** lf-mk-user-mktemp = $(lf-mk-user-mktemp))
+$(info ** lf-mk-meta-create = $(lf-mk-meta-create))
+$(info -----------------------------------------------------------------------)
+$(info )
+
+endif # DEBUG
+
+# [EOF]
diff --git a/makefiles/main/tempdir/help.mk b/makefiles/main/tempdir/help.mk
new file mode 100644
index 0000000..f73f2b2
--- /dev/null
+++ b/makefiles/main/tempdir/help.mk
@@ -0,0 +1,65 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-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: 2017-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Display target help
+## -----------------------------------------------------------------------
+help ::
+ @printf ' %-33.33s %s\n' 'lf-tempdir(-help)' \
+ 'Create a temp directory for internal makefile use'
+
+## -----------------------------------------------------------------------
+## Intent: Display extended target help
+## -----------------------------------------------------------------------
+lf-tempdir-help:
+ @printf 'Usage: make [options] [target] ...\n'
+ @printf ' %-33.33s %s\n' 'lf-mk-tmp-create' \
+ 'Create a temporary directory (dependency driven)'
+ @printf ' %-33.33s %s\n' 'lf-mk-meta-create' \
+ 'Create a directory for tempdir timestamp tracking'
+ @printf ' %-33.33s %s\n' 'lf-mk-todo' \
+ 'Display a list of enhancements for the target'
+
+ @printf '\n[VARS]\n'
+ @printf ' %-33.33s %s\n' ' lf-mk-tmp=' \
+ 'Temp directory path'
+ @printf ' %-33.33s %s\n' ' lf-mk-tmp-name=' \
+ 'Temp directory basename'
+ @printf ' %-33.33s %s\n' ' lf-mk-user-meta=' \
+ 'Per-user timestamp and resource directory (internal)'
+ @printf ' %-33.33s %s\n' ' lf-mk-user-mktemp=' \
+ 'Per-user temp directory paths (one per invocation)'
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+# todo-all += lf-mk-todo
+lf-mk-todo ::
+
+ $(call banner-enter,$@)
+
+ @printf '\n[TODO]\n'
+ @printf ' * Replace lf/include.mk macro onf-mk-tmp= with lf-mk-tmp=\n'
+ @printf ' * Create a BATS unit test for tempdir creation\n'
+ @printf ' * Document makefile targets and behavior on docs.voltha.org\n'
+ @printf '\n'
+
+ $(call banner-leave,$@)
+
+# [EOF]
diff --git a/makefiles/main/tempdir/include.mk b/makefiles/main/tempdir/include.mk
new file mode 100644
index 0000000..5de3cde
--- /dev/null
+++ b/makefiles/main/tempdir/include.mk
@@ -0,0 +1,30 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022-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: 2022-2024 Open Networking Foundation (ONF) Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+$(if $(DEBUG),$(warning ENTER))
+
+include $(onf-mk-dir)/main/tempdir/debug.mk
+include $(onf-mk-dir)/main/tempdir/help.mk
+include $(onf-mk-dir)/main/tempdir/tempdir.mk
+include $(onf-mk-dir)/main/tempdir/todo.mk
+
+$(if $(DEBUG),$(warning LEAVE))
+
+# [EOF]
diff --git a/makefiles/main/tempdir/tempdir.mk b/makefiles/main/tempdir/tempdir.mk
new file mode 100644
index 0000000..f854139
--- /dev/null
+++ b/makefiles/main/tempdir/tempdir.mk
@@ -0,0 +1,99 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2024 Open Networking Foundation (ONF) 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: 2017-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent: This makefile is intended for extremely limited use:
+# o A temp directory is created for internal makefile use.
+# o Installers, downloads, etc.
+# o Allowing garbage to persist in /tmp is not desirable behavior.
+# o Create breadcrumbs for the sterile target to find and remove later.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+lf-mk-tmp := $(shell mktemp --directory -t 'repo-LF-make.XXXXXXXXXX')
+lf-mk-tmp-name := $(notdir $(lf-mk-tmp))
+
+lf-mk-user-meta ?= $(dir $(lf-mk-tmp)/)$(USER).mk.meta
+lf-mk-user-mktemp ?= $(lf-mk-user-meta)/mktemp
+
+lf-mk-tmp-create := $(lf-mk-tmp)/.exists
+lf-mk-meta-create := $(lf-mk-user-mktemp)/$(lf-mk-tmp-name)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: lf-tempdir
+lf-tempdir : lf-mk-meta-create
+
+## -----------------------------------------------------------------------
+## Intent: Create tempdir
+## o Create a temp directory
+## o Create a timestamp file to record time of creation
+## -----------------------------------------------------------------------
+.PHONY: lf-mk-tmp-create
+lf-mk-tmp-create : $(lf-mk-tmp-create)
+$(lf-mk-tmp-create) :
+
+ $(if $(DEBUG),$(call banner-enter,$@))
+ @mkdir -p $(dir $@)
+ @touch $@
+ $(if $(DEBUG),$(call banner-leave,$@))
+
+## -----------------------------------------------------------------------
+## Intent: Create a timestamp file for temp directory cleanup:
+## o Create a storage directory
+## o Record timestamp file used by temp directory creation
+## -----------------------------------------------------------------------
+.PHONY: lf-mk-meta-create
+lf-mk-meta-create : lf-mk-tmp-create $(lf-mk-meta-create)
+$(lf-mk-meta-create) :
+
+ $(if $(DEBUG),$(call banner-enter,$@))
+ @mkdir -p $(dir $@)
+ @printf "$(lf-mk-tmp-create)" >> "$(lf-mk-user-mktemp)/$(lf-mk-tmp-name)"
+ $(if $(DEBUG),$(call banner-leave,$@))
+
+## -----------------------------------------------------------------------
+## Intent: Remove temp directories created by a makefile run.
+## o Automated directory cleanup is not easily supported by make.
+## o Use breadcrumbs dropped during tempdir creation for removal.
+## o Only consider subdirs older than the current makefile run.
+## o Only consider subdirs older than +n days (persistent cron jobs).
+## -----------------------------------------------------------------------
+sterile-timestamp = $(shell date '+%Y-%m-%d' -d '3 days ago')
+sterile ::
+
+ # Create a reference file to remove lingering stale directories
+ $(HELP)touch --date "$(sterile-timestamp)" "$(lf-mk-tmp-create)-stale"
+
+ $(HIDE)find '$(dir $(lf-mk-tmp))' -maxdepth 1 -name 'repo-LF-make*' -type d -print0 \
+ | $(xargs-cmd0) -I'{}' find {} -name '.exists' -not -newer "$(lf-mk-tmp-create)-stale" -print0 \
+ | $(xargs-n1-clean) dirname --zero \
+ | $(xargs-n1-clean) $(RM) -vr
+
+ # Remove late: target dep (sterile : clean) would remove breadcrumbs
+ @$(MAKE) --no-print-directory clean
+
+## -----------------------------------------------------------------------
+## Intent : Remove mktemp for the current invocation
+## -----------------------------------------------------------------------
+clean ::
+ $(RM) -r "$(lf-mk-tmp)"
+
+# [EOF]
diff --git a/makefiles/main/tempdir/todo.mk b/makefiles/main/tempdir/todo.mk
new file mode 100644
index 0000000..3880c7a
--- /dev/null
+++ b/makefiles/main/tempdir/todo.mk
@@ -0,0 +1,40 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-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: 2017-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Display a list of future enhancements
+## -----------------------------------------------------------------------
+lf-mk-todo ::
+
+ $(call banner-enter,$@)
+
+ @printf '\n[TODO]\n'
+ @printf ' * Replace lf/include.mk macro onf-mk-tmp= with lf-mk-tmp=\n'
+ @printf ' * Create a BATS unit test for tempdir creation\n'
+ @printf ' + make lf-tempdir; ls /tmp/repo-LF*\n'
+ @printf ' + make lf-tempdir clean; ls /tmp/repo-LF*\n'
+ @printf ' * Document makefile targets and behavior on docs.voltha.org\n'
+ @printf '\n'
+
+ $(call banner-leave,$@)
+
+todo :: lf-mk-todo
+
+# [EOF]