Re: [PATCH 12/13] Makefile: teach scripts to include make variables

2014-02-09 Thread Jeff King
On Sat, Feb 08, 2014 at 10:47:16PM +0100, Thomas Rast wrote: > Jeff King writes: > > > The current scheme for getting build-time variables into a > > shell script is to munge the script with sed, and stick the > > munged variable into a special sentinel file so that "make" > > knows about the de

Re: [PATCH 12/13] Makefile: teach scripts to include make variables

2014-02-08 Thread Thomas Rast
Jeff King writes: > The current scheme for getting build-time variables into a > shell script is to munge the script with sed, and stick the > munged variable into a special sentinel file so that "make" > knows about the dependency. > > Instead, we can combine both functions by generating a shell

Re: [PATCH 12/13] Makefile: teach scripts to include make variables

2014-02-05 Thread Jeff King
On Wed, Feb 05, 2014 at 11:26:58AM -0800, Junio C Hamano wrote: > Jeff King writes: > > > define cmd_munge_script > > $(RM) $@ $@+ && \ > > +{ \ > > +includes="$(filter MAKE/%.sh,$^)"; \ > > +if ! test -z "$$includes"; then \ > > + cat $$includes; \ > > +fi && \ > > sed -e '1s|#!.*/sh|#!$(c

Re: [PATCH 12/13] Makefile: teach scripts to include make variables

2014-02-05 Thread Junio C Hamano
Jeff King writes: > define cmd_munge_script > $(RM) $@ $@+ && \ > +{ \ > +includes="$(filter MAKE/%.sh,$^)"; \ > +if ! test -z "$$includes"; then \ > + cat $$includes; \ > +fi && \ > sed -e '1s|#!.*/sh|#!$(call sqi,$(SHELL_PATH))|' \ > -e 's|@SHELL_PATH@|$(call sqi,$(SHELL_PATH))|' \

[PATCH 12/13] Makefile: teach scripts to include make variables

2014-02-05 Thread Jeff King
The current scheme for getting build-time variables into a shell script is to munge the script with sed, and stick the munged variable into a special sentinel file so that "make" knows about the dependency. Instead, we can combine both functions by generating a shell snippet with our value, and th