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.
41 lines
960 B
Makefile
Executable File
41 lines
960 B
Makefile
Executable File
# $NetBSD: export-variants.mk,v 1.2 2020/08/08 13:00:07 rillig Exp $
|
|
#
|
|
# Test whether exported variables apply to each variant of running
|
|
# external commands:
|
|
#
|
|
# The != assignments.
|
|
# The :!cmd! modifier.
|
|
# The :sh modifier.
|
|
|
|
SHVAR!= env | grep ^UT_ || true
|
|
.if ${SHVAR} != ""
|
|
.warning At this point, no variable should be exported.
|
|
.endif
|
|
|
|
.if ${:!env | grep ^UT_ || true!} != ""
|
|
.warning At this point, no variable should be exported.
|
|
.endif
|
|
|
|
.if ${env | grep ^UT_ || true:L:sh} != ""
|
|
.warning At this point, no variable should be exported.
|
|
.endif
|
|
|
|
UT_VAR= value
|
|
.export UT_VAR
|
|
|
|
SHVAR!= env | grep ^UT_ || true
|
|
.if ${SHVAR} != "UT_VAR=value"
|
|
.warning At this point, no variable should be exported.
|
|
.endif
|
|
|
|
.if ${:!env | grep ^UT_ || true!} != "UT_VAR=value"
|
|
.warning At this point, some variables should be exported.
|
|
.endif
|
|
|
|
.if ${env | grep ^UT_ || true:L:sh} != "UT_VAR=value"
|
|
.warning At this point, some variables should be exported.
|
|
.endif
|
|
|
|
all:
|
|
@:;
|