1# $Id: sysv.mk,v 1.5 2020/07/04 18:16:55 sjg Exp $
2
3FOO ?=
4FOOBAR = ${FOO:=bar}
5
6_this := ${.PARSEDIR}/${.PARSEFILE}
7
8B = /b
9S = /
10FUN = ${B}${S}fun
11SUN = the Sun
12
13# we expect nothing when FOO is empty
14all: foo fun sam bla words
15
16foo:
17	@echo FOOBAR = ${FOOBAR}
18.if empty(FOO)
19	@FOO="foo fu" ${.MAKE} -f ${_this} foo
20.endif
21
22fun:
23	@echo ${FUN:T}
24	@echo ${FUN:${B}${S}fun=fun}
25	@echo ${FUN:${B}${S}%=%}
26	@echo ${In:L:%=% ${SUN}}
27
28
29SAM=sam.c
30
31sam:
32	@echo ${SAM:s%.c=acme}
33	@echo ${SAM:s%.c=a%.d}
34	@echo ${SAM:s.c=a%.d}
35	@echo ${SAM:sam.c=a%.c}
36	@echo ${SAM:%=a%.c}
37	@echo ${SAM:%.c=a%.c}
38	@echo ${SAM:sam%=a%.c}
39
40BLA=
41
42bla:
43	@echo $(BLA:%=foo/%x)
44
45# The :Q looks like a modifier but isn't.
46# It is part of the replacement string.
47words:
48	@echo a${a b c d e:L:%a=x:Q}b
49