Any qmake experts out there?

Anton Lundin glance at acc.umu.se
Thu Jan 29 01:06:15 PST 2015


On 29 January, 2015 - Thiago Macieira wrote:

> On Wednesday 28 January 2015 11:04:21 Linus Torvalds wrote:
> > The proper way to get the git version is to just do
> > 
> >      # get raw SHA1
> >      git rev-parse HEAD
> > 
> >      # get "description" of it
> >      git describe --tags --abbrev=12
> > 
> > but actually accessing the .git/HEAD file directly is very wrong. But
> > I have no idea how to do git commands in the *.pri file, and handling
> > failure gracefully (in case it's not a git repository etc).
> 
> You're right, but this implies always running the rule. That implies Make must 
> find that a given file is not up to date, otherwise it won't run the rule. In 
> turn, it means the not-up-to--date status cascades down to the binary and Make 
> will recompile and relink, even if nothing changed.
> 
> I don't know of a way to ask Make to always run some commands and inspect file 
> contents before deciding what is up to date and what isn't. The closest I can 
> think of is to touch or not touch another file, but in a parallel build Make 
> may have already inspected that file and decided it was up-to-date.
> 
> Do you know of any tricks I'm missing?

I've successfully managed to fool make into doing the right thing by
conditionally declaring a target as .PHONY, but i guess that trick could
be used on a dependency.


.PHONY: $(shell for f in $(DATA) $(GEN) ; do \
        if [ -e $$f ] && [ $$(( $$(date +%s) - $$(date -r $$f +%s))) -gt $$(($(MAX_AGE)*60)) ] ; then \
			echo $$f ; \
		fi \
	done)


Such a trick might be plausible to use to conditionally declaring that
dependency or not.


//Anton


-- 
Anton Lundin	+46702-161604


More information about the subsurface mailing list