source: tags/arb-6.0-rc1/PERL2ARB/Makefile.main

Last change on this file was 11805, checked in by westram, 11 years ago
  • export 'LINUX' and 'REDHAT' to submakefiles
  • use ifeq instead of ifdef (completes [11804])
  • 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
8MAKETHIS=$(MAKE) -f $(THIS)
9#MAKETHIS=$(MAKE) -d -f $(THIS)
10
11LIB=$(ARBHOME)/lib
12ARBDB=$(ARBHOME)/ARBDB
13
14# code in -> ../PERLTOOLS/arb_proto_2_xsub.cxx
15ARB_PROTO_2_XSUB=$(ARBHOME)/bin/arb_proto_2_xsub
16
17HEADERS = \
18        $(ARBDB)/ad_prot.h \
19        $(ARBDB)/ad_t_prot.h \
20
21ifeq ($(DARWIN),1)
22SO:=bundle
23else
24SO:=so
25endif
26
27ARB_SO=blib/arch/auto/ARB/ARB.$(SO)
28
29TARGET_PM=$(LIB)/ARB.pm
30TARGET_SO=$(LIB)/ARB.$(SO)
31
32TARGETS=$(TARGET_PM) $(TARGET_SO)
33
34XS_DEPENDS = Makefile Makefile.main ARB.xs debug.h Makefile.PL
35
36# ------------------------------------------------------------
37# variables for Makefile
38
39MYEXTLIB :=
40PASTHRU_INC :=
41PASTHRU_DEFINE :=
42
43export MYEXTLIB PASTHRU_INC PASTHRU_DEFINE dflags
44
45# ------------------------------------------------------------
46
47ifeq ($(AUTODEPENDS),1)
48all:
49        +test -f .depends || $(MAKETHIS) "AUTODEPENDS=0" .depends
50        +$(MAKETHIS) "AUTODEPENDS=2" all
51else
52all: realall
53endif
54
55realall: perlmain.c $(TARGETS)
56
57perlmain.c: perlmain_source.c
58        cp $< $@
59
60$(TARGET_PM) : ARB.pm
61        cp $< $@
62
63$(TARGET_SO) : $(ARB_SO)
64        cp $< $@
65
66$(ARB_SO) : $(XS_DEPENDS) depends.stamp
67        -rm $(ARB_SO)
68        @echo "Used perl version: `perl -v | grep 'This is perl'`"
69        @echo "-------- calling MakeMaker-Makefile"
70        ( $(MAKE) "dflags=${dflags} " $@ || \
71                (echo "------ failed.. retry once"; \
72                 $(MAKE) "dflags=${dflags}" $@))
73        @echo "-------- post-recreating .depends"
74        +$(MAKETHIS) "DEPENDS=0" .depends
75        +$(MAKETHIS) $@ # recurse
76
77ARB.c : $(XS_DEPENDS)
78        @echo "-------- calling MakeMaker-Makefile (to get depends)"
79        ( $(MAKE) "dflags=${dflags}" $@ || \
80                (echo "------ failed.. retry once"; \
81                 $(MAKE) "dflags=${dflags}" $@ ))
82        @echo "-------- end of MakeMaker-Makefile"
83
84# buildMakefile
85
86# ------------------------------------------------------------
87# hack to compile with gcc 4.7.3 and perl 5.10.1
88# (see http://bugs.arb-home.de/changeset/10566 for why)
89
90PERL_GCC_INCOMPAT:= v5.10.1___4.7.3
91PERL_GCC:=$(shell perl -e 'print "$$^V\n";')___$(COMPILER_VERSION)
92WONT_COMPILE_CXX11:=$(findstring $(PERL_GCC),$(PERL_GCC_INCOMPAT))
93
94ifneq ('$(WONT_COMPILE_CXX11)','')
95        hacked_cflags:=$(subst -std=gnu++11,,$(cross_cflags))
96else
97        hacked_cflags:=$(cross_cflags)
98endif
99
100used_cflags:=$(subst -Weffc++,,$(hacked_cflags)) -Wno-literal-suffix
101used_lflags:=$(cross_lflags)
102
103MAKE_MAKEFILE=make_arbperl_makefile.pl
104
105Makefile : $(MAKE_MAKEFILE) typemap Makefile.main $(ARB_MAINMAKEFILE)
106        ( PATH=/usr/arb/bin:${PATH}; \
107          export PATH; \
108          echo calling perl $(MAKE_MAKEFILE) "$(used_cflags)" "$(used_lflags)"; \
109          perl $(MAKE_MAKEFILE) "$(used_cflags)" "$(used_lflags)" )
110
111Makefile.PL : $(MAKE_MAKEFILE)
112        ( \
113                echo "system('perl $< \"$(used_cflags)\" \"$(used_lflags)\"');" \
114        ) > $@
115
116ARB.xs : $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs perlmain_source.c typemap
117        -@test -f $@ && chmod a+w $@
118        $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs typemap >$@
119        @test -f $@ && chmod a-w $@
120
121proto.h : $(HEADERS) $(THIS) depends.stamp
122        cat $(HEADERS) > $@
123
124debug.h : $(THIS)
125        echo "#undef DEBUG" > $@
126        echo "#undef NDEBUG" >> $@
127ifeq ($(DEBUG),1)
128        echo "#define DEBUG" >> $@
129else
130        echo "#define NDEBUG" >> $@
131endif
132
133clean:
134        -test -f Makefile && $(MAKE) clean
135        rm -f Makefile.old proto.h debug.h ARB.c ARB.xs .depends depends.stamp Makefile.PL $(TARGETS)
136        rm -f Makefile
137
138.depends: depends.stamp Makefile.main
139        +test -f ARB.c || $(MAKETHIS) "AUTODEPENDS=0" ARB.c
140        $(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) ARB.c 2>/dev/null | \
141                perl -ne 's/ARB.o:/depends.stamp:/g; print $$_;' | \
142                ../SOURCE_TOOLS/fix_depends.pl "(from PERL2ARB)" > $@
143
144
145depends.stamp:
146        touch $@
147
148ifeq ($(AUTODEPENDS),2)
149include .depends
150endif
151
Note: See TracBrowser for help on using the repository browser.