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
638 B
Makefile
44 lines
638 B
Makefile
# $Id: sysv.mk,v 1.9 2020/08/23 16:08:32 sjg Exp $
|
|
|
|
all: foo fun sam bla
|
|
|
|
FOO ?=
|
|
FOOBAR = ${FOO:=bar}
|
|
|
|
_this := ${.PARSEDIR}/${.PARSEFILE}
|
|
|
|
B = /b
|
|
S = /
|
|
FUN = ${B}${S}fun
|
|
SUN = the Sun
|
|
|
|
# we expect nothing when FOO is empty
|
|
foo:
|
|
@echo FOOBAR = ${FOOBAR}
|
|
.if empty(FOO)
|
|
@FOO="foo fu" ${.MAKE} -f ${_this} foo
|
|
.endif
|
|
|
|
fun:
|
|
@echo ${FUN:T}
|
|
@echo ${FUN:${B}${S}fun=fun}
|
|
@echo ${FUN:${B}${S}%=%}
|
|
@echo ${In:L:%=% ${SUN}}
|
|
|
|
|
|
SAM=sam.c
|
|
|
|
sam:
|
|
@echo ${SAM:s%.c=acme}
|
|
@echo ${SAM:s%.c=a%.d}
|
|
@echo ${SAM:s.c=a%.d}
|
|
@echo ${SAM:sam.c=a%.c}
|
|
@echo ${SAM:%=a%.c}
|
|
@echo ${SAM:%.c=a%.c}
|
|
@echo ${SAM:sam%=a%.c}
|
|
|
|
BLA=
|
|
|
|
bla:
|
|
@echo $(BLA:%=foo/%x)
|