source: branches/stable/PERL2ARB/Makefile.main

Last change on this file was 12313, checked in by westram, 5 years ago
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.6 KB
Line 
1# -*-Mode: Makefile;-*-
2#
3# To rebuild PERL2ARB from $ARBHOME call
4# make perl_clean perl
5
6ARB_MAINMAKEFILE=../Makefile
7THIS=Makefile.main
8
9# howto call Makefile.main (this file)
10MAKETHIS=$(MAKE) -f $(THIS)
11
12# howto call generated Makefile
13PMAKE=$(MAKE) "CC=$(A_CXX)"
14
15LIB=$(ARBHOME)/lib
16ARBDB=$(ARBHOME)/ARBDB
17
18# code in -> ../PERLTOOLS/arb_proto_2_xsub.cxx
19ARB_PROTO_2_XSUB=$(ARBHOME)/bin/arb_proto_2_xsub
20
21HEADERS = \
22        $(ARBDB)/ad_prot.h \
23        $(ARBDB)/ad_t_prot.h \
24
25ifeq ($(DARWIN),1)
26SO:=bundle
27else
28SO:=so
29endif
30
31ARB_SO=blib/arch/auto/ARB/ARB.$(SO)
32
33TARGET_PM=$(LIB)/ARB.pm
34TARGET_SO=$(LIB)/ARB.$(SO)
35
36TARGETS=$(TARGET_PM) $(TARGET_SO)
37
38XS_DEPENDS = Makefile Makefile.main ARB.xs debug.h Makefile.PL
39
40# ------------------------------------------------------------
41# variables for Makefile
42
43MYEXTLIB :=
44PASTHRU_INC :=
45PASTHRU_DEFINE :=
46
47export MYEXTLIB PASTHRU_INC PASTHRU_DEFINE dflags
48export CC CXX A_CC A_CXX
49
50# ------------------------------------------------------------
51
52ifeq ($(AUTODEPENDS),1)
53all:
54        +test -f .depends || $(MAKETHIS) "AUTODEPENDS=0" .depends
55        +$(MAKETHIS) "AUTODEPENDS=2" all
56else
57all: realall
58endif
59
60realall: perlmain.c $(TARGETS)
61
62perlmain.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)
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
80ARB.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.3 and perl 5.10.1
89# (see http://bugs.arb-home.de/changeset/10566 for why)
90
91PERL_GCC_INCOMPAT:= v5.10.1___4.7.3
92PERL_GCC:=$(shell perl -e 'print "$$^V\n";')___$(COMPILER_VERSION)
93WONT_COMPILE_CXX11:=$(findstring $(PERL_GCC),$(PERL_GCC_INCOMPAT))
94
95ifneq ('$(WONT_COMPILE_CXX11)','')
96        hacked_cflags:=$(subst -std=gnu++11,,$(cross_cflags))
97else
98        hacked_cflags:=$(cross_cflags)
99endif
100
101used_cflags:=$(subst -Weffc++,,$(hacked_cflags)) -Wno-literal-suffix $(CXX_INCLUDES)
102used_lflags:=$(cross_lflags)
103
104MAKE_MAKEFILE=make_arbperl_makefile.pl
105
106Makefile : $(MAKE_MAKEFILE) typemap Makefile.main $(ARB_MAINMAKEFILE)
107        ( PATH=/usr/arb/bin:${PATH}; \
108          export PATH; \
109          echo calling perl $(MAKE_MAKEFILE) "$(used_cflags)" "$(used_lflags)"; \
110          perl $(MAKE_MAKEFILE) "$(used_cflags)" "$(used_lflags)" )
111
112Makefile.PL : $(MAKE_MAKEFILE)
113        ( \
114                echo "system('perl $< \"$(used_cflags)\" \"$(used_lflags)\"');" \
115        ) > $@
116
117ARB.xs : $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs perlmain_source.c typemap
118        -@test -f $@ && chmod a+w $@
119        $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs typemap >$@
120        @test -f $@ && chmod a-w $@
121
122proto.h : $(HEADERS) $(THIS) depends.stamp
123        cat $(HEADERS) > $@
124
125debug.h : $(THIS)
126        echo "#undef DEBUG" > $@
127        echo "#undef NDEBUG" >> $@
128ifeq ($(DEBUG),1)
129        echo "#define DEBUG" >> $@
130else
131        echo "#define NDEBUG" >> $@
132endif
133
134clean:
135        -test -f Makefile && $(MAKE) clean
136        rm -f Makefile.old proto.h debug.h ARB.c ARB.xs .depends depends.stamp Makefile.PL $(TARGETS)
137        rm -f Makefile
138
139.depends: depends.stamp Makefile.main
140        +test -f ARB.c || $(MAKETHIS) "AUTODEPENDS=0" ARB.c
141        $(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) ARB.c 2>/dev/null | \
142                perl -ne 's/ARB.o:/depends.stamp:/g; print $$_;' | \
143                ../SOURCE_TOOLS/fix_depends.pl "(from PERL2ARB)" > $@
144
145
146depends.stamp:
147        touch $@
148
149ifeq ($(AUTODEPENDS),2)
150include .depends
151endif
152
Note: See TracBrowser for help on using the repository browser.