# $NetBSD: posix1.mk,v 1.3 2014/08/30 22:21:08 sjg Exp $ # Keep the default suffixes from interfering, just in case. .SUFFIXES: all: line-continuations suffix-substitution localvars # we need to clean for repeatable results .BEGIN: clean clean: @rm -f lib.a dir/* dummy obj* # # Line continuations # # Escaped newlines and leading whitespace from the next line are replaced # with single space, except in commands, where the escape and the newline # are retained, but a single leading tab (if any) from the next line is # removed. (PR 49085) # Expect: # ${VAR} = "foo bar baz" # a # b # c VAR = foo\ \ bar\ baz line-continuations: @echo '$${VAR} = "${VAR}"' @echo 'aXbXc' | sed -e 's/X/\ /g' # # Suffix substitution # # The only variable modifier accepted by POSIX. # ${VAR:s1=s2}: replace s1, if found, with s2 at end of each word in # ${VAR}. s1 and s2 may contain macro expansions. # Expect: foo baR baz, bar baz, foo bar baz, fooadd baradd bazadd suffix-substitution: @echo '${VAR:r=R}, ${VAR:foo=}, ${VAR:not_there=wrong}, ${VAR:=add}' # # Local variables: regular forms, D/F forms and suffix substitution. # # In the past substitutions did not work with the D/F forms and those # forms were not available for $?. (PR 49085) ARFLAGS = -rcv localvars: lib.a # $@ = target or archive name $< = implied source # $* = target without suffix $? = sources newer than target # $% = archive member name LOCALS = \ "Local variables\n\ \$${@}=\"${@}\" \$${<}=\"${<}\"\n\ \$${*}=\"${*}\" \$${?}=\"${?}\"\n\ \$${%%}=\"${%}\"\n\n" # $XD = directory part of X $XF = file part of X # X is one of the local variables. LOCAL_ALTERNATIVES = \ "Directory and filename parts of local variables\n\ \$${@D}=\"${@D}\" \$${@F}=\"${@F}\"\n\ \$${'${@}' dir/obj_1.h obj_2.h obj3.h dummy dir/dummy: mkdir -p '${@D}' touch '${@}'