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