mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
cdde9e894d
Features of interest: Allow setting target local variables (similar to gmake) In META_MODE .MAKE.META.CMP_FILTER can be used for filtering commands before comparion. contrib/bmake/mk/cc-wrap.mk is an example of using these See ChangeLog for the gory details.
29 lines
733 B
Makefile
29 lines
733 B
Makefile
# $NetBSD: opt-define.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $
|
|
#
|
|
# Tests for the -D command line option, which defines global variables to the
|
|
# value 1, like in the C preprocessor.
|
|
|
|
.MAKEFLAGS: -DVAR
|
|
|
|
# The variable has the exact value "1", not "1.0".
|
|
.if ${VAR} != "1"
|
|
. error
|
|
.endif
|
|
|
|
# The variable can be overwritten by assigning another value to it. This
|
|
# would not be possible if the variable had been specified on the command line
|
|
# as 'VAR=1' instead of '-DVAR'.
|
|
VAR= overwritten
|
|
.if ${VAR} != "overwritten"
|
|
. error
|
|
.endif
|
|
|
|
# The variable can be undefined. If the variable had been defined in the
|
|
# "Internal" scope instead, undefining it would have no effect.
|
|
.undef VAR
|
|
.if defined(VAR)
|
|
. error
|
|
.endif
|
|
|
|
all: .PHONY
|