[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 0401064 02/16: Set multiple variables
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 0401064 02/16: Set multiple variables |
Date: |
Sat, 18 May 2019 20:53:35 -0400 (EDT) |
branch: master
commit 0401064d7b120447d22a58068dc9a54fcc21eeec
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Set multiple variables
Test thus, e.g.:
$export LMI_IN=G; LANG=fr_CA make -f parent.make all
It is important to make sure that multiple variables are set correctly.
---
gwc/child.make | 3 ++-
gwc/parent.make | 11 +++++++----
gwc/set.sh | 9 ++++++---
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/gwc/child.make b/gwc/child.make
index 3c05987..431a1fb 100644
--- a/gwc/child.make
+++ b/gwc/child.make
@@ -1,4 +1,5 @@
.PHONY: all
all:
@echo "LMI_IN in 'child.make': $$LMI_IN"
- @echo "LMI_OUT in 'child.make': $$LMI_OUT"
+ @echo "LMI_OUT1 in 'child.make': $$LMI_OUT1"
+ @echo "LMI_OUT2 in 'child.make': $$LMI_OUT2"
diff --git a/gwc/parent.make b/gwc/parent.make
index e382efa..bc28e01 100644
--- a/gwc/parent.make
+++ b/gwc/parent.make
@@ -33,7 +33,8 @@ parent.make parent.make:: env.make ;
# $(eval include) here is necessary and sufficient.
$(eval include env.make)
@echo "eval: LMI_IN in 'parent.make': $$LMI_IN"
- @echo "eval: LMI_OUT in 'parent.make': $$LMI_OUT"
+ @echo "eval: LMI_OUT1 in 'parent.make': $$LMI_OUT1"
+ @echo "eval: LMI_OUT2 in 'parent.make': $$LMI_OUT2"
# Doesn't execute recipe without ".PHONY":
.PHONY: env.make
@@ -41,12 +42,14 @@ parent.make parent.make:: env.make ;
#env.make: set.sh
env.make:
@echo "Sourcing 'set.sh'"
- . ./set.sh ; echo "export LMI_OUT := $$LMI_OUT" > env.make
+ . ./set.sh ; echo "export LMI_OUT1 := $$LMI_OUT1\\nexport LMI_OUT2 :=
$$LMI_OUT2" > env.make
@echo "target: LMI_IN in 'parent.make': $$LMI_IN"
- @echo "target: LMI_OUT in 'parent.make': $$LMI_OUT ...but wait..."
+ @echo "target: LMI_OUT1 in 'parent.make': $$LMI_OUT1 ...but wait..."
+ @echo "target: LMI_OUT2 in 'parent.make': $$LMI_OUT2 ...but wait..."
all:
- @echo "LMI_OUT for targets in 'parent.make': $$LMI_OUT"
+ @echo "LMI_OUT1 for targets in 'parent.make': $$LMI_OUT1"
+ @echo "LMI_OUT2 for targets in 'parent.make': $$LMI_OUT2"
$(MAKE) --no-print-directory -f child.make
# Obviously one could simply write a cover script to replace direct
diff --git a/gwc/set.sh b/gwc/set.sh
index e6ece61..5333d8d 100755
--- a/gwc/set.sh
+++ b/gwc/set.sh
@@ -3,9 +3,12 @@
foo()
{
echo "LMI_IN in 'set.sh': $LMI_IN"
-echo "LMI_OUT entering 'set.sh': $LMI_OUT"
-export LMI_OUT="$LMI_IN"
-echo "LMI_OUT leaving 'set.sh': $LMI_OUT"
+echo "LMI_OUT1 entering 'set.sh': $LMI_OUT1"
+echo "LMI_OUT2 entering 'set.sh': $LMI_OUT2"
+export LMI_OUT1="$LMI_IN"
+export LMI_OUT2="$LANG"
+echo "LMI_OUT1 leaving 'set.sh': $LMI_OUT1"
+echo "LMI_OUT2 leaving 'set.sh': $LMI_OUT2"
}
foo
- [lmi-commits] [lmi] master b00ad83 10/16: Remove duplicated target name; improve documentation, (continued)
- [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
- [lmi-commits] [lmi] master 65cbb2f 05/16: Remove obsolete commentary, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master 6eace72 01/16: Source a shell script in a makefile, Greg Chicares, 2019/05/18
- [lmi-commits] [lmi] master 0401064 02/16: Set multiple variables,
Greg Chicares <=