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