Home | History | Annotate | Line # | Download | only in unit-tests
dep-duplicate.mk revision 1.2
      1  1.2  rillig # $NetBSD: dep-duplicate.mk,v 1.2 2022/01/20 19:16:25 rillig Exp $
      2  1.1  rillig #
      3  1.1  rillig # Test for a target whose commands are defined twice.  This generates a
      4  1.1  rillig # warning, not an error, so ensure that the correct commands are kept.
      5  1.1  rillig #
      6  1.1  rillig # Also ensure that the diagnostics mention the correct file in case of
      7  1.2  rillig # included files.  Since parse.c 1.231 from 2018-12-22 and before parse.c
      8  1.2  rillig # 1.653 from 2022-01-20, the wrong filename had been printed if the file of
      9  1.2  rillig # the first commands section was in a file that was included by its relative
     10  1.2  rillig # path.
     11  1.1  rillig 
     12  1.2  rillig # expect: make: "dep-duplicate.inc" line 3: warning: using previous script for "all" defined here
     13  1.2  rillig # FIXME: The file "dep-duplicate.inc" has no line 3.
     14  1.1  rillig 
     15  1.1  rillig all: .PHONY
     16  1.2  rillig 	@exec > dep-duplicate.main; \
     17  1.2  rillig 	echo '# empty line 1'; \
     18  1.2  rillig 	echo '# empty line 2'; \
     19  1.2  rillig 	echo 'all:; @echo main-output'; \
     20  1.2  rillig 	echo '.include "dep-duplicate.inc"'
     21  1.1  rillig 
     22  1.2  rillig 	@exec > dep-duplicate.inc; \
     23  1.2  rillig 	echo 'all:; @echo inc-output'
     24  1.1  rillig 
     25  1.2  rillig 	# The main file must be specified using a relative path, just like the
     26  1.2  rillig 	# default 'makefile' or 'Makefile', to produce the same result when
     27  1.2  rillig 	# run via ATF or 'make test'.
     28  1.2  rillig 	@${MAKE} -r -f dep-duplicate.main
     29  1.2  rillig 
     30  1.2  rillig 	@rm -f dep-duplicate.main
     31  1.1  rillig 	@rm -f dep-duplicate.inc
     32