NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

make variable modifier :?

I don't understand how to use the :? modifier in a make variable. 
Examples are hard to come by and the manual is cryptic.  It says:

   If the variable (actually an expression; see below) 
   evaluates to true....

What means "true" here?  It doesn't refer to empty/defined/undefined,

Here's my Makefile and its output.  Note how `:?' always evaluates its
argument as true if the variable is defined:

$ cat -n Makefile && make -n
     1  FILES = foo bar
     2  EMPTY =
     4  all:
     5          FILES = '$(FILES)'
     6          FILES is $(FILES:?full:empty)
     7          FILES:Mfoo is '$(FILES:Mfoo)'
     8          FILES $(FILES:Mfoo:?includes:excludes) foo
     9          FILES $(FILES:Mzzz:?includes:excludes) zzz
    10  #
    11          EMPTY = '$(EMPTY)'
    12          EMPTY is $(EMPTY:?full:empty)
    13          EMPTY:Mfoo is '$(EMPTY:Mfoo)'
    14          EMPTY $(EMPTY:Mfoo:?includes:excludes) foo
    15          EMPTY $(EMPTY:Mzzz:?includes:excludes) zzz
    16  #
    17          NODEF = '$(NODEF)'
    18          NODEF is $(NODEF:?full:empty)
    19          NODEF:Mfoo is '$(NODEF:Mfoo)'
    20          NODEF $(NODEF:Mfoo:?includes:excludes) foo
    21          NODEF $(NODEF:Mzzz:?includes:excludes) zzz
FILES = 'foo bar'
FILES is full
FILES:Mfoo is 'foo'
FILES includes foo
FILES includes zzz
EMPTY = ''
EMPTY is full
EMPTY:Mfoo is ''
EMPTY includes foo
EMPTY includes zzz
NODEF = ''
NODEF is empty
NODEF:Mfoo is ''
NODEF excludes foo
NODEF excludes zzz

My objective is to make line 9 DTRT.  

Many thanks.  


Home | Main Index | Thread Index | Old Index