|
From: | Sebastian Glita |
Subject: | target specific variable |
Date: | Tue, 26 Mar 2002 16:20:31 +0200 |
Hi,
I have attached a tar'ed gzip'ed example.
After running `make', I asked myself: Where did the
`-ggdb' flag go ???
I append flags to object files separately like
this:
sources := main.c util.c
objects := $(sources:.c=.o)
$(objects): CFLAGS += -ggdb
main.o: CFLAGS += -DAUTHOR='"myself"'
but "+=" for target-specific variables ignores
their previously, defered for expansions, values.
I took *little* time to debug what `make' was doing, and
I came up
with the following question: Why doesn't `make' append new values to old values
(without expanding the old values) for target specific variables, and instead
discards the old value ?
My temporary humble solution is:
In the file `variable.c', in the function
struct variable *
try_variable_definition (flocp, line, origin, target_var) const struct floc *flocp; char *line; enum variable_origin origin; int target_var; I modified like this:
/* Calculate the variable's new value in VALUE. */
switch (flavor)
{
...
case f_append:
/* If we have += but we're in a target variable context, defer the append until the context expansion. ??? IT DEFERS THE REPLACE, NOT THE APPEND ?!?! */ if (target_var) { append = 1; /* I REMOVED THESE 3 LINES */ /*
flavor =
f_recursive;
value = p; break; */ }
It works well now from this point of view !
I have a `K7 Athlon' running `Red Hat Linux 7.2'
machine.
This is the output of `make --version': ---- GNU Make version 3.79.1, by Richard Stallman and Roland McGrath. Built for i686-pc-linux-gnu Copyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Report bugs to <address@hidden>. ---- Sincerely,
Sebastian Glita
student Computer Science Faculty Timisoara Romania |
bug.tgz
Description: application/compressed
[Prev in Thread] | Current Thread | [Next in Thread] |