1*06b9b3e0SSimon J. Gerraty# $NetBSD: use-inference.mk,v 1.3 2020/12/07 00:53:30 rillig Exp $ 22c3632d1SSimon J. Gerraty# 32c3632d1SSimon J. Gerraty# Demonstrate that .USE rules do not have an effect on inference rules. 42c3632d1SSimon J. Gerraty# At least not in the special case where the inference rule does not 52c3632d1SSimon J. Gerraty# have any associated commands. 62c3632d1SSimon J. Gerraty 72c3632d1SSimon J. Gerraty.SUFFIXES: 82c3632d1SSimon J. Gerraty.SUFFIXES: .from .to 92c3632d1SSimon J. Gerraty 102c3632d1SSimon J. Gerratyall: use-inference.to 112c3632d1SSimon J. Gerraty 122c3632d1SSimon J. Gerratyverbose: .USE 132c3632d1SSimon J. Gerraty @echo 'Verbosely making $@ out of $>' 142c3632d1SSimon J. Gerraty 152c3632d1SSimon J. Gerraty.from.to: verbose 162c3632d1SSimon J. Gerraty# Since this inference rule does not have any associated commands, it 172c3632d1SSimon J. Gerraty# is ignored. 182c3632d1SSimon J. Gerraty# 192c3632d1SSimon J. Gerraty# @echo 'Building $@ from $<' 202c3632d1SSimon J. Gerraty 212c3632d1SSimon J. Gerratyuse-inference.from: # assume it exists 222c3632d1SSimon J. Gerraty @echo 'Building $@ from nothing' 232c3632d1SSimon J. Gerraty 242c3632d1SSimon J. Gerraty# Possible but unproven explanation: 252c3632d1SSimon J. Gerraty# 262c3632d1SSimon J. Gerraty# The main target is "all", which depends on "use-inference.to". 272c3632d1SSimon J. Gerraty# The inference connects the .from to the .to file, otherwise make 282c3632d1SSimon J. Gerraty# would not know that the .from file would need to be built. 292c3632d1SSimon J. Gerraty# 302c3632d1SSimon J. Gerraty# The .from file is then built. 312c3632d1SSimon J. Gerraty# 322c3632d1SSimon J. Gerraty# After this, make stops since it doesn't know how to make the .to file. 332c3632d1SSimon J. Gerraty# This is strange since make definitely knows about the .from.to suffix 342c3632d1SSimon J. Gerraty# inference rule. But it seems to ignore it, maybe because it doesn't 352c3632d1SSimon J. Gerraty# have any associated commands. 36e2eeea75SSimon J. Gerraty 37*06b9b3e0SSimon J. Gerraty# Until 2020-12-07, despite the error message "don't know how to make", 38*06b9b3e0SSimon J. Gerraty# the exit status was 0. This was inconsistent. 39