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


2012/1/10 Ian Lance Taylor <iant@google.com>:
> 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.

Hmm, will it work to just write as

FILE: DEPENDENCIES
        commands to create FILE.tmp
        move-if-change FILE.tmp FILE

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

Then what the role here "; @true"  play? I'm still confused by the usage.

Thanks for explanation.

Mingjie


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