2020-11-07 19:39:21 +00:00
|
|
|
# $NetBSD: deptgt-end.mk,v 1.6 2020/10/23 19:28:17 rillig Exp $
|
2020-09-05 16:11:04 +00:00
|
|
|
#
|
|
|
|
# Tests for the special target .END in dependency declarations,
|
|
|
|
# which is run after making the desired targets.
|
|
|
|
|
2020-11-07 19:39:21 +00:00
|
|
|
VAR= Should not be expanded.
|
|
|
|
|
2020-09-05 16:11:04 +00:00
|
|
|
.BEGIN:
|
2020-11-07 19:39:21 +00:00
|
|
|
: $@ '$${VAR}'
|
|
|
|
...
|
|
|
|
: $@ '$${VAR}' deferred
|
|
|
|
# Oops: The deferred command must not be expanded twice.
|
|
|
|
# The Var_Subst in Compat_RunCommand looks suspicious.
|
|
|
|
# The Var_Subst in JobSaveCommand looks suspicious.
|
2020-09-05 16:11:04 +00:00
|
|
|
|
|
|
|
.END:
|
2020-11-07 19:39:21 +00:00
|
|
|
: $@ '$${VAR}'
|
|
|
|
...
|
|
|
|
: $@ '$${VAR}' deferred
|
|
|
|
|
|
|
|
# The .END node can define dependencies, just like a regular target.
|
|
|
|
.END: end-action
|
|
|
|
end-action: .NOTMAIN
|
|
|
|
: $@ '$${VAR}'
|
|
|
|
...
|
|
|
|
: $@ '$${VAR}' deferred
|
2020-09-05 16:11:04 +00:00
|
|
|
|
|
|
|
all:
|
2020-11-07 19:39:21 +00:00
|
|
|
: $@ '$${VAR}'
|
|
|
|
...
|
|
|
|
: $@ '$${VAR}' deferred
|
|
|
|
# Oops: The deferred command must not be expanded twice.
|
|
|
|
# The Var_Subst in Compat_RunCommand looks suspicious.
|
|
|
|
# The Var_Subst in JobSaveCommand looks suspicious.
|
|
|
|
|
|
|
|
# The deferred commands are run in the order '.END .BEGIN all'.
|
|
|
|
# This may be unexpected at first since the natural order would be
|
|
|
|
# '.BEGIN all .END', but it is implemented correctly.
|
|
|
|
#
|
|
|
|
# At the point where the commands of a node with deferred commands are run,
|
|
|
|
# the deferred commands are appended to the commands of the .END node.
|
|
|
|
# This happens in Compat_RunCommand, and to prevent an endless loop, the
|
|
|
|
# deferred commands of the .END node itself are not appended to itself.
|
|
|
|
# Instead, the deferred commands of the .END node are run as if they were
|
|
|
|
# immediate commands.
|