1 1.1.4.2 perseant # $NetBSD: posix-execution.mk,v 1.1.4.2 2025/08/02 05:58:36 perseant Exp $ 2 1.1.4.2 perseant # 3 1.1.4.2 perseant # https://pubs.opengroup.org/onlinepubs/9799919799/utilities/make.html#tag_20_76_13_03 4 1.1.4.2 perseant # 5 1.1.4.2 perseant 6 1.1.4.2 perseant .POSIX: 7 1.1.4.2 perseant 8 1.1.4.2 perseant 9 1.1.4.2 perseant # The target consists of two commands, which are executed separately. 10 1.1.4.2 perseant # The second command thus does not see the shell variable from the first 11 1.1.4.2 perseant # command. 12 1.1.4.2 perseant # expect: one-at-a-time: shell_variable is 'second' 13 1.1.4.2 perseant all: one-at-a-time 14 1.1.4.2 perseant one-at-a-time: 15 1.1.4.2 perseant @shell_variable=first 16 1.1.4.2 perseant @echo "$@: shell_variable is '$${shell_variable:-second}'" 17 1.1.4.2 perseant 18 1.1.4.2 perseant 19 1.1.4.2 perseant # expect: echo "prefixes: ignore errors"; exit 13 20 1.1.4.2 perseant # expect: prefixes: ignore errors 21 1.1.4.2 perseant # expect-not: echo "prefixes: no echo" 22 1.1.4.2 perseant # expect: prefixes: no echo 23 1.1.4.2 perseant # expect: prefixes: always, no echo 24 1.1.4.2 perseant all: prefixes 25 1.1.4.2 perseant prefixes: 26 1.1.4.2 perseant -echo "$@: ignore errors"; exit 13 27 1.1.4.2 perseant @echo "$@: no echo" 28 1.1.4.2 perseant +@echo "$@: always, no echo" 29 1.1.4.2 perseant 30 1.1.4.2 perseant 31 1.1.4.2 perseant # Deviation from POSIX: The shell "-e" option is not in effect. 32 1.1.4.2 perseant # expect: shell-e-option: before 33 1.1.4.2 perseant # expect: shell-e-option: after 34 1.1.4.2 perseant all: shell-e-option 35 1.1.4.2 perseant shell-e-option: 36 1.1.4.2 perseant @echo '$@: before'; false; echo '$@: after' 37 1.1.4.2 perseant 38 1.1.4.2 perseant 39 1.1.4.2 perseant # expect-not-matches: ^do%-prefix%-plus: a regular command 40 1.1.4.2 perseant # expect: do-prefix-plus: prefixed by plus 41 1.1.4.2 perseant # expect: do-prefix-plus: prefixed by plus 42 1.1.4.2 perseant all: prefix-plus 43 1.1.4.2 perseant prefix-plus: 44 1.1.4.2 perseant @${MAKE} -f ${MAKEFILE} -n do-prefix-plus 45 1.1.4.2 perseant @${MAKE} -f ${MAKEFILE} -n -j1 do-prefix-plus 46 1.1.4.2 perseant do-prefix-plus: 47 1.1.4.2 perseant @echo '$@: a regular command' 48 1.1.4.2 perseant @+echo '$@: prefixed by plus' 49 1.1.4.2 perseant @echo '$@: a regular command' 50 1.1.4.2 perseant 51 1.1.4.2 perseant 52 1.1.4.2 perseant # expect: do-error-not-ignored: successful 53 1.1.4.2 perseant # expect-not: do-error-not-ignored: after an error 54 1.1.4.2 perseant all: error-not-ignored 55 1.1.4.2 perseant error-not-ignored: 56 1.1.4.2 perseant @${MAKE} -f ${MAKEFILE} do-error-not-ignored || : 57 1.1.4.2 perseant do-error-not-ignored: 58 1.1.4.2 perseant @echo '$@: successful'; exit 13 59 1.1.4.2 perseant @echo '$@: after an error' 60