source: branches/help/PERL2ARB/Makefile.main

Last change on this file was 18746, checked in by westram, 3 years ago
  • adds a script which generates a list of perl interface functions
    • call during arb build
  • update DOC.txt
    • mention that list
    • very basic description of interface
    • describe the ancient information which already has been in this document.
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.1 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
38DOC=perl-interface-function-list.txt
39
40XS_DEPENDS = Makefile Makefile.main ARB.xs debug.h Makefile.PL
41
42# ------------------------------------------------------------
43# variables for Makefile
44
45MYEXTLIB :=
46PASTHRU_INC :=
47PASTHRU_DEFINE :=
48
49export MYEXTLIB PASTHRU_INC PASTHRU_DEFINE dflags
50export CC CXX A_CC A_CXX
51
52# ------------------------------------------------------------
53
54ifeq ($(AUTODEPENDS),1)
55all:
56        +test -f .depends || $(MAKETHIS) "AUTODEPENDS=0" .depends
57        +$(MAKETHIS) "AUTODEPENDS=2" all
58else
59all: realall
60endif
61
62realall: perlmain.c $(TARGETS) $(DOC)
63
64perlmain.c: perlmain_source.c
65        cp $< $@
66
67$(TARGET_PM) : ARB.pm
68        cp $< $@
69
70$(TARGET_SO) : $(ARB_SO)
71        cp $< $@
72
73$(ARB_SO) : $(XS_DEPENDS) depends.stamp
74        rm $(ARB_SO) || true
75        @echo "Used perl version: `perl -v | grep 'This is perl'`"
76        @echo "-------- calling MakeMaker-Makefile"
77        ( $(PMAKE) $@ || (echo "------ failed[1].. retry once"; $(PMAKE) $@))
78        @echo "-------- post-recreating .depends"
79        +$(MAKETHIS) "DEPENDS=0" .depends
80        +$(MAKETHIS) $@ # recurse
81
82ARB.c : $(XS_DEPENDS)
83        @echo "-------- calling MakeMaker-Makefile (to get depends)"
84        ( $(PMAKE) $@ || (echo "------ failed[2].. retry once"; $(PMAKE) $@))
85        @echo "-------- end of MakeMaker-Makefile"
86
87# buildMakefile
88
89# ------------------------------------------------------------
90# hack to compile with gcc 4.7.x and perl 5.10.1
91# (see http://bugs.arb-home.de/changeset/10566 for why)
92
93PERL_GCC_INCOMPAT:= \
94        v5.10.1___4.7.1 \
95        v5.10.1___4.7.2 \
96        v5.10.1___4.7.3 \
97        v5.10.1___4.7.4 \
98
99PERL_GCC:=$(shell perl -e 'print "$$^V\n";')___$(COMPILER_VERSION)
100WONT_COMPILE_CXX11:=$(findstring $(PERL_GCC),$(PERL_GCC_INCOMPAT))
101
102ifneq ('$(WONT_COMPILE_CXX11)','')
103        hacked_cflags:=$(subst -std=gnu++11,,$(cflags4perl))
104else
105        hacked_cflags:=$(cflags4perl)
106endif
107ifeq ($(USE_CLANG),1)
108        hacked_cflags:=$(hacked_cflags) -Wno-duplicate-decl-specifier
109endif
110
111# disable several warnings for perl interface build
112# (would need changes in perl-core-api)
113
114disabled_warnings:= \
115        -Wno-zero-as-null-pointer-constant \
116        -Wno-literal-suffix \
117        -Wno-unused-parameter \
118
119used_cflags:=$(subst -Weffc++,,$(hacked_cflags)) $(disabled_warnings) $(CXX_INCLUDES)
120used_lflags:=$(lflags4perl)
121
122MAKE_MAKEFILE=make_arbperl_makefile.pl
123
124Makefile : $(MAKE_MAKEFILE) typemap Makefile.main $(ARB_MAINMAKEFILE)
125        ( PATH=/usr/arb/bin:${PATH}; \
126          export PATH; \
127          echo calling perl $(MAKE_MAKEFILE) "$(used_cflags)" "$(used_lflags)"; \
128          perl $(MAKE_MAKEFILE) "$(used_cflags)" "$(used_lflags)" )
129
130Makefile.PL : $(MAKE_MAKEFILE)
131        ( \
132                echo "system('perl $< \"$(used_cflags)\" \"$(used_lflags)\"');" \
133        ) > $@
134
135ARB.xs : $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs perlmain_source.c typemap
136        @(test -f $@ && chmod a+w $@) || true
137        $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs typemap >$@
138        @test -f $@ && chmod a-w $@
139
140proto.h : $(HEADERS) $(THIS) depends.stamp
141        cat $(HEADERS) > $@
142
143debug.h : $(THIS)
144        echo "#undef DEBUG" > $@
145        echo "#undef NDEBUG" >> $@
146ifeq ($(DEBUG),1)
147        echo "#define DEBUG" >> $@
148else
149        echo "#define NDEBUG" >> $@
150endif
151
152$(DOC): proto.h ARB.c extract_perl_interface.pl
153        ./extract_perl_interface.pl > $(DOC)
154
155clean:
156        -test -f Makefile && $(MAKE) clean
157        rm -f Makefile.old proto.h debug.h ARB.c ARB.xs .depends depends.stamp Makefile.PL $(TARGETS) $(DOC)
158        rm -f Makefile
159
160.depends: depends.stamp Makefile.main
161        +test -f ARB.c || $(MAKETHIS) "AUTODEPENDS=0" ARB.c
162        $(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) ARB.c 2>/dev/null | \
163                perl -ne 's/ARB.o:/depends.stamp:/g; print $$_;' | \
164                ../SOURCE_TOOLS/fix_depends.pl "(from PERL2ARB)" > $@
165
166
167depends.stamp:
168        touch $@
169
170ifeq ($(AUTODEPENDS),2)
171include .depends
172endif
173
Note: See TracBrowser for help on using the repository browser.