Work around sed and make interactions on the backslash at the end of line.
[gitweb.git] / Makefile
index 2f66ab114365ea3ccb3e4c28a4c3dfc9ea794636..01b9a948238daef7fe89dace4cba3fbe0be12aa9 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -341,6 +341,9 @@ endif
 ifneq (,$(findstring arm,$(uname_M)))
        ARM_SHA1 = YesPlease
 endif
+ifeq ($(uname_M),x86_64)
+       USE_PIC = YesPlease
+endif
 
 -include config.mak
 
@@ -546,8 +549,14 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
 $(patsubst %.perl,%,$(SCRIPT_PERL)): perl/Makefile
 $(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
        rm -f $@ $@+
-       INSTLIBDIR=`make -s -C perl instlibdir` && \
-       sed -e '1s|#!.*perl\(.*\)|#!$(PERL_PATH_SQ)\1|' \
+       INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
+       sed -e '1{' \
+           -e '        s|#!.*perl|#!$(PERL_PATH_SQ)|' \
+           -e '        h' \
+           -e '        s=.*=use lib (split(/:/, $$ENV{GITPERLLIB} || "@@INSTLIBDIR@@"));=' \
+           -e '        H' \
+           -e '        x' \
+           -e '}' \
            -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
            -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
            $@.perl >$@+
@@ -768,6 +777,7 @@ clean:
        rm -f $(htmldocs).tar.gz $(manpages).tar.gz
        $(MAKE) -C Documentation/ clean
        [ ! -f perl/Makefile ] || $(MAKE) -C perl/ clean || $(MAKE) -C perl/ clean
+       rm -f perl/ppport.h perl/Makefile.old
        $(MAKE) -C templates/ clean
        $(MAKE) -C t/ clean
        rm -f GIT-VERSION-FILE GIT-CFLAGS