1 1.11 rillig # $NetBSD: deptgt.mk,v 1.11 2021/04/04 10:13:09 rillig Exp $ 2 1.1 rillig # 3 1.2 rillig # Tests for special targets like .BEGIN or .SUFFIXES in dependency 4 1.2 rillig # declarations. 5 1.1 rillig 6 1.1 rillig # TODO: Implementation 7 1.1 rillig 8 1.3 rillig # Just in case anyone tries to compile several special targets in a single 9 1.3 rillig # dependency line: That doesn't work, and make immediately rejects it. 10 1.3 rillig .SUFFIXES .PHONY: .c.o 11 1.3 rillig 12 1.5 rillig # The following lines demonstrate how 'targets' is set and reset during 13 1.4 rillig # parsing of dependencies. To see it in action, set breakpoints in: 14 1.4 rillig # 15 1.11 rillig # ParseDependency at the beginning 16 1.6 rillig # FinishDependencyGroup at "targets = NULL" 17 1.4 rillig # Parse_File at "Lst_Free(targets)" 18 1.8 rillig # Parse_File at "targets = Lst_New()" 19 1.7 rillig # ParseLine_ShellCommand at "targets == NULL" 20 1.4 rillig # 21 1.5 rillig # Keywords: 22 1.5 rillig # parse.c:targets 23 1.5 rillig 24 1.5 rillig target1 target2: sources # targets := [target1, target2] 25 1.5 rillig : command1 # targets == [target1, target2] 26 1.5 rillig : command2 # targets == [target1, target2] 27 1.5 rillig VAR=value # targets := NULL 28 1.5 rillig : command3 # parse error, since targets == NULL 29 1.4 rillig 30 1.9 rillig # In a dependency declaration, the list of targets can be empty. 31 1.9 rillig # It doesn't matter whether the empty string is generated by a variable 32 1.9 rillig # expression or whether it is just omitted. 33 1.9 rillig .MAKEFLAGS: -dp 34 1.9 rillig ${:U}: empty-source 35 1.9 rillig : command for empty targets list 36 1.9 rillig : empty-source 37 1.9 rillig : command for empty targets list 38 1.9 rillig .MAKEFLAGS: -d0 39 1.9 rillig 40 1.10 rillig # Just to show that a malformed expression is only expanded once in 41 1.10 rillig # ParseDependencyTargetWord. The only way to produce an expression that 42 1.10 rillig # is well-formed on the first expansion and ill-formed on the second 43 1.10 rillig # expansion would be to use the variable modifier '::=' to modify the 44 1.10 rillig # targets. This in turn would be such an extreme and unreliable edge case 45 1.10 rillig # that nobody uses it. 46 1.10 rillig $$$$$$$${:U:Z}: 47 1.10 rillig 48 1.1 rillig all: 49 1.1 rillig @:; 50