This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: struggling with make inside GCC MELT


Basile Starynkevitch <basile@starynkevitch.net> writes:

> I am fighting against makefile issues on the GCC MELT branch.
>
> Much more details are given in 
>    http://stackoverflow.com/q/8727896/841108
> and in 
>    http://lists.gnu.org/archive/html/help-make/2012-01/msg00017.html
>
> So (unless you ask) I won't repeat them here.
>    
> (and the bugs affect mostly me, not the usual MELT user)
>
> The symptoms are:
>
>    1. make -j don't work
>
>    2. "make ; make" is running a lot of useless commands for the
> second make and it should not 
>
>
> I probably am not understanding when stampfiles in Makefiles should be
> used. The main point is that MELT cares much more about file contents
> than file timestamps.

Your stackoverflow question has way too much detail for me to
understand.  I think you need to debug this like any other issue: reduce
to the minimal test case.

Stamp files in make work like this:

FILE: STAMP-FILE; @true
STAMP-FILE: DEPENDENCIES
	commands to create FILE.tmp
	move-if-change FILE.tmp FILE
        touch $@

What this says is: if any of DEPENDENCIES change, then run the commands
to create FILE.tmp.  The move-if-change shell script then compares
FILE.tmp and FILE; if they are different, it moves FILE.tmp to FILE,
updating the timestamp.  If they are not different, FILE is left
unchanged, with the same timestamp.

The effect is that anything which depends on FILE is only rebuilt if the
contents of FILE changes.

Note that everything I show above is required.  A naive approach would
omit the "; @true" but it is necessary.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]