]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bmake/unit-tests/use-inference.mk
Merge bmake-20201117
[FreeBSD/FreeBSD.git] / contrib / bmake / unit-tests / use-inference.mk
1 # $NetBSD: use-inference.mk,v 1.2 2020/11/05 00:41:04 rillig Exp $
2 #
3 # Demonstrate that .USE rules do not have an effect on inference rules.
4 # At least not in the special case where the inference rule does not
5 # have any associated commands.
6
7 .SUFFIXES:
8 .SUFFIXES: .from .to
9
10 all: use-inference.to
11
12 verbose: .USE
13         @echo 'Verbosely making $@ out of $>'
14
15 .from.to: verbose
16 # Since this inference rule does not have any associated commands, it
17 # is ignored.
18 #
19 #       @echo 'Building $@ from $<'
20
21 use-inference.from:             # assume it exists
22         @echo 'Building $@ from nothing'
23
24 # Possible but unproven explanation:
25 #
26 # The main target is "all", which depends on "use-inference.to".
27 # The inference connects the .from to the .to file, otherwise make
28 # would not know that the .from file would need to be built.
29 #
30 # The .from file is then built.
31 #
32 # After this, make stops since it doesn't know how to make the .to file.
33 # This is strange since make definitely knows about the .from.to suffix
34 # inference rule.  But it seems to ignore it, maybe because it doesn't
35 # have any associated commands.
36
37 # XXX: Despite the error message "don't know how to make", the exit status
38 # is 0.  This is inconsistent.