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