1# $NetBSD: deptgt-end-jobs.mk,v 1.1 2020/09/23 03:06:38 rillig Exp $ 2# 3# Tests for the special target .END in dependency declarations, 4# which is run after making the desired targets. 5# 6# This test is very similar to deptgt-end.mk, except for the -j option. 7# This option enables parallel mode, in which the code from job.c partially 8# replaces the code from compat.c. 9# 10# Before 2020-08-22, this test crashed with a null pointer dereference. 11# Before 2020-09-23, this test crashed with an assertion failure. 12.MAKEFLAGS: -j 8 13 14VAR= Should not be expanded. 15 16.BEGIN: 17 : $@ '$${VAR}' 18 ... 19 : $@ '$${VAR}' deferred 20# Oops: The deferred command must not be expanded twice. 21# The Var_Subst in Compat_RunCommand looks suspicious. 22# The Var_Subst in JobSaveCommand looks suspicious. 23 24.END: 25 : $@ '$${VAR}' 26 ... 27 : $@ '$${VAR}' deferred 28 29all: 30 : $@ '$${VAR}' 31 ... 32 : $@ '$${VAR}' deferred 33# Oops: The deferred command must not be expanded twice. 34# The Var_Subst in Compat_RunCommand looks suspicious. 35# The Var_Subst in JobSaveCommand looks suspicious. 36 37# The deferred commands are run in the order '.END .BEGIN all'. 38# This may be unexpected at first since the natural order would be 39# '.BEGIN all .END', but it is implemented correctly. 40# 41# At the point where the commands of a node with deferred commands are run, 42# the deferred commands are appended to the commands of the .END node. 43# This happens in Compat_RunCommand, and to prevent an endless loop, the 44# deferred commands of the .END node itself are not appended to itself. 45# Instead, the deferred commands of the .END node are run as if they were 46# immediate commands. 47