Make perl/ build procedure ActiveState friendly.
On Cygwin + ActivateState Perl, Makefile generated with MakeMaker is not usable because of line-endings and back-slashes. This teaches perl/Makefile to write a handcrafted equivalent perl.mak file with 'make NO_PERL_MAKEMAKER=NoThanks'. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <junkio@cox.net>
Alex Riesen committed
Dec 4, 2006 at 10:50 UTC
f848718a6980ebda0eb5afb2ca49c3bc1e7b2b1d
3 files changed
+57
-7
Makefile
+16
-6
@@ -91,6 +91,10 @@ all:
91
#
92
# Define USE_STDEV below if you want git to care about the underlying device
93
# change being considered an inode change from the update-cache perspective.
94
+#
95
+# Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's
96
+# MakeMaker (e.g. using ActiveState under Cygwin).
97
+#
98
99
GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
100
@$(SHELL_PATH) ./GIT-VERSION-GEN
@@ -539,6 +543,9 @@ endif
543
ifdef NO_ACCURATE_DIFF
544
BASIC_CFLAGS += -DNO_ACCURATE_DIFF
545
endif
546
+ifdef NO_PERL_MAKEMAKER
547
+ export NO_PERL_MAKEMAKER
548
+endif
549
550
# Shell quote (do not use $(call) to accommodate ancient setups);
551
@@ -568,8 +575,8 @@ export prefix TAR INSTALL DESTDIR SHELL_PATH template_dir
575
576
all: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi
577
571
-all: perl/Makefile
572
- $(MAKE) -C perl
578
+all:
579
+ $(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all
580
$(MAKE) -C templates
581
582
strip: $(PROGRAMS) git$X
@@ -602,7 +609,11 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
609
chmod +x $@+
610
mv $@+ $@
611
605
-$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/Makefile
612
+$(patsubst %.perl,%,$(SCRIPT_PERL)): perl/perl.mak
613
+
614
+perl/perl.mak: GIT-CFLAGS
615
+ $(MAKE) -C perl PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' $(@F)
616
+
617
$(patsubst %.perl,%,$(SCRIPT_PERL)): % : %.perl
618
rm -f $@ $@+
619
INSTLIBDIR=`$(MAKE) -C perl -s --no-print-directory instlibdir` && \
@@ -796,7 +807,7 @@ install: all
807
$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
808
$(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)'
809
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
799
- $(MAKE) -C perl install
810
+ $(MAKE) -C perl prefix='$(prefix_SQ)' install
811
if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
812
then \
813
ln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \
@@ -866,8 +877,7 @@ clean:
877
rm -f $(htmldocs).tar.gz $(manpages).tar.gz
878
rm -f gitweb/gitweb.cgi
879
$(MAKE) -C Documentation/ clean
869
- [ ! -f perl/Makefile ] || $(MAKE) -C perl/ clean || $(MAKE) -C perl/ clean
870
- rm -f perl/ppport.h perl/Makefile.old
880
+ $(MAKE) -C perl clean
881
$(MAKE) -C templates/ clean
882
$(MAKE) -C t/ clean
883
rm -f GIT-VERSION-FILE GIT-CFLAGS
perl/.gitignore
+2
-1
@@ -1,4 +1,5 @@
1
-Makefile
1
+perl.mak
2
+perl.mak.old
3
blib
4
blibdirs
5
pm_to_blib
perl/Makefile
new
+39
@@ -0,0 +1,39 @@
1
+#
2
+# Makefile for perl support modules and routine
3
+#
4
+makfile:=perl.mak
5
+
6
+PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH))
7
+prefix_SQ = $(subst ','\'',$(prefix))
8
+
9
+all install instlibdir: $(makfile)
10
+ $(MAKE) -f $(makfile) $@
11
+
12
+clean:
13
+ test -f $(makfile) && $(MAKE) -f $(makfile) $@ || exit 0
14
+ $(RM) ppport.h
15
+ $(RM) $(makfile)
16
+ $(RM) $(makfile).old
17
+
18
+ifdef NO_PERL_MAKEMAKER
19
+instdir_SQ = $(subst ','\'',$(prefix)/lib)
20
+$(makfile): ../GIT-CFLAGS Makefile
21
+ echo all: > $@
22
+ echo ' :' >> $@
23
+ echo install: >> $@
24
+ echo ' mkdir -p $(instdir_SQ)' >> $@
25
+ echo ' $(RM) $(instdir_SQ)/Git.pm; cp Git.pm $(instdir_SQ)' >> $@
26
+ echo ' $(RM) $(instdir_SQ)/Error.pm; \
27
+ cp private-Error.pm $(instdir_SQ)/Error.pm' >> $@
28
+ echo instlibdir: >> $@
29
+ echo ' echo $(instdir_SQ)' >> $@
30
+else
31
+$(makfile): Makefile.PL ../GIT-CFLAGS
32
+ '$(PERL_PATH_SQ)' $< FIRST_MAKEFILE='$@' PREFIX='$(prefix_SQ)'
33
+endif
34
+
35
+# this is just added comfort for calling make directly in perl dir
36
+# (even though GIT-CFLAGS aren't used yet. If ever)
37
+../GIT-CFLAGS:
38
+ $(MAKE) -C .. GIT-CFLAGS
39
+