2021-04-04 13:13:09 +03:00
|
|
|
# $NetBSD: deptgt.mk,v 1.11 2021/04/04 10:13:09 rillig Exp $
|
2020-08-16 15:07:50 +03:00
|
|
|
#
|
2020-08-16 17:25:16 +03:00
|
|
|
# Tests for special targets like .BEGIN or .SUFFIXES in dependency
|
|
|
|
# declarations.
|
2020-08-16 15:07:50 +03:00
|
|
|
|
|
|
|
# TODO: Implementation
|
|
|
|
|
2020-09-14 20:43:36 +03:00
|
|
|
# Just in case anyone tries to compile several special targets in a single
|
|
|
|
# dependency line: That doesn't work, and make immediately rejects it.
|
|
|
|
.SUFFIXES .PHONY: .c.o
|
|
|
|
|
2020-09-14 21:27:15 +03:00
|
|
|
# The following lines demonstrate how 'targets' is set and reset during
|
2020-09-14 21:21:26 +03:00
|
|
|
# parsing of dependencies. To see it in action, set breakpoints in:
|
|
|
|
#
|
2021-04-04 13:13:09 +03:00
|
|
|
# ParseDependency at the beginning
|
2020-09-26 02:35:25 +03:00
|
|
|
# FinishDependencyGroup at "targets = NULL"
|
2020-09-14 21:21:26 +03:00
|
|
|
# Parse_File at "Lst_Free(targets)"
|
2020-10-18 16:02:10 +03:00
|
|
|
# Parse_File at "targets = Lst_New()"
|
2020-09-26 02:39:51 +03:00
|
|
|
# ParseLine_ShellCommand at "targets == NULL"
|
2020-09-14 21:21:26 +03:00
|
|
|
#
|
2020-09-14 21:27:15 +03:00
|
|
|
# Keywords:
|
|
|
|
# parse.c:targets
|
|
|
|
|
|
|
|
target1 target2: sources # targets := [target1, target2]
|
|
|
|
: command1 # targets == [target1, target2]
|
|
|
|
: command2 # targets == [target1, target2]
|
|
|
|
VAR=value # targets := NULL
|
|
|
|
: command3 # parse error, since targets == NULL
|
2020-09-14 21:21:26 +03:00
|
|
|
|
2020-11-15 14:57:00 +03:00
|
|
|
# In a dependency declaration, the list of targets can be empty.
|
|
|
|
# It doesn't matter whether the empty string is generated by a variable
|
|
|
|
# expression or whether it is just omitted.
|
|
|
|
.MAKEFLAGS: -dp
|
|
|
|
${:U}: empty-source
|
|
|
|
: command for empty targets list
|
|
|
|
: empty-source
|
|
|
|
: command for empty targets list
|
|
|
|
.MAKEFLAGS: -d0
|
|
|
|
|
2020-12-27 21:20:26 +03:00
|
|
|
# Just to show that a malformed expression is only expanded once in
|
|
|
|
# ParseDependencyTargetWord. The only way to produce an expression that
|
|
|
|
# is well-formed on the first expansion and ill-formed on the second
|
|
|
|
# expansion would be to use the variable modifier '::=' to modify the
|
|
|
|
# targets. This in turn would be such an extreme and unreliable edge case
|
|
|
|
# that nobody uses it.
|
|
|
|
$$$$$$$${:U:Z}:
|
|
|
|
|
2020-08-16 15:07:50 +03:00
|
|
|
all:
|
|
|
|
@:;
|