2005-06-27 09:01:07 +08:00
|
|
|
# -*-perl-*-
|
|
|
|
|
|
|
|
$description = 'Test the $(shell ...) function.';
|
|
|
|
|
|
|
|
$details = '';
|
|
|
|
|
2015-07-13 09:03:24 +08:00
|
|
|
# Test standard shell
|
|
|
|
run_make_test('.PHONY: all
|
|
|
|
OUT := $(shell echo hi)
|
|
|
|
all: ; @echo $(OUT)
|
|
|
|
','','hi');
|
2005-06-27 09:01:07 +08:00
|
|
|
|
|
|
|
# Test shells inside rules.
|
|
|
|
run_make_test('.PHONY: all
|
|
|
|
all: ; @echo $(shell echo hi)
|
2015-07-13 09:03:24 +08:00
|
|
|
','','hi');
|
|
|
|
|
|
|
|
# Verify .SHELLSTATUS
|
|
|
|
run_make_test('.PHONY: all
|
|
|
|
PRE := $(.SHELLSTATUS)
|
|
|
|
$(shell exit 0)
|
|
|
|
OK := $(.SHELLSTATUS)
|
|
|
|
$(shell exit 1)
|
|
|
|
BAD := $(.SHELLSTATUS)
|
|
|
|
all: ; @echo PRE=$(PRE) OK=$(OK) BAD=$(BAD)
|
|
|
|
','','PRE= OK=0 BAD=1');
|
2005-06-27 09:01:07 +08:00
|
|
|
|
|
|
|
|
2009-09-29 07:08:49 +08:00
|
|
|
# Test unescaped comment characters in shells. Savannah bug #20513
|
2016-12-23 07:47:26 +08:00
|
|
|
run_make_test(q!
|
2009-09-29 07:08:49 +08:00
|
|
|
FOO := $(shell echo '#')
|
|
|
|
foo: ; echo '$(FOO)'
|
|
|
|
!,
|
2016-12-23 07:47:26 +08:00
|
|
|
'', "echo '#'\n#\n");
|
2009-09-29 07:08:49 +08:00
|
|
|
|
2005-06-27 09:01:07 +08:00
|
|
|
# Test shells inside exported environment variables.
|
|
|
|
# This is the test that fails if we try to put make exported variables into
|
|
|
|
# the environment for a $(shell ...) call.
|
|
|
|
run_make_test('
|
|
|
|
export HI = $(shell echo hi)
|
|
|
|
.PHONY: all
|
|
|
|
all: ; @echo $$HI
|
2015-07-13 09:03:24 +08:00
|
|
|
','','hi');
|
2005-06-27 09:01:07 +08:00
|
|
|
|
2016-04-11 05:12:48 +08:00
|
|
|
# Test shell errors in recipes including offset
|
|
|
|
run_make_test('
|
|
|
|
all:
|
|
|
|
@echo hi
|
|
|
|
$(shell ./basdfdfsed there)
|
|
|
|
@echo there
|
|
|
|
',
|
|
|
|
'', "#MAKE#: ./basdfdfsed: Command not found\nhi\nthere\n");
|
|
|
|
|
2005-06-27 09:01:07 +08:00
|
|
|
1;
|
2016-04-11 05:12:48 +08:00
|
|
|
|
|
|
|
### Local Variables:
|
|
|
|
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
|
|
|
|
### End:
|