Work around sed and make interactions on the backslash at the end of line.
Traditionally 'i' and 'a' commands to sed have been unfriendly with make, primarily because different make implementations did unexpected things to backslashes at the end of lines. So work it around by not using 'i' command. Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jul 7, 2006 at 13:04 UTC
998c4daaf4a921fb03d478b50d6e06223326d7ef
1 file changed
+7
-3
Makefile
+7
-3
@@ -550,9 +550,13 @@ $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/Makefile
550
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
551
rm -f $@ $@+
552
INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
553
- sed -e '1s|#!.*perl|#!$(PERL_PATH_SQ)|1' \
554
- -e '2i\
555
- use lib (split(/:/, $$ENV{GITPERLLIB} || '\'"$$INSTLIBDIR"\''));' \
553
+ sed -e '1{' \
554
+ -e ' s|#!.*perl|#!$(PERL_PATH_SQ)|' \
555
+ -e ' h' \
556
+ -e ' s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
557
+ -e ' H' \
558
+ -e ' x' \
559
+ -e '}' \
560
-e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
561
-e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
562
$@.perl >$@+