xref: /freebsd/contrib/bmake/unit-tests/suff-lookup.mk (revision c9ccf3a32da427475985b85d7df023ccfb138c27)
1# $NetBSD: suff-lookup.mk,v 1.2 2020/10/24 03:18:22 rillig Exp $
2#
3# Demonstrate name resolution for suffixes.
4#
5# See also:
6#	FindSuffByName
7
8.MAKEFLAGS: -ds
9
10all: suff-lookup.cc
11
12.SUFFIXES: .c .cc .ccc
13
14# Register '.short' before '.sho'.  When searching for the transformation
15# '.sho.c', the suffix '.short' must not be found even though it starts with
16# the correct characters.
17.SUFFIXES: .short .sho .dead-end
18
19# From long to short suffix.
20.ccc.cc:
21	: 'Making ${.TARGET} from ${.IMPSRC}.'
22
23# From short to long suffix.
24.c.ccc:
25	: 'Making ${.TARGET} from ${.IMPSRC}.'
26
27.short.c:
28	: 'Making ${.TARGET} from ${.IMPSRC}.'
29.sho.c:
30	: 'Making ${.TARGET} from ${.IMPSRC}.'
31.dead-end.short:
32	: 'Making ${.TARGET} from ${.IMPSRC}.'
33
34suff-lookup.sho:
35	: 'Making ${.TARGET} out of nothing.'
36
37# Deleting all suffixes and adding them again rebuilds all of the above
38# transformation rules.
39.SUFFIXES:
40.SUFFIXES: .c .cc .ccc .short .sho .dead-end
41