1 # $NetBSD: deptgt-delete_on_error.mk,v 1.3 2020/10/25 21:31:00 rillig Exp $ 2# 3# Tests for the special target .DELETE_ON_ERROR in dependency declarations, 4# which controls whether the target is deleted if a shell command fails or 5# is interrupted. 6# 7# In compatibility mode, regular and phony targets are deleted, but precious 8# targets are preserved. 9# 10# In parallel mode, regular targets are deleted, while phony and precious 11# targets are preserved. 12# 13# See also: 14# CompatDeleteTarget 15# JobDeleteTarget 16 17THIS= deptgt-delete_on_error 18TARGETS= ${THIS}-regular ${THIS}-regular-delete 19TARGETS+= ${THIS}-phony ${THIS}-phony-delete 20TARGETS+= ${THIS}-precious ${THIS}-precious-delete 21 22all: 23 @rm -f ${TARGETS} 24 @echo 'Compatibility mode' 25 @-${.MAKE} -f ${MAKEFILE} -k ${TARGETS} 26 @rm -f ${TARGETS} 27 @echo 28 @echo 'Parallel mode' 29 @-${.MAKE} -f ${MAKEFILE} -k -j1 ${TARGETS} 30 @rm -f ${TARGETS} 31 32${THIS}-regular{,-delete}: 33 > ${.TARGET}; false 34 35${THIS}-phony{,-delete}: .PHONY 36 > ${.TARGET}; false 37 38${THIS}-precious{,-delete}: .PRECIOUS 39 > ${.TARGET}; false 40 41# The special target .DELETE_ON_ERROR is a global setting. 42# It does not apply to single targets. 43# The following line is therefore misleading but does not generate any 44# warning or even an error message. 45.DELETE_ON_ERROR: ${TARGETS:M*-delete} 46