diff options
Diffstat (limited to 'unit-tests/directive-ifndef.mk')
-rw-r--r-- | unit-tests/directive-ifndef.mk | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/unit-tests/directive-ifndef.mk b/unit-tests/directive-ifndef.mk index 0981f817fcfd..bf509ef8075e 100644 --- a/unit-tests/directive-ifndef.mk +++ b/unit-tests/directive-ifndef.mk @@ -1,8 +1,24 @@ -# $NetBSD: directive-ifndef.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ +# $NetBSD: directive-ifndef.mk,v 1.6 2020/10/24 08:46:08 rillig Exp $ # -# Tests for the .ifndef directive. +# Tests for the .ifndef directive, which can be used for multiple-inclusion +# guards. In contrast to C, where #ifndef and #define nicely line up the +# macro name, there is no such syntax in make. Therefore, it is more +# common to use .if !defined(GUARD) instead. -# TODO: Implementation +.ifndef GUARD +GUARD= # defined +. info guarded section +.endif + +.ifndef GUARD +GUARD= # defined +. info guarded section +.endif + +.if !defined(GUARD) +GUARD= # defined +. info guarded section +.endif all: @:; |