Home | History | Annotate | Line # | Download | only in unit-tests
suff-main.mk revision 1.1
      1  1.1  rillig # $NetBSD: suff-main.mk,v 1.1 2020/10/18 16:33:18 rillig Exp $
      2  1.1  rillig #
      3  1.1  rillig # Demonstrate that an inference rule is considered the main target if its
      4  1.1  rillig # suffixes are not known at the point of declaration.
      5  1.1  rillig 
      6  1.1  rillig .1.2:
      7  1.1  rillig 	: Making ${.TARGET} from ${.IMPSRC}.
      8  1.1  rillig 
      9  1.1  rillig # At this point, the target '.1.2' is a normal target.
     10  1.1  rillig # Since it is the first target in the first dependency declaration,
     11  1.1  rillig # it becomes the main target.
     12  1.1  rillig 
     13  1.1  rillig next-main:
     14  1.1  rillig 	: Making ${.TARGET}
     15  1.1  rillig 
     16  1.1  rillig # At this point, 'next-main' is effectively ignored.
     17  1.1  rillig 
     18  1.1  rillig # Declaring both '.1' and '.2' as suffixes turns the '.1.2' target into an
     19  1.1  rillig # inference rule (OP_TRANSFORM).  As a side effect, this target is no longer
     20  1.1  rillig # a candidate for the main target.  Therefore the next target is selected as
     21  1.1  rillig # the main target, which in this case is 'next-main'.
     22  1.1  rillig .SUFFIXES: .1 .2
     23