1 1.7 rillig # $NetBSD: deptgt-end-fail.mk,v 1.7 2022/05/07 08:01:20 rillig Exp $ 2 1.1 rillig # 3 1.4 rillig # Tests for an errors in the main target, its dependencies, 4 1.4 rillig # the .END node and its dependencies. 5 1.1 rillig # 6 1.1 rillig # Before 2020-11-25, an error in the .END target did not print the "Stop.", 7 1.2 rillig # even though this was intended. The cause for this was a missing condition 8 1.7 rillig # in Compat_MakeAll, in the code handling the .END node. 9 1.1 rillig 10 1.4 rillig test: .PHONY 11 1.1 rillig 12 1.4 rillig # The default stop-on-error mode is not as interesting to test since it 13 1.4 rillig # stops right after the first error. 14 1.4 rillig .MAKEFLAGS: -k 15 1.4 rillig 16 1.4 rillig .for all in ok ERR 17 1.4 rillig . for all-dep in ok ERR 18 1.4 rillig . for end in ok ERR 19 1.4 rillig . for end-dep in ok ERR 20 1.4 rillig . for target in ${all}-${all-dep}-${end}-${end-dep} 21 1.4 rillig test: ${target} 22 1.4 rillig ${target}: .PHONY .SILENT 23 1.4 rillig echo Test case all=${all} all-dep=${all-dep} end=${end} end-dep=${end-dep}. 24 1.4 rillig ${MAKE} -r -f ${MAKEFILE} \ 25 1.4 rillig all=${all} all-dep=${all-dep} \ 26 1.4 rillig end=${end} end-dep=${end-dep} \ 27 1.4 rillig all; \ 28 1.4 rillig echo "exit status $$?" 29 1.4 rillig echo 30 1.4 rillig echo 31 1.4 rillig . endfor 32 1.4 rillig . endfor 33 1.4 rillig . endfor 34 1.4 rillig . endfor 35 1.4 rillig .endfor 36 1.4 rillig 37 1.4 rillig .if make(all) 38 1.4 rillig 39 1.4 rillig all all-dep end-dep: .PHONY 40 1.4 rillig 41 1.4 rillig CMD.ok= true 42 1.4 rillig CMD.ERR= false 43 1.4 rillig 44 1.4 rillig all: all-dep 45 1.4 rillig : Making ${.TARGET} from ${.ALLSRC}. 46 1.4 rillig @${CMD.${all}} 47 1.4 rillig 48 1.4 rillig all-dep: 49 1.3 rillig : Making ${.TARGET} out of nothing. 50 1.4 rillig @${CMD.${all-dep}} 51 1.4 rillig 52 1.4 rillig .END: end-dep 53 1.4 rillig : Making ${.TARGET} from ${.ALLSRC}. 54 1.4 rillig @${CMD.${end}} 55 1.4 rillig 56 1.4 rillig end-dep: 57 1.4 rillig : Making ${.TARGET} out of nothing. 58 1.4 rillig @${CMD.${end-dep}} 59 1.4 rillig 60 1.4 rillig .endif 61 1.4 rillig 62 1.5 rillig # Until 2020-12-07, several of the test cases printed "`all' not remade 63 1.5 rillig # because of errors.", followed by "exit status 0", which contradicted 64 1.5 rillig # each other. 65 1.4 rillig 66 1.6 rillig # Until 2020-12-07, '.END' was even made if 'all' failed, but if a dependency 67 1.6 rillig # of 'all' failed, it was skipped. This inconsistency was not needed for 68 1.6 rillig # anything and thus has been dropped. To run some commands on error, use the 69 1.6 rillig # .ERROR target instead, see deptgt-error.mk. 70