[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] odd/source_script_in_makefile 4c4501d 1/2: Set multi
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] odd/source_script_in_makefile 4c4501d 1/2: Set multiple variables |
Date: |
Fri, 17 May 2019 14:30:36 -0400 (EDT) |
branch: odd/source_script_in_makefile
commit 4c4501d9a15f26d228e84844b3e9a08a0ab921bf
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.
---
child.make | 3 ++-
parent.make | 11 +++++++----
set.sh | 9 ++++++---
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/child.make b/child.make
index 3c05987..431a1fb 100644
--- a/child.make
+++ b/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/parent.make b/parent.make
index e382efa..bc28e01 100644
--- a/parent.make
+++ b/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/set.sh b/set.sh
index e6ece61..5333d8d 100755
--- a/set.sh
+++ b/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