[BACK]Return to sysv.mk CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / usr.bin / make / unit-tests

File: [cvs.NetBSD.org] / src / usr.bin / make / unit-tests / Attic / sysv.mk (download)

Revision 1.6, Sun Jul 19 14:23:02 2020 UTC (3 years, 9 months ago) by rillig
Branch: MAIN
Changes since 1.5: +11 -3 lines

make(1): add test for ampersand in SysV substitution modifier

# $Id: sysv.mk,v 1.6 2020/07/19 14:23:02 rillig Exp $

all: foo fun sam bla words ampersand

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)

# The :Q looks like a modifier but isn't.
# It is part of the replacement string.
words:
	@echo a${a b c d e:L:%a=x:Q}b

# As of 2020-07-19, an ampersand can be used in the replacement part
# of a SysV substitution modifier.  This can either be an intentional
# feature or an implementation mistake, as it is not mentioned in the
# manual page.
ampersand:
	@echo ${:U${a.bcd.e:L:a.%=%}:Q}
	@echo ${:U${a.bcd.e:L:a.%=&}:Q}