06b9b3e0ad
Quite a lot of churn on style, but lots of good work refactoring complicated functions and lots more unit-tests. Thanks mostly to rillig at NetBSD Some interesting entries from ChangeLog o .MAKE.{UID,GID} represent uid and gid running make. o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable checks in InitObjdir. Explicit .OBJDIR target always allows read-only directory. o add more unit tests for META MODE Merge commit '8e11a9b4250be3c3379c45fa820bff78d99d5946' into main Change-Id: I464fd4c013067f0915671c1ccc96d2d8090b2b9c
50 lines
1.6 KiB
Makefile
50 lines
1.6 KiB
Makefile
# $NetBSD: deptgt.mk,v 1.10 2020/12/27 18:20:26 rillig Exp $
|
|
#
|
|
# Tests for special targets like .BEGIN or .SUFFIXES in dependency
|
|
# declarations.
|
|
|
|
# TODO: Implementation
|
|
|
|
# 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
|
|
|
|
# The following lines demonstrate how 'targets' is set and reset during
|
|
# parsing of dependencies. To see it in action, set breakpoints in:
|
|
#
|
|
# ParseDoDependency at the beginning
|
|
# FinishDependencyGroup at "targets = NULL"
|
|
# Parse_File at "Lst_Free(targets)"
|
|
# Parse_File at "targets = Lst_New()"
|
|
# ParseLine_ShellCommand at "targets == NULL"
|
|
#
|
|
# 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
|
|
|
|
# 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
|
|
|
|
# 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}:
|
|
|
|
all:
|
|
@:;
|