make/tests/scripts/variables/MAKELEVEL
Paul Smith 539f513773 Fix for bug #1276: Handle SHELL according to POSIX requirements.
POSIX requires that the value of SHELL in the makefile NOT be exported
to sub-commands.  Instead, the value in the environment when make was
invoked should be passed to the environment of sub-commands.  Note that
make still uses SHELL to _run_ sub-commands; it just doesn't change the
value of the SHELL variable in the environment of sub-commands.

As an extension to POSIX, if the makefile explicitly exports SHELL then
GNU make _will_ use it in the environment of sub-commands.
2004-11-28 23:11:23 +00:00

33 lines
641 B
Perl

# -*-perl-*-
$description = "The following test creates a makefile to test
makelevels in Make. It prints \$(MAKELEVEL) and then
prints the environment variable MAKELEVEL";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<EOF;
all:
\t\@echo MAKELEVEL is \$(MAKELEVEL)
\techo \$\$MAKELEVEL
EOF
# END of Contents of MAKEFILE
close(MAKEFILE);
# RUN MAKE
&run_make_with_options($makefile,"",&get_logfile);
# SET ANSWER
$answer = "MAKELEVEL is 0\necho \$MAKELEVEL\n1\n";
# COMPARE RESULTS
&compare_output($answer,&get_logfile(1));
1;