xref: /freebsd/contrib/bmake/unit-tests/deptgt-ignore.mk (revision 9f45a3c8c82ffead7044ae836d9257113c630d3b)
1# $NetBSD: deptgt-ignore.mk,v 1.4 2022/01/22 21:50:41 rillig Exp $
2#
3# Tests for the special target .IGNORE in dependency declarations, which
4# does not stop if a command from this target exits with a non-zero status.
5#
6# This test only applies to compatibility mode.  In jobs mode such as with
7# '-j1', all commands for a single target are bundled into a single shell
8# program, which is a different implementation technique, the .IGNORE applies
9# there as well.
10
11.MAKEFLAGS: -d0			# force stdout to be unbuffered
12
13all: depends-on-failed depends-on-ignored
14.PHONY: all depends-on-failed depends-on-ignored error-failed error-ignored
15
16error-failed error-ignored:
17	@echo '${.TARGET} before'
18	@false
19	@echo '${.TARGET} after'
20
21depends-on-failed: error-failed
22	@echo 'Making ${.TARGET} from ${.ALLSRC}.'
23depends-on-ignored: error-ignored
24	@echo 'Making ${.TARGET} from ${.ALLSRC}.'
25
26# Even though the command 'false' in the middle fails, the remaining commands
27# are still run.  After that, the target is marked made, so targets depending
28# on the target with the ignored commands are made.
29.IGNORE: error-ignored
30
31#.MAKEFLAGS: -dg2
32