bug-make
[Top][All Lists]
Advanced

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

variables with trailing whitespace


From: David Holland
Subject: variables with trailing whitespace
Date: Fri, 25 Mar 2005 16:32:43 -0500 (EST)

The following makefile both generates and references a variable with
trailing whitespace in its name, which according to the documentation
isn't allowed.

With gmake 3.80, the first echo prints foo.o, and the second prints
bar.o.

It seems to me that the trailing space in $(CONFIG_BAR) ought to be
stripped in the process of performing the assignment, so that OBJS-y
should end up containing both foo.o and bar.o. This is, after all,
what would happen if one substituted the text by hand prior to running
make, and so it's consistent with the principle of least surprise. (It
is also consistent with BSD make. SVR4 make doesn't do anything useful
at all, even with the += changed to =.)

I don't have any particular opinion about what $(OBJS-y ) should
retrieve, although one could argue that because trailing whitespace is
not legal in variable names it should retrieve the same text as
$(OBJS-y). One could also argue that because trailing whitespace is
not legal in variable names it should be a syntax error, or always
retrieve the empty string, or whatever.

Cheers. :-)

   ------

CONFIG_FOO=y
CONFIG_BAR=y #comment

OBJS-$(CONFIG_FOO) += foo.o
OBJS-$(CONFIG_BAR) += bar.o

test:
        echo $(OBJS-y)
        echo $(OBJS-y )

-- 
   - David A. Holland / address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]