2023-11-20 01:32:44 +03:00
|
|
|
# $NetBSD: directive.mk,v 1.9 2023/11/19 22:32:44 rillig Exp $
|
2020-08-16 15:07:50 +03:00
|
|
|
#
|
2020-08-16 17:25:16 +03:00
|
|
|
# Tests for the preprocessing directives, such as .if or .info.
|
2020-08-16 15:07:50 +03:00
|
|
|
|
|
|
|
# TODO: Implementation
|
|
|
|
|
2020-11-03 20:17:31 +03:00
|
|
|
# Unknown directives are correctly named in the error messages,
|
|
|
|
# even if they are indented.
|
2022-01-23 19:09:38 +03:00
|
|
|
# expect+1: Unknown directive "indented"
|
2020-11-03 20:17:31 +03:00
|
|
|
.indented none
|
2022-01-23 19:09:38 +03:00
|
|
|
# expect+1: Unknown directive "indented"
|
2020-11-03 20:17:31 +03:00
|
|
|
. indented 2 spaces
|
2022-01-23 19:09:38 +03:00
|
|
|
# expect+1: Unknown directive "indented"
|
2020-11-03 20:17:31 +03:00
|
|
|
. indented tab
|
|
|
|
|
2023-11-20 01:32:44 +03:00
|
|
|
# Directives must be written directly, not indirectly via
|
2020-11-03 20:17:31 +03:00
|
|
|
# expressions.
|
2023-08-19 14:09:02 +03:00
|
|
|
# expect+1: Unknown directive ""
|
2020-11-03 20:17:31 +03:00
|
|
|
.${:Uinfo} directives cannot be indirect
|
|
|
|
|
2020-11-15 14:57:00 +03:00
|
|
|
# There is no directive called '.target', therefore this is parsed as a
|
|
|
|
# dependency declaration with 2 targets and 1 source.
|
|
|
|
.target target: source
|
|
|
|
|
2022-01-23 19:09:38 +03: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-15 14:57:00 +03:00
|
|
|
.MAKEFLAGS: -dv
|
2022-01-23 19:09:38 +03:00
|
|
|
.info:= value # This is a variable assignment.
|
2020-11-15 14:57:00 +03:00
|
|
|
.info?= value # This is a variable assignment as well.
|
2022-01-23 19:09:38 +03:00
|
|
|
# expect+1: := value
|
2020-11-15 14:57:00 +03: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
|
|
|
|
|
2023-08-19 13:52:13 +03:00
|
|
|
# expect+1: Invalid line 'target-without-colon'
|
2021-12-14 02:38:54 +03:00
|
|
|
target-without-colon
|
|
|
|
|
2023-08-19 13:52:13 +03:00
|
|
|
# expect+1: Invalid line 'target-without-colon another-target'
|
2021-12-14 02:38:54 +03:00
|
|
|
target-without-colon another-target
|