Any qmake experts out there?

Thiago Macieira thiago at macieira.org
Thu Jan 29 05:38:30 PST 2015


On Thursday 29 January 2015 15:30:43 Lubomir I. Ivanov wrote:
> this is what i would do:
> -----------------
> 
> all: main.exe
> 
> .PHONY: persist
> 
> version.h: persist
>     cat $@ 2> /dev/null || git rev-parse HEAD > $@
>     git rev-parse HEAD > $@.tmp
>     git diff --quiet $@ $@.tmp || cp $@.tmp $@
>     rm -f $@.tmp
> 
> main.o: main.c version.h
>     gcc -c main.c -o main.o
> 
> main.exe: main.o
>     gcc main.o -o main.exe
> 
> -------------------
> 
> what it does is, it writes the output of "git rev-parse" to a TMP file
> and if that TMP file differs to the previous version.h file it updates
> version.h
> but since version.h may not change, main is not recompiled.

The way I read this, persist is phony, so it will always be found to be out-
of-date. Therefore, version.h is always out of date, so is main.o and 
therefore main.exe will too.

Are you saying that if the version.h command doesn't actually touch version.h, 
then Make does not find it to be out of date?

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel Open Source Technology Center
      PGP/GPG: 0x6EF45358; fingerprint:
      E067 918B B660 DBD1 105C  966C 33F5 F005 6EF4 5358



More information about the subsurface mailing list