2c3632d14f
Lots of code refactoring, simplification and cleanup. Lots of new unit-tests providing much higher code coverage. All courtesy of rillig at netbsd. Other significant changes: o new read-only variable .SHELL which provides the path of the shell used to run scripts (as defined by the .SHELL target). o variable parsing detects more errors. o new debug option -dl: LINT mode, does the equivalent of := for all variable assignments so that file and line number are reported for variable parse errors.
44 lines
893 B
Makefile
44 lines
893 B
Makefile
# $Id: export.mk,v 1.1.1.4 2020/08/08 22:34:25 sjg Exp $
|
|
|
|
UT_TEST=export
|
|
UT_FOO=foo${BAR}
|
|
UT_FU=fubar
|
|
UT_ZOO=hoopie
|
|
UT_NO=all
|
|
# believe it or not, we expect this one to come out with $UT_FU unexpanded.
|
|
UT_DOLLAR= This is $$UT_FU
|
|
|
|
.export UT_FU UT_FOO
|
|
.export UT_DOLLAR
|
|
|
|
.if !defined(.MAKE.PID)
|
|
.error .MAKE.PID must be defined
|
|
.endif
|
|
@= at
|
|
%= percent
|
|
*= asterisk
|
|
${:U!}= exclamation # A direct != would try to run "exclamation"
|
|
# as a shell command and assign its output
|
|
# to the empty variable.
|
|
&= ampersand
|
|
|
|
# This is ignored because it is internal.
|
|
.export .MAKE.PID
|
|
# These are ignored because they are local to the target.
|
|
.export @
|
|
.export %
|
|
.export *
|
|
.export !
|
|
.export &
|
|
# This is ignored because it is undefined.
|
|
.export UNDEFINED
|
|
|
|
BAR=bar is ${UT_FU}
|
|
|
|
.MAKE.EXPORTED+= UT_ZOO UT_TEST
|
|
|
|
FILTER_CMD?= egrep -v '^(MAKEFLAGS|PATH|PWD|SHLVL|_)='
|
|
|
|
all:
|
|
@env | ${FILTER_CMD} | sort
|