On Wed, Oct 26 2022, Junio C Hamano wrote: > Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx> writes: > >> Are you asking if "define"'s execute in some context outside the purview >> of rules, so that if you $(call) one from within a rule and it errors, >> that we won't clean up the file? > > Not at all. > > I was wondering why the defined sequance does not end in > > ... > <$> >$@+ && \ > chmod +x $@+ && \ > mv $@+ $@ > > like many other command sequences in the Makefile. As I said, I did > remember we had discussed delete-on-error; I just didn't recall if > we do depend on it already. Ah! For the purposes of this patch the actual answer to that is that it's just moving existing code around. So this happens to be the pattern we should prefer with .DELETE_ON_ERROR before & after 3/3. But if it was doing that "$@+ $@" mv dance I'd have just blindly retained that too, to avoid "while at it" and all that... The code I touched in 1/3 uses the "mv $@+ $@" for no good post-.DELETE_ON_ERROR reason, but I just left that in place as-is... >> I can drop them, FWIW I've found it quite handy to add these to ad-hoc >> debug templates. E.g. you can run: >> >> $ make -f /dev/null -E '$(eval $(file <Makefile))' -E '$(error $(call bin_wrappers_template,a,b,c,d))' >> make: *** >> ## bin_wrappers_template >> # 1 = a >> # 2 = b >> # 3 = c >> # 4 = d > > OK. That use pattern was what I was missing. >> ... >> So you see what the parameters expand to. Maybe just changing the >> heading to: >> >> ## bin_wrappers_template: $(1..N) below for manual "$(error $(call ..." deubgging > > Yeah, it would be totally useless without such an instruction. Will update it with that.