xref: /freebsd/contrib/bmake/unit-tests/suff.mk (revision 6a7405f5a6b639682cacf01e35d561411ff556aa)
1*6a7405f5SSimon J. Gerraty# $NetBSD: suff.mk,v 1.3 2025/01/14 21:39:25 rillig Exp $
2*6a7405f5SSimon J. Gerraty#
3*6a7405f5SSimon J. Gerraty# Demonstrate suffix rules and dependency resolution.
4*6a7405f5SSimon J. Gerraty
5*6a7405f5SSimon J. Gerraty
6*6a7405f5SSimon J. Gerraty# Circumvent the file system cache.
7*6a7405f5SSimon J. Gerraty.if !make(init) && !make(step*)
8*6a7405f5SSimon J. Gerratyall:
9*6a7405f5SSimon J. Gerraty	@${MAKE} -f ${MAKEFILE} init
10*6a7405f5SSimon J. Gerraty	@${MAKE} -f ${MAKEFILE} step1
11*6a7405f5SSimon J. Gerraty.endif
12*6a7405f5SSimon J. Gerraty
13*6a7405f5SSimon J. Gerraty
14*6a7405f5SSimon J. Gerraty.if make(init)
15*6a7405f5SSimon J. Gerratyinit:
16*6a7405f5SSimon J. Gerraty.  if ${.PARSEDIR:tA} != ${.CURDIR:tA}
17*6a7405f5SSimon J. Gerraty${:U}!=		cd ${MAKEFILE:H} && cp a*.mk ${.CURDIR}
18*6a7405f5SSimon J. Gerraty.  endif
19*6a7405f5SSimon J. Gerraty.endif
20*6a7405f5SSimon J. Gerraty
21*6a7405f5SSimon J. Gerraty
22*6a7405f5SSimon J. Gerraty.if make(step1)
23*6a7405f5SSimon J. Gerratystep1: .PHONY edge-case.to everything
24*6a7405f5SSimon J. Gerraty
25*6a7405f5SSimon J. Gerraty.MAKEFLAGS: -dsv
26*6a7405f5SSimon J. Gerraty
27*6a7405f5SSimon J. Gerraty.SUFFIXES: .from .to
28*6a7405f5SSimon J. Gerraty
29*6a7405f5SSimon J. Gerraty.from.to:
30*6a7405f5SSimon J. Gerraty	: Making ${.TARGET} from ${.ALLSRC}.
31*6a7405f5SSimon J. Gerraty
32*6a7405f5SSimon J. Gerraty# When making this target, ${.ARCHIVE} is undefined, but there's no warning.
33*6a7405f5SSimon J. Gerraty# expect: Var_Parse: ${.ARCHIVE}.additional (eval)
34*6a7405f5SSimon J. Gerratyedge-case.to: ${.PREFIX}${.ARCHIVE}.additional
35*6a7405f5SSimon J. Gerraty
36*6a7405f5SSimon J. Gerratyedge-case.from edge-case.additional:
37*6a7405f5SSimon J. Gerraty	: Making ${.TARGET} out of nothing.
38*6a7405f5SSimon J. Gerraty
39*6a7405f5SSimon J. Gerratyeverything: .PHONY a*.mk
40*6a7405f5SSimon J. Gerraty	: Making ${.TARGET} from ${.ALLSRC}.
41*6a7405f5SSimon J. Gerraty.endif
42