1*8d5c8e21SSimon J. Gerraty# $NetBSD: dep-duplicate.mk,v 1.4 2024/05/25 21:11:30 rillig Exp $ 29f45a3c8SSimon J. Gerraty# 39f45a3c8SSimon J. Gerraty# Test for a target whose commands are defined twice. This generates a 49f45a3c8SSimon J. Gerraty# warning, not an error, so ensure that the correct commands are kept. 59f45a3c8SSimon J. Gerraty# 69f45a3c8SSimon J. Gerraty# Also ensure that the diagnostics mention the correct file in case of 79f45a3c8SSimon J. Gerraty# included files. Since parse.c 1.231 from 2018-12-22 and before parse.c 89f45a3c8SSimon J. Gerraty# 1.653 from 2022-01-20, the wrong filename had been printed if the file of 99f45a3c8SSimon J. Gerraty# the first commands section was included by its relative path. 109f45a3c8SSimon J. Gerraty 119f45a3c8SSimon J. Gerratyall: .PHONY 129f45a3c8SSimon J. Gerraty @exec > dep-duplicate.main; \ 139f45a3c8SSimon J. Gerraty echo '# empty line 1'; \ 149f45a3c8SSimon J. Gerraty echo '# empty line 2'; \ 159f45a3c8SSimon J. Gerraty echo 'all:; @echo main-output'; \ 16*8d5c8e21SSimon J. Gerraty echo '.include "dep-duplicate.tmp"' 179f45a3c8SSimon J. Gerraty 18*8d5c8e21SSimon J. Gerraty @exec > dep-duplicate.tmp; \ 199f45a3c8SSimon J. Gerraty echo 'all:; @echo inc-output' 209f45a3c8SSimon J. Gerraty 219f45a3c8SSimon J. Gerraty # The main file must be specified using a relative path, just like the 229f45a3c8SSimon J. Gerraty # default 'makefile' or 'Makefile', to produce the same result when 239f45a3c8SSimon J. Gerraty # run via ATF or 'make test'. 249f45a3c8SSimon J. Gerraty @${MAKE} -r -f dep-duplicate.main 259f45a3c8SSimon J. Gerraty 269f45a3c8SSimon J. Gerraty @rm -f dep-duplicate.main 27*8d5c8e21SSimon J. Gerraty @rm -f dep-duplicate.tmp 28