Home | History | Annotate | Line # | Download | only in unit-tests
      1  1.4  rillig # $NetBSD: dep-duplicate.mk,v 1.4 2024/05/25 21:11:30 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.3  rillig # the first commands section was included by its relative path.
     10  1.1  rillig 
     11  1.1  rillig all: .PHONY
     12  1.2  rillig 	@exec > dep-duplicate.main; \
     13  1.2  rillig 	echo '# empty line 1'; \
     14  1.2  rillig 	echo '# empty line 2'; \
     15  1.2  rillig 	echo 'all:; @echo main-output'; \
     16  1.4  rillig 	echo '.include "dep-duplicate.tmp"'
     17  1.1  rillig 
     18  1.4  rillig 	@exec > dep-duplicate.tmp; \
     19  1.2  rillig 	echo 'all:; @echo inc-output'
     20  1.1  rillig 
     21  1.2  rillig 	# The main file must be specified using a relative path, just like the
     22  1.2  rillig 	# default 'makefile' or 'Makefile', to produce the same result when
     23  1.2  rillig 	# run via ATF or 'make test'.
     24  1.2  rillig 	@${MAKE} -r -f dep-duplicate.main
     25  1.2  rillig 
     26  1.2  rillig 	@rm -f dep-duplicate.main
     27  1.4  rillig 	@rm -f dep-duplicate.tmp
     28