Last active
March 24, 2016 15:19
-
-
Save deryni/3615cc5f03760abecf51 to your computer and use it in GitHub Desktop.
Sub-make exporting test for http://stackoverflow.com/q/36158577/258523
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export lst := | |
$(warning Using make $(MAKE_VERSION)) | |
tmp := a | |
lst += $(tmp) | |
$(warning lst is $(value lst):$(flavor lst)) | |
tmp := b | |
lst += $(tmp) | |
$(warning lst is $(value lst):$(flavor lst)) | |
all: | |
$(MAKE) -f sub.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ make -f main.mk -s | |
main.mk:3: Using make 3.81 | |
main.mk:7: lst is a:simple | |
main.mk:11: lst is a b:simple | |
sub.mk:1: MAKEFLAGS:s | |
sub.mk:2: MAKEOVERRIDES: | |
sub.mk:3: -*-command-variables-*-: | |
sub.mk:7: lst is a b $(tmp):recursive | |
sub.mk:11: lst is a b $(tmp) $(tmp):recursive | |
+ make -f main.mk -s lst=foo | |
main.mk:3: Using make 3.81 | |
main.mk:7: lst is foo:recursive | |
main.mk:11: lst is foo:recursive | |
sub.mk:1: MAKEFLAGS:s | |
sub.mk:2: MAKEOVERRIDES:${-*-command-variables-*-} | |
sub.mk:3: -*-command-variables-*-:lst=foo | |
sub.mk:7: lst is foo $(tmp):recursive | |
sub.mk:11: lst is foo $(tmp) $(tmp):recursive | |
+ make -f main.mk -s lst:=foo | |
main.mk:3: Using make 3.81 | |
main.mk:7: lst is foo:simple | |
main.mk:11: lst is foo:simple | |
sub.mk:1: MAKEFLAGS:s | |
sub.mk:2: MAKEOVERRIDES:${-*-command-variables-*-} | |
sub.mk:3: -*-command-variables-*-:lst:=foo | |
sub.mk:7: lst is foo c:simple | |
sub.mk:11: lst is foo c d:simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ make-4.1/make -f main.mk -s | |
main.mk:3: Using make 4.1 | |
main.mk:7: lst is a:simple | |
main.mk:11: lst is a b:simple | |
sub.mk:1: MAKEFLAGS:s | |
sub.mk:2: MAKEOVERRIDES: | |
sub.mk:3: -*-command-variables-*-: | |
sub.mk:7: lst is a b $(tmp):recursive | |
sub.mk:11: lst is a b $(tmp) $(tmp):recursive | |
+ make-4.1/make -f main.mk -s lst=foo | |
main.mk:3: Using make 4.1 | |
main.mk:7: lst is foo:recursive | |
main.mk:11: lst is foo:recursive | |
sub.mk:1: MAKEFLAGS:s | |
sub.mk:2: MAKEOVERRIDES:${-*-command-variables-*-} | |
sub.mk:3: -*-command-variables-*-:lst=foo | |
sub.mk:7: lst is foo $(tmp):recursive | |
sub.mk:11: lst is foo $(tmp) $(tmp):recursive | |
+ make-4.1/make -f main.mk -s lst:=foo | |
main.mk:3: Using make 4.1 | |
main.mk:7: lst is foo:simple | |
main.mk:11: lst is foo:simple | |
sub.mk:1: MAKEFLAGS:s | |
sub.mk:2: MAKEOVERRIDES:${-*-command-variables-*-} | |
sub.mk:3: -*-command-variables-*-:lst:=foo | |
sub.mk:7: lst is foo c:simple | |
sub.mk:11: lst is foo c d:simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -x | |
{ | |
make -f main.mk -s | |
make -f main.mk -s lst=foo | |
make -f main.mk -s lst:=foo | |
} > OUTPUT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(warning MAKEFLAGS:$(value MAKEFLAGS)) | |
$(warning MAKEOVERRIDES:$(value MAKEOVERRIDES)) | |
$(warning -*-command-variables-*-:$(value -*-command-variables-*-)) | |
tmp := c | |
override lst += $(tmp) | |
$(warning lst is $(value lst):$(flavor lst)) | |
tmp := d | |
override lst += $(tmp) | |
$(warning lst is $(value lst):$(flavor lst)) | |
all: ; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment