1 | # -*-Mode: Makefile;-*- |
---|
2 | # |
---|
3 | # To rebuild PERL2ARB from $ARBHOME call |
---|
4 | # make perl_clean perl |
---|
5 | |
---|
6 | ARB_MAINMAKEFILE=../Makefile |
---|
7 | THIS=Makefile.main |
---|
8 | |
---|
9 | # howto call Makefile.main (this file) |
---|
10 | MAKETHIS=$(MAKE) -f $(THIS) |
---|
11 | |
---|
12 | # howto call generated Makefile |
---|
13 | PMAKE=$(MAKE) "CC=$(A_CXX)" |
---|
14 | |
---|
15 | LIB=$(ARBHOME)/lib |
---|
16 | ARBDB=$(ARBHOME)/ARBDB |
---|
17 | |
---|
18 | # code in -> ../PERLTOOLS/arb_proto_2_xsub.cxx |
---|
19 | ARB_PROTO_2_XSUB=$(ARBHOME)/bin/arb_proto_2_xsub |
---|
20 | |
---|
21 | HEADERS = \ |
---|
22 | $(ARBDB)/ad_prot.h \ |
---|
23 | $(ARBDB)/ad_t_prot.h \ |
---|
24 | |
---|
25 | ifeq ($(DARWIN),1) |
---|
26 | SO:=bundle |
---|
27 | else |
---|
28 | SO:=so |
---|
29 | endif |
---|
30 | |
---|
31 | ARB_SO=blib/arch/auto/ARB/ARB.$(SO) |
---|
32 | |
---|
33 | TARGET_PM=$(LIB)/ARB.pm |
---|
34 | TARGET_SO=$(LIB)/ARB.$(SO) |
---|
35 | |
---|
36 | TARGETS=$(TARGET_PM) $(TARGET_SO) |
---|
37 | |
---|
38 | XS_DEPENDS = Makefile Makefile.main ARB.xs debug.h Makefile.PL |
---|
39 | |
---|
40 | # ------------------------------------------------------------ |
---|
41 | # variables for Makefile |
---|
42 | |
---|
43 | MYEXTLIB := |
---|
44 | PASTHRU_INC := |
---|
45 | PASTHRU_DEFINE := |
---|
46 | |
---|
47 | export MYEXTLIB PASTHRU_INC PASTHRU_DEFINE dflags |
---|
48 | export CC CXX A_CC A_CXX |
---|
49 | |
---|
50 | # ------------------------------------------------------------ |
---|
51 | |
---|
52 | ifeq ($(AUTODEPENDS),1) |
---|
53 | all: |
---|
54 | +test -f .depends || $(MAKETHIS) "AUTODEPENDS=0" .depends |
---|
55 | +$(MAKETHIS) "AUTODEPENDS=2" all |
---|
56 | else |
---|
57 | all: realall |
---|
58 | endif |
---|
59 | |
---|
60 | realall: perlmain.c $(TARGETS) |
---|
61 | |
---|
62 | perlmain.c: perlmain_source.c |
---|
63 | cp $< $@ |
---|
64 | |
---|
65 | $(TARGET_PM) : ARB.pm |
---|
66 | cp $< $@ |
---|
67 | |
---|
68 | $(TARGET_SO) : $(ARB_SO) |
---|
69 | cp $< $@ |
---|
70 | |
---|
71 | $(ARB_SO) : $(XS_DEPENDS) depends.stamp |
---|
72 | rm $(ARB_SO) || true |
---|
73 | @echo "Used perl version: `perl -v | grep 'This is perl'`" |
---|
74 | @echo "-------- calling MakeMaker-Makefile" |
---|
75 | ( $(PMAKE) $@ || (echo "------ failed[1].. retry once"; $(PMAKE) $@)) |
---|
76 | @echo "-------- post-recreating .depends" |
---|
77 | +$(MAKETHIS) "DEPENDS=0" .depends |
---|
78 | +$(MAKETHIS) $@ # recurse |
---|
79 | |
---|
80 | ARB.c : $(XS_DEPENDS) |
---|
81 | @echo "-------- calling MakeMaker-Makefile (to get depends)" |
---|
82 | ( $(PMAKE) $@ || (echo "------ failed[2].. retry once"; $(PMAKE) $@)) |
---|
83 | @echo "-------- end of MakeMaker-Makefile" |
---|
84 | |
---|
85 | # buildMakefile |
---|
86 | |
---|
87 | # ------------------------------------------------------------ |
---|
88 | # hack to compile with gcc 4.7.x and perl 5.10.1 |
---|
89 | # (see http://bugs.arb-home.de/changeset/10566 for why) |
---|
90 | |
---|
91 | PERL_GCC_INCOMPAT:= \ |
---|
92 | v5.10.1___4.7.1 \ |
---|
93 | v5.10.1___4.7.2 \ |
---|
94 | v5.10.1___4.7.3 \ |
---|
95 | v5.10.1___4.7.4 \ |
---|
96 | |
---|
97 | PERL_GCC:=$(shell perl -e 'print "$$^V\n";')___$(COMPILER_VERSION) |
---|
98 | WONT_COMPILE_CXX11:=$(findstring $(PERL_GCC),$(PERL_GCC_INCOMPAT)) |
---|
99 | |
---|
100 | ifneq ('$(WONT_COMPILE_CXX11)','') |
---|
101 | hacked_cflags:=$(subst -std=gnu++11,,$(cflags4perl)) |
---|
102 | else |
---|
103 | hacked_cflags:=$(cflags4perl) |
---|
104 | endif |
---|
105 | ifeq ($(USE_CLANG),1) |
---|
106 | hacked_cflags:=$(hacked_cflags) -Wno-duplicate-decl-specifier |
---|
107 | endif |
---|
108 | |
---|
109 | # disable several warnings for perl interface build |
---|
110 | # (would need changes in perl-core-api) |
---|
111 | |
---|
112 | disabled_warnings:= \ |
---|
113 | -Wno-zero-as-null-pointer-constant \ |
---|
114 | -Wno-literal-suffix \ |
---|
115 | -Wno-unused-parameter \ |
---|
116 | |
---|
117 | used_cflags:=$(subst -Weffc++,,$(hacked_cflags)) $(disabled_warnings) $(CXX_INCLUDES) |
---|
118 | used_lflags:=$(lflags4perl) |
---|
119 | |
---|
120 | MAKE_MAKEFILE=make_arbperl_makefile.pl |
---|
121 | |
---|
122 | Makefile : $(MAKE_MAKEFILE) typemap Makefile.main $(ARB_MAINMAKEFILE) |
---|
123 | ( PATH=/usr/arb/bin:${PATH}; \ |
---|
124 | export PATH; \ |
---|
125 | echo calling perl $(MAKE_MAKEFILE) "$(used_cflags)" "$(used_lflags)"; \ |
---|
126 | perl $(MAKE_MAKEFILE) "$(used_cflags)" "$(used_lflags)" ) |
---|
127 | |
---|
128 | Makefile.PL : $(MAKE_MAKEFILE) |
---|
129 | ( \ |
---|
130 | echo "system('perl $< \"$(used_cflags)\" \"$(used_lflags)\"');" \ |
---|
131 | ) > $@ |
---|
132 | |
---|
133 | ARB.xs : $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs perlmain_source.c typemap |
---|
134 | @(test -f $@ && chmod a+w $@) || true |
---|
135 | $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs typemap >$@ |
---|
136 | @test -f $@ && chmod a-w $@ |
---|
137 | |
---|
138 | proto.h : $(HEADERS) $(THIS) depends.stamp |
---|
139 | cat $(HEADERS) > $@ |
---|
140 | |
---|
141 | debug.h : $(THIS) |
---|
142 | echo "#undef DEBUG" > $@ |
---|
143 | echo "#undef NDEBUG" >> $@ |
---|
144 | ifeq ($(DEBUG),1) |
---|
145 | echo "#define DEBUG" >> $@ |
---|
146 | else |
---|
147 | echo "#define NDEBUG" >> $@ |
---|
148 | endif |
---|
149 | |
---|
150 | clean: |
---|
151 | -test -f Makefile && $(MAKE) clean |
---|
152 | rm -f Makefile.old proto.h debug.h ARB.c ARB.xs .depends depends.stamp Makefile.PL $(TARGETS) |
---|
153 | rm -f Makefile |
---|
154 | |
---|
155 | .depends: depends.stamp Makefile.main |
---|
156 | +test -f ARB.c || $(MAKETHIS) "AUTODEPENDS=0" ARB.c |
---|
157 | $(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) ARB.c 2>/dev/null | \ |
---|
158 | perl -ne 's/ARB.o:/depends.stamp:/g; print $$_;' | \ |
---|
159 | ../SOURCE_TOOLS/fix_depends.pl "(from PERL2ARB)" > $@ |
---|
160 | |
---|
161 | |
---|
162 | depends.stamp: |
---|
163 | touch $@ |
---|
164 | |
---|
165 | ifeq ($(AUTODEPENDS),2) |
---|
166 | include .depends |
---|
167 | endif |
---|
168 | |
---|