2022-02-05 20:03:50 +00:00
|
|
|
# $NetBSD: directive.mk,v 1.6 2022/01/23 16:09:38 rillig Exp $
|
2020-09-05 16:11:04 +00:00
|
|
|
#
|
|
|
|
# Tests for the preprocessing directives, such as .if or .info.
|
|
|
|
|
|
|
|
# TODO: Implementation
|
|
|
|
|
2020-11-20 03:54:37 +00:00
|
|
|
# Unknown directives are correctly named in the error messages,
|
|
|
|
# even if they are indented.
|
2022-02-05 20:03:50 +00:00
|
|
|
# expect+1: Unknown directive "indented"
|
2020-11-20 03:54:37 +00:00
|
|
|
.indented none
|
2022-02-05 20:03:50 +00:00
|
|
|
# expect+1: Unknown directive "indented"
|
2020-11-20 03:54:37 +00:00
|
|
|
. indented 2 spaces
|
2022-02-05 20:03:50 +00:00
|
|
|
# expect+1: Unknown directive "indented"
|
2020-11-20 03:54:37 +00:00
|
|
|
. indented tab
|
|
|
|
|
|
|
|
# Directives must be written directly, not indirectly via variable
|
|
|
|
# expressions.
|
2022-02-05 20:03:50 +00:00
|
|
|
# FIXME: The error message is misleading because it shows the expanded text of
|
|
|
|
# the line, while the parser works on the unexpanded line.
|
|
|
|
# expect+1: Unknown directive "info"
|
2020-11-20 03:54:37 +00:00
|
|
|
.${:Uinfo} directives cannot be indirect
|
|
|
|
|
|
|
|
# There is no directive called '.target', therefore this is parsed as a
|
|
|
|
# dependency declaration with 2 targets and 1 source.
|
|
|
|
.target target: source
|
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
# The following lines demonstrate how the parser tells an .info message apart
|
|
|
|
# from a variable assignment to ".info", which syntactically is very similar.
|
2020-11-20 03:54:37 +00:00
|
|
|
.MAKEFLAGS: -dv
|
2022-02-05 20:03:50 +00:00
|
|
|
.info:= value # This is a variable assignment.
|
2020-11-20 03:54:37 +00:00
|
|
|
.info?= value # This is a variable assignment as well.
|
2022-02-05 20:03:50 +00:00
|
|
|
# expect+1: := value
|
2020-11-20 03:54:37 +00:00
|
|
|
.info := value # The space after the '.info' makes this
|
|
|
|
# a directive.
|
|
|
|
.MAKEFLAGS: -d0
|
|
|
|
|
|
|
|
# This is a dependency since directives must be given directly.
|
|
|
|
# Not even the space after the '.info' can change anything about this.
|
|
|
|
.${:Uinfo} : source
|
|
|
|
|
2022-02-05 20:03:50 +00:00
|
|
|
# expect+1: Invalid line type
|
|
|
|
target-without-colon
|
|
|
|
|
|
|
|
# expect+1: Invalid line type
|
|
|
|
target-without-colon another-target
|