bug-make
[Top][All Lists]
Advanced

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

--no-builtin-variables then assign to a builtin variable


From: John Reiser
Subject: --no-builtin-variables then assign to a builtin variable
Date: Sat, 25 Jul 2015 08:55:22 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0

In GNU Make 4.0 when I ask for --no-builtin-variables but later assign
to a builtin-variable, then subsequent expansions of that variable produce
a null string instead of what I assigned.  This is different from the behavior
of GNU Make 3.82, where the expansion produces the value that I assigned.
It seems to me that the explicit assignment should be honored
because it occurs after the request for --no-builtin-variables.
The workaround in GNU Make 4.0 is to use a different name
because it looks like --no-builtin-variables permanently disables
those names.  If the behavior of GNU Make 4.0 is intended
then it would be nice to complain for any attempted assignment
that always will be ignored.

-----example makefile foo.mk
# -R: --no-builtin-variables. [Also implies -r: --no-builtin-rules.]
MAKEFLAGS += -R

# Attempt to assign to a built-in variable
ifeq ($(CC),)
CC = gcc
endif

foo: foo.o
        $(CC) -o $@ $<

%.o : %.c
        $(CC) -o $@ -c $<
----- end foo.mk

$ rm -f foo foo.o
$ touch foo.c
$ make -n -f foo.mk
o foo.o -c foo.c
o foo foo.o
$  ### Notice no "gcc" in expansion of "$(CC)" in previous 2 lines
$ make --version
GNU Make 4.0
Built for x86_64-redhat-linux-gnu
Copyright (C) 1988-2013 Free Software Foundation, Inc.
   [[snip]]

--



reply via email to

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