Am 29.01.2015 10:06, schrieb Anton Lundin: > 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. >
Why does it have to be a Make target at all? In the 'old' Makefile used to build the gtk version, the logic to compare versions was triggered by a variable assignment. if the version changed in the meantime, the version file got changed and make picked up that change. /martin _______________________________________________ subsurface mailing list subsurface@subsurface-divelog.org http://lists.subsurface-divelog.org/cgi-bin/mailman/listinfo/subsurface