xref: /freebsd/contrib/bmake/unit-tests/cond-func-make.mk (revision 6a7405f5a6b639682cacf01e35d561411ff556aa)
1*6a7405f5SSimon J. Gerraty# $NetBSD: cond-func-make.mk,v 1.6 2025/01/10 23:00:38 rillig Exp $
22c3632d1SSimon J. Gerraty#
3956e45f6SSimon J. Gerraty# Tests for the make() function in .if conditions, which tests whether
4956e45f6SSimon J. Gerraty# the argument has been passed as a target via the command line or later
5956e45f6SSimon J. Gerraty# via the .MAKEFLAGS special dependency target.
62c3632d1SSimon J. Gerraty
7956e45f6SSimon J. Gerraty.if !make(via-cmdline)
8956e45f6SSimon J. Gerraty.  error
9956e45f6SSimon J. Gerraty.endif
10956e45f6SSimon J. Gerraty.if make(via-dot-makeflags)
11956e45f6SSimon J. Gerraty.  error
12956e45f6SSimon J. Gerraty.endif
132c3632d1SSimon J. Gerraty
14956e45f6SSimon J. Gerraty.MAKEFLAGS: via-dot-makeflags
15956e45f6SSimon J. Gerraty
16956e45f6SSimon J. Gerraty.if !make(via-cmdline)
17956e45f6SSimon J. Gerraty.  error
18956e45f6SSimon J. Gerraty.endif
19956e45f6SSimon J. Gerraty.if !make(via-dot-makeflags)
20956e45f6SSimon J. Gerraty.  error
21956e45f6SSimon J. Gerraty.endif
22956e45f6SSimon J. Gerraty
23148ee845SSimon J. Gerraty# expect+1: warning: Unfinished character list in pattern argument '[' to function 'make'
24148ee845SSimon J. Gerraty.if make([)
25148ee845SSimon J. Gerraty.  error
26148ee845SSimon J. Gerraty.endif
27148ee845SSimon J. Gerraty
28*6a7405f5SSimon J. Gerraty# Expressions in the argument of a function call don't have to be defined.
29*6a7405f5SSimon J. Gerraty.if make(${UNDEF})
30*6a7405f5SSimon J. Gerraty.  error
31*6a7405f5SSimon J. Gerraty.endif
32*6a7405f5SSimon J. Gerraty
33956e45f6SSimon J. Gerratyvia-cmdline via-dot-makeflags:
34956e45f6SSimon J. Gerraty	: $@
35