Use $GITPERLLIB instead of $RUNNING_GIT_TESTS and centralize @INC munging
[gitweb.git] / Makefile
index 3c25fb38bfcffb484938ece36c0924a42e3e1698..71657ec90466766ed1035eea2e49b2ca05fd86dd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -549,8 +549,10 @@ $(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 '1s|#!.*perl|#!$(PERL_PATH_SQ)|1' \
+           -e '2i\
+               use lib (split(/:/, $$ENV{GITPERLLIB} || '\'"$$INSTLIBDIR"\''));' \
            -e 's|@@INSTLIBDIR@@|'"$$INSTLIBDIR"'|g' \
            -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
            $@.perl >$@+
@@ -771,6 +773,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