Junio C Hamano wrote: > Jonathan Nieder <jrnieder@xxxxxxxxx> writes: >> Junio C Hamano wrote: >>> +git_check = $(shell git ls-files >/dev/null 2>&1; echo $$?) [...] >> Neat. I'd prefer something like [...] >> that avoid punishing people who were using the makefile for some >> purpose unrelated to tags and cscope, though. ;) > > Hmm, how would this punish anybody exactly (I just took the structure > from the way how the auto-depend is done)? As Matthieu mentioned, the code in $(shell ...) gets run once each time the makefile is loaded, adding to the runtime and possible failure modes of make clean that does not care about the result. The dep_check test has that same problem, and I was a little nervous about that when we added it. But: i. it seemed to be worth the convenience ii. computing whether the compiler supports -MMD once each time $(CC) is launched would slow enough not to be an option iii. in the end, most uses of the makefile are to compile something, anyway, so it is not _that_ much of a waste. iv. if someone finds the per-make-invocation to be too high, we could introduce a DONT_COMPUTE_HEADER_DEPENDENCIES variable that causes the check to be skipped by forcing that particular result. Great. In this new tags/cscope example, one could make an argument that running exactly once is similarly better than running as needed (as in (ii) above), by pointing out that make tags TAGS cscope would have to check for a working "git ls-files" once instead of three times. But I don't buy it. :) > Besides, you would need to have the whole thing in a subshell or > something, as this is used as the upstream to "| xargs". Good catch, thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html