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