directive.mk revision 1.10
11.10Srillig# $NetBSD: directive.mk,v 1.10 2025/06/28 22:39:28 rillig Exp $ 21.1Srillig# 31.2Srillig# Tests for the preprocessing directives, such as .if or .info. 41.1Srillig 51.1Srillig# TODO: Implementation 61.1Srillig 71.3Srillig# Unknown directives are correctly named in the error messages, 81.3Srillig# even if they are indented. 91.6Srillig# expect+1: Unknown directive "indented" 101.3Srillig.indented none 111.6Srillig# expect+1: Unknown directive "indented" 121.3Srillig. indented 2 spaces 131.6Srillig# expect+1: Unknown directive "indented" 141.3Srillig. indented tab 151.3Srillig 161.9Srillig# Directives must be written directly, not indirectly via 171.3Srillig# expressions. 181.8Srillig# expect+1: Unknown directive "" 191.3Srillig.${:Uinfo} directives cannot be indirect 201.3Srillig 211.4Srillig# There is no directive called '.target', therefore this is parsed as a 221.4Srillig# dependency declaration with 2 targets and 1 source. 231.4Srillig.target target: source 241.4Srillig 251.6Srillig# The following lines demonstrate how the parser tells an .info message apart 261.6Srillig# from a variable assignment to ".info", which syntactically is very similar. 271.4Srillig.MAKEFLAGS: -dv 281.6Srillig.info:= value # This is a variable assignment. 291.4Srillig.info?= value # This is a variable assignment as well. 301.6Srillig# expect+1: := value 311.4Srillig.info := value # The space after the '.info' makes this 321.4Srillig # a directive. 331.4Srillig.MAKEFLAGS: -d0 341.4Srillig 351.4Srillig# This is a dependency since directives must be given directly. 361.4Srillig# Not even the space after the '.info' can change anything about this. 371.4Srillig.${:Uinfo} : source 381.4Srillig 391.10Srillig# expect+1: Invalid line "target-without-colon" 401.5Srilligtarget-without-colon 411.5Srillig 421.10Srillig# expect+1: Invalid line "target-without-colon another-target" 431.5Srilligtarget-without-colon another-target 44