xref: /freebsd/contrib/bmake/unit-tests/directive-ifndef.mk (revision d485c77f203fb0f4cdc08dea5ff81631b51d8809)
1# $NetBSD: directive-ifndef.mk,v 1.6 2020/10/24 08:46:08 rillig Exp $
2#
3# Tests for the .ifndef directive, which can be used for multiple-inclusion
4# guards.  In contrast to C, where #ifndef and #define nicely line up the
5# macro name, there is no such syntax in make.  Therefore, it is more
6# common to use .if !defined(GUARD) instead.
7
8.ifndef GUARD
9GUARD=	# defined
10.  info guarded section
11.endif
12
13.ifndef GUARD
14GUARD=	# defined
15.  info guarded section
16.endif
17
18.if !defined(GUARD)
19GUARD=	# defined
20.  info guarded section
21.endif
22
23all:
24	@:;
25