[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 3ff6c00 16/16: Rewrite for clarity
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 3ff6c00 16/16: Rewrite for clarity |
Date: |
Sat, 18 May 2019 20:53:38 -0400 (EDT) |
branch: master
commit 3ff6c0081ebfcf5987da3e15b6dcbd558cb67fd8
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Rewrite for clarity
There is no need for a phony target with a static name to create a file
with a dynamic name. It is clearer to write a non-phony target that
generates the file directly.
---
gwc/parent.make | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/gwc/parent.make b/gwc/parent.make
index 8186415..81fd3eb 100644
--- a/gwc/parent.make
+++ b/gwc/parent.make
@@ -2,12 +2,13 @@
# and export environment variables set by that script to make's
# environment:
# - form a unique name $LMI_ENV_FILE for a file to hold the value
-# - add a 'source_env_vars' prerequisite for the top-level makefile,
-# with recipe "$(eval include $LMI_ENV_FILE)"
-# - add a phony 'source_env_vars' target that sources the script
+# - give the top-level makefile a target to remake itself, with
+# - $(eval include $(LMI_ENV_FILE)) in its recipe, and
+# - $(LMI_ENV_FILE) as a prerequisite
+# - add a phony $(LMI_ENV_FILE) target that sources the script
# - make the script write 'make' assignments like "export foo := bar"
-# for each desired environment variable to $LMI_ENV_FILE iff that
-# filename is of nonzero length
+# for each desired environment variable to a file named
+# $LMI_ENV_FILE, iff that filename is of nonzero length
# To test:
# $export LMI_IN=Russia; make -f parent.make all
# $export LMI_IN=Mongolia; make -f parent.make all
@@ -15,13 +16,12 @@
export LMI_ENV_FILE := env_$(shell date -u +'%s_%N').eraseme
-parent.make:: source_env_vars ;
+parent.make:: $(LMI_ENV_FILE)
$(eval include $(LMI_ENV_FILE))
@echo "'$$LMI_IN' --> '$$LMI_OUT1', '$$LMI_OUT2' : eval in
'parent.make'"
rm $(LMI_ENV_FILE)
-.PHONY: source_env_vars
-source_env_vars:
+$(LMI_ENV_FILE):
@echo "Sourcing 'set.sh'"; \
. ./set.sh ; \
echo "'$$LMI_IN' --> '$$LMI_OUT1', '$$LMI_OUT2' : sourced in
'parent.make'"
- [lmi-commits] [lmi] master updated (e0988be -> 3ff6c00), Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master 20f6dd2 15/16: Add git instructions to copy a branch into a master subdirectory, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master 8b0a768 14/16: Invoke 'rm' without '--force', Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master 3ff6c00 16/16: Rewrite for clarity,
Greg Chicares <=
- [lmi-commits] [lmi] master fa96c05 13/16: Make tracing information easier to follow, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master f8d4676 11/16: Improve and compress output trace, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master b00ad83 10/16: Remove duplicated target name; improve documentation, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master 0ca7d61 09/16: Don't write env file if its name is empty or unset, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master 294f232 12/16: Improve documentation, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master c10b229 08/16: Actually perform some work in the script, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master a87426e 07/16: Name temporary environment-variables file OAOO, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master 01aee1e 04/16: Construct a unique temporary filename to avoid collisions, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master 315d415 03/16: Improve encapsulation, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master b4dd6ce 06/16: Resolve an open issue, Greg Chicares, 2019/05/18