freebsd-src/unit-tests/sysv.mk
Simon J. Gerraty 1a2b743f6b Import bmake-20200704
from ChangeLog:

    (most of this by rillig@)
    o lots of style and white-space cleanup
    o lots more unit tests for variable modifiers
    o simplified description of some functions
    o str.c: refactor Str_Match
    o var.c: debugging output for :@
      constify VarModify parameter
      fix :hash modifier on 16-bit platforms
      remove unnecessary forward declarations
      refactor ApplyModifier_SysV to have less indentation
      simplify code for :E and :R
      clean up code for :H and :T
      refactor ApplyModifiers

    * var.c: we need stdint.h on some platforms to get uint32_t
    * unit-test/Makefile: we need to supress the specific error
    for RE substitution error in modmisc, since it varies accross
    different OS.
2020-07-08 18:32:15 +00:00

49 lines
765 B
Makefile

# $Id: sysv.mk,v 1.5 2020/07/04 18:16:55 sjg Exp $
FOO ?=
FOOBAR = ${FOO:=bar}
_this := ${.PARSEDIR}/${.PARSEFILE}
B = /b
S = /
FUN = ${B}${S}fun
SUN = the Sun
# we expect nothing when FOO is empty
all: foo fun sam bla words
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