help-make
[Top][All Lists]
Advanced

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

how exactly the makefiles are remade ?


From: Cristian Zoicas
Subject: how exactly the makefiles are remade ?
Date: Fri, 19 Dec 2003 09:59:37 +0100 (MET)


Hello all

I do not understand how exactly the makefiles are remade. A discussion
on this mailing list revealed me the fact that when a makefile must be
remade  it starts again  from scratch,  nothing being  initialized and
this new process does not know that it is restarted because a makefile
was remade.

This is ok for me, but it seems that GNU Make 3.79.1 does not behave
like that.

I provide here an example :

.PHONY: gen.XXXX main

OBJECTS :=

include xxxx

main:
        @echo "main target"
        @echo "objects:" $(OBJECTS)

xxxx: gen.XXXX

gen.XXXX:
        @echo generating xxxx
        @echo 'OBJECTS := a1.o b1.o b3.o' > xxxx;

So, if make starts again from scratch after it generates the file xxxx
then OBJECTS must  be initialized with a value  and the echo statement
in the rule "main" must print what OBJECTS contains.

When you execute make for the first  time you can see that in the rule
"main" OBJECTS  contains nothing  even if the  file xxxx  was included
before and there the OBJECTS variable take a value.

Is  this  a  correct behaviour  ?  Can  somebody  explain me  what  is
happening and  how can I  handle this kind  of problem, i mean  when a
variable takes a value in an included file which is regenerated ?

Thank you in advance
Cristian Zoicas













reply via email to

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