Home | History | Annotate | Line # | Download | only in unit-tests
directive-ifndef.mk revision 1.7
      1 # $NetBSD: directive-ifndef.mk,v 1.7 2023/06/01 20:56:35 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
      9 GUARD=	# defined
     10 # expect+1: guarded section
     11 .  info guarded section
     12 .endif
     13 
     14 .ifndef GUARD
     15 GUARD=	# defined
     16 .  info guarded section
     17 .endif
     18 
     19 .if !defined(GUARD)
     20 GUARD=	# defined
     21 .  info guarded section
     22 .endif
     23 
     24 all:
     25 	@:;
     26