mirror of
https://github.com/freebsd/freebsd-src
synced 2024-07-21 10:19:04 +00:00
![Simon J. Gerraty](/assets/img/avatar_default.png)
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.
52 lines
1.1 KiB
Makefile
52 lines
1.1 KiB
Makefile
# $NetBSD: directive-ifdef.mk,v 1.5 2022/01/23 21:48:59 rillig Exp $
|
|
#
|
|
# Tests for the .ifdef directive, which evaluates bare words by calling
|
|
# 'defined(word)'.
|
|
|
|
DEFINED= defined
|
|
|
|
# There is no variable named 'UNDEF', therefore the condition evaluates to
|
|
# false.
|
|
.ifdef UNDEF
|
|
. error
|
|
.endif
|
|
|
|
# There is a variable named 'DEFINED', so the condition evaluates to true.
|
|
.ifdef DEFINED
|
|
.else
|
|
. error
|
|
.endif
|
|
|
|
# Since a bare word is an abbreviation for 'defined(word)', these can be
|
|
# used to construct complex conditions.
|
|
.ifdef UNDEF && DEFINED
|
|
. error
|
|
.endif
|
|
.ifdef UNDEF || DEFINED
|
|
.else
|
|
. error
|
|
.endif
|
|
|
|
# It looks redundant to have a call to defined() in an .ifdef, but it's
|
|
# possible. The '.ifdef' only affects bare words, not function calls.
|
|
.ifdef defined(DEFINED)
|
|
.else
|
|
. error
|
|
.endif
|
|
|
|
# String literals are handled the same in all variants of the '.if' directive,
|
|
# they evaluate to true if they are not empty, therefore this particular
|
|
# example looks confusing and is thus not found in practice.
|
|
.ifdef ""
|
|
. error
|
|
.else
|
|
.endif
|
|
|
|
# Whitespace counts as non-empty as well.
|
|
.ifdef " "
|
|
.else
|
|
. error
|
|
.endif
|
|
|
|
all: .PHONY
|