Home | History | Annotate | Line # | Download | only in unit-tests
      1  1.4  rillig # $NetBSD: deptgt-main.mk,v 1.4 2022/01/23 21:48:59 rillig Exp $
      2  1.1  rillig #
      3  1.3  rillig # Tests for the special target .MAIN in dependency declarations, which defines
      4  1.3  rillig # the main target.  This main target is built if no target has been specified
      5  1.3  rillig # on the command line or via MAKEFLAGS.
      6  1.1  rillig 
      7  1.4  rillig # The first target becomes the main target by default.  It can be overridden
      8  1.4  rillig # though.
      9  1.4  rillig all: .PHONY
     10  1.4  rillig 	@echo 'This target is not made.'
     11  1.1  rillig 
     12  1.4  rillig # This target is not the first to be defined, but it lists '.MAIN' as one of
     13  1.4  rillig # its sources.  The word '.MAIN' only has a special meaning when it appears as
     14  1.4  rillig # a _target_ in a dependency declaration, not as a _source_.  It is thus
     15  1.4  rillig # ignored.
     16  1.4  rillig depsrc-main: .PHONY .MAIN
     17  1.4  rillig 	@echo 'This target is not made either.'
     18  1.4  rillig 
     19  1.4  rillig # This target is the first to be marked with '.MAIN', so it replaces the
     20  1.4  rillig # previous main target, which was 'all'.
     21  1.4  rillig .MAIN: real-main
     22  1.4  rillig real-main: .PHONY
     23  1.4  rillig 	@echo 'This target ${.TARGET} is the one that is made.'
     24  1.4  rillig 
     25  1.4  rillig # This target is marked with '.MAIN' but there already is a main target.  The
     26  1.4  rillig # attribute '.MAIN' is thus ignored.
     27  1.4  rillig .MAIN: too-late
     28  1.4  rillig too-late: .PHONY
     29  1.4  rillig 	@echo 'This target comes too late, there is already a .MAIN target.'
     30