freebsd-src/unit-tests/deptgt-delete_on_error.mk
Simon J. Gerraty 302da1a3d3 Import bmake-20201101
Lots of new unit-tests increase code coverage.

Lots of refactoring, cleanup and simlpification to reduce
code size.

Fixes for Bug 223564 and 245807

Updates to dirdeps.mk and meta2deps.py
2020-11-07 19:39:21 +00:00

46 lines
1.3 KiB
Makefile

# $NetBSD: deptgt-delete_on_error.mk,v 1.3 2020/10/25 21:31:00 rillig Exp $
#
# Tests for the special target .DELETE_ON_ERROR in dependency declarations,
# which controls whether the target is deleted if a shell command fails or
# is interrupted.
#
# In compatibility mode, regular and phony targets are deleted, but precious
# targets are preserved.
#
# In parallel mode, regular targets are deleted, while phony and precious
# targets are preserved.
#
# See also:
# CompatDeleteTarget
# JobDeleteTarget
THIS= deptgt-delete_on_error
TARGETS= ${THIS}-regular ${THIS}-regular-delete
TARGETS+= ${THIS}-phony ${THIS}-phony-delete
TARGETS+= ${THIS}-precious ${THIS}-precious-delete
all:
@rm -f ${TARGETS}
@echo 'Compatibility mode'
@-${.MAKE} -f ${MAKEFILE} -k ${TARGETS}
@rm -f ${TARGETS}
@echo
@echo 'Parallel mode'
@-${.MAKE} -f ${MAKEFILE} -k -j1 ${TARGETS}
@rm -f ${TARGETS}
${THIS}-regular{,-delete}:
> ${.TARGET}; false
${THIS}-phony{,-delete}: .PHONY
> ${.TARGET}; false
${THIS}-precious{,-delete}: .PRECIOUS
> ${.TARGET}; false
# The special target .DELETE_ON_ERROR is a global setting.
# It does not apply to single targets.
# The following line is therefore misleading but does not generate any
# warning or even an error message.
.DELETE_ON_ERROR: ${TARGETS:M*-delete}