opt-jobs-internal.mk revision 1.6 1 # $NetBSD: opt-jobs-internal.mk,v 1.6 2025/05/23 21:05:56 rillig Exp $
2 #
3 # Tests for the (intentionally undocumented) internal -J command line option.
4
5 all: .PHONY
6 @${MAKE} -f ${MAKEFILE} -j1 direct
7 @${MAKE} -f ${MAKEFILE} -j1 direct-syntax
8 @${MAKE} -f ${MAKEFILE} -j1 direct-open
9 @${MAKE} -f ${MAKEFILE} -j1 indirect-open
10 @${MAKE} -f ${MAKEFILE} -j1 indirect-expr
11 @${MAKE} -f ${MAKEFILE} -j1 indirect-comment
12 @${MAKE} -f ${MAKEFILE} -j1 indirect-silent-comment
13 @${MAKE} -f ${MAKEFILE} -j1 indirect-expr-empty
14
15 detect-mode: .PHONY
16 @mode=parallel
17 @echo ${HEADING}: mode=$${mode:-compat}
18
19 # expect: direct: mode=parallel
20 direct: .PHONY
21 @mode=parallel
22 @echo ${.TARGET}: mode=$${mode:-compat}
23
24 # expect: make: error: invalid internal option "-J garbage" in "<curdir>"
25 direct-syntax: .PHONY
26 @${MAKE} -f ${MAKEFILE} -J garbage unexpected-target || :
27
28 # expect: direct-open: mode=compat
29 direct-open: .PHONY
30 @${MAKE} -f ${MAKEFILE} -J 31,32 detect-mode HEADING=${.TARGET}
31
32 # expect: indirect-open: mode=compat
33 indirect-open: .PHONY
34 @${MAKE:U} -f ${MAKEFILE} detect-mode HEADING=${.TARGET}
35
36 # When a command in its unexpanded form contains the expression "${MAKE}"
37 # without any modifiers, the file descriptors get passed around.
38 # expect: indirect-expr: mode=parallel
39 indirect-expr: .PHONY
40 @${MAKE} -f ${MAKEFILE} detect-mode HEADING=${.TARGET}
41
42 # The "# make" comment starts directly after the leading tab and is thus not
43 # considered a shell command line. No file descriptors are passed around.
44 # expect: indirect-comment: mode=compat
45 indirect-comment: .PHONY
46 # make
47 @${MAKE:U} -f ${MAKEFILE} detect-mode HEADING=${.TARGET}
48
49 # When the "# make" comment is prefixed with "@", it becomes a shell command.
50 # As that shell command contains the plain word "make", the file descriptors
51 # get passed around.
52 # expect: indirect-silent-comment: mode=parallel
53 indirect-silent-comment: .PHONY
54 @# make
55 @${MAKE:U} -f ${MAKEFILE} detect-mode HEADING=${.TARGET}
56
57 # When a command in its unexpanded form contains the plain word "make", the
58 # file descriptors get passed around.
59 # expect: indirect-expr-empty: mode=parallel
60 indirect-expr-empty: .PHONY
61 @${:D make}
62 @${MAKE:U} -f ${MAKEFILE} detect-mode HEADING=${.TARGET}
63