source: branches/stable/PERL2ARB/Makefile.main

Last change on this file was 18905, checked in by westram, 2 years ago
  • add 2 scripts checking ARB.so for unsatisfied symbols
    • suppresses symbols satisfied by perl itself.
    • suppress symbols in standard libraries, glib and pthreads.
    • print warnings about rest of undefined symbols.
    • print a note referring to explanation + description of possible fixes.
  • current output:
    ARB.c:0: Warning: xsub references unsatisfied symbol 'GB_calc_structure_size(GBDATA*)'
    warn_undefined_symbols.pl:4: Note: unsatisfied symbols may cause a runtime errors in perl scripts
    
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.3 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# ../SOURCE_TOOLS/filter_defined_symbols.pl
41SHOW_UNDEFINED=$(ARBHOME)/SOURCE_TOOLS/filter_defined_symbols.pl
42WARN_UNDEFINED=./warn_undefined_symbols.pl
43
44# ------------------------------------------------------------
45# variables for Makefile
46
47MYEXTLIB :=
48PASTHRU_INC :=
49PASTHRU_DEFINE :=
50
51export MYEXTLIB PASTHRU_INC PASTHRU_DEFINE dflags
52export CC CXX A_CC A_CXX
53
54# ------------------------------------------------------------
55
56ifeq ($(AUTODEPENDS),1)
57all:
58        +test -f .depends || $(MAKETHIS) "AUTODEPENDS=0" .depends
59        +$(MAKETHIS) "AUTODEPENDS=2" all
60else
61all: realall
62endif
63
64realall: perlmain.c $(TARGETS)
65
66perlmain.c: perlmain_source.c
67        cp $< $@
68
69$(TARGET_PM) : ARB.pm
70        cp $< $@
71
72$(TARGET_SO) : $(ARB_SO) $(SHOW_UNDEFINED) $(WARN_UNDEFINED)
73        $(SHOW_UNDEFINED) $(ARB_SO) $(LIB)/libARBDB.so $(LIB)/libCORE.so | $(WARN_UNDEFINED)
74        cp $< $@
75
76$(ARB_SO) : $(XS_DEPENDS) depends.stamp
77        rm $(ARB_SO) || true
78        @echo "Used perl version: `perl -v | grep 'This is perl'`"
79        @echo "-------- calling MakeMaker-Makefile"
80        ( $(PMAKE) $@ || (echo "------ failed[1].. retry once"; $(PMAKE) $@))
81        @echo "-------- post-recreating .depends"
82        +$(MAKETHIS) "DEPENDS=0" .depends
83        +$(MAKETHIS) $@ # recurse
84
85ARB.c : $(XS_DEPENDS)
86        @echo "-------- calling MakeMaker-Makefile (to get depends)"
87        ( $(PMAKE) $@ || (echo "------ failed[2].. retry once"; $(PMAKE) $@))
88        @echo "-------- end of MakeMaker-Makefile"
89
90# buildMakefile
91
92# ------------------------------------------------------------
93# hack to compile with gcc 4.7.x and perl 5.10.1
94# (see http://bugs.arb-home.de/changeset/10566 for why)
95
96PERL_GCC_INCOMPAT:= \
97        v5.10.1___4.7.1 \
98        v5.10.1___4.7.2 \
99        v5.10.1___4.7.3 \
100        v5.10.1___4.7.4 \
101
102PERL_GCC:=$(shell perl -e 'print "$$^V\n";')___$(COMPILER_VERSION)
103WONT_COMPILE_CXX11:=$(findstring $(PERL_GCC),$(PERL_GCC_INCOMPAT))
104
105ifneq ('$(WONT_COMPILE_CXX11)','')
106        hacked_cflags:=$(subst -std=gnu++11,,$(cflags4perl))
107else
108        hacked_cflags:=$(cflags4perl)
109endif
110ifeq ($(USE_CLANG),1)
111        hacked_cflags:=$(hacked_cflags) -Wno-duplicate-decl-specifier
112endif
113
114# disable several warnings for perl interface build
115# (would need changes in perl-core-api)
116
117disabled_warnings:= \
118        -Wno-zero-as-null-pointer-constant \
119        -Wno-literal-suffix \
120        -Wno-unused-parameter \
121
122used_cflags:=$(subst -Weffc++,,$(hacked_cflags)) $(disabled_warnings) $(CXX_INCLUDES)
123used_lflags:=$(lflags4perl)
124
125MAKE_MAKEFILE=make_arbperl_makefile.pl
126
127Makefile : $(MAKE_MAKEFILE) typemap Makefile.main $(ARB_MAINMAKEFILE)
128        ( PATH=/usr/arb/bin:${PATH}; \
129          export PATH; \
130          echo calling perl $(MAKE_MAKEFILE) "$(used_cflags)" "$(used_lflags)"; \
131          perl $(MAKE_MAKEFILE) "$(used_cflags)" "$(used_lflags)" )
132
133Makefile.PL : $(MAKE_MAKEFILE)
134        ( \
135                echo "system('perl $< \"$(used_cflags)\" \"$(used_lflags)\"');" \
136        ) > $@
137
138ARB.xs : $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs perlmain_source.c typemap
139        @(test -f $@ && chmod a+w $@) || true
140        $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs typemap >$@
141        @test -f $@ && chmod a-w $@
142
143proto.h : $(HEADERS) $(THIS) depends.stamp
144        cat $(HEADERS) > $@
145
146debug.h : $(THIS)
147        echo "#undef DEBUG" > $@
148        echo "#undef NDEBUG" >> $@
149ifeq ($(DEBUG),1)
150        echo "#define DEBUG" >> $@
151else
152        echo "#define NDEBUG" >> $@
153endif
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)
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.