source: tags/arb_5.5/PERL2ARB/Makefile.main

Last change on this file was 5877, checked in by westram, 16 years ago
  • OSX patches (thx again to Matt Cottrell)
  • added some notes about using bswap in PT-Server
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 KB
Line 
1# -*-Mode: Makefile;-*-
2#
3# To rebuild PERL2ARB from $ARBHOME call
4# make perl_clean perl
5
6THIS=Makefile.main
7MAKETHIS=$(MAKE) -f $(THIS)
8#MAKETHIS=$(MAKE) -d -f $(THIS)
9
10LIB=$(ARBHOME)/lib
11ARBDB=$(ARBHOME)/ARBDB
12ARB_PROTO_2_XSUB=$(ARBHOME)/bin/arb_proto_2_xsub
13
14HEADERS = \
15        $(ARBDB)/ad_prot.h \
16        $(ARBDB)/ad_t_prot.h \
17
18ifdef DARWIN
19SO:=bundle
20else
21SO:=so
22endif
23
24ARB_SO=blib/arch/auto/ARB/ARB.$(SO)
25
26TARGET_PM=$(LIB)/ARB.pm
27TARGET_SO=$(LIB)/ARB.$(SO)     
28
29TARGETS=$(TARGET_PM) $(TARGET_SO)
30
31XS_DEPENDS = Makefile ARB.xs debug.h Makefile.PL
32
33# ------------------------------------------------------------
34# variables for Makefile
35
36MYEXTLIB :=
37PASTHRU_INC :=
38PASTHRU_DEFINE :=
39
40export MYEXTLIB PASTHRU_INC PASTHRU_DEFINE dflags
41
42# ------------------------------------------------------------
43
44all: perlmain.c $(TARGETS)
45
46perlmain.c: perlmain_source.c
47        cp $< $@
48
49$(TARGET_PM) : ARB.pm
50        cp $< $@
51
52$(TARGET_SO) : $(ARB_SO)
53        cp $< $@
54
55$(ARB_SO) : $(XS_DEPENDS) depends.stamp
56        -rm $(ARB_SO)
57        @echo "-------- calling MakeMaker-Makefile"
58        ( $(MAKE) "dflags=${dflags}" $@ || \
59                (echo "------ failed.. retry once"; \
60                 $(MAKE) "dflags=${dflags}" $@))
61        @echo "-------- post-recreating .depends"
62        $(MAKETHIS) "DEPENDS=0" .depends
63        $(MAKETHIS) $@ # recurse
64
65ARB.c : $(XS_DEPENDS)
66        @echo "-------- calling MakeMaker-Makefile (to get depends)"
67        ( $(MAKE) "dflags=${dflags}" $@ || \
68                (echo "------ failed.. retry once"; \
69                 $(MAKE) "dflags=${dflags}" $@ ))
70        @echo "-------- end of MakeMaker-Makefile"
71
72Makefile : $(MACH).PL typemap 
73        ( PATH=/usr/arb/bin:${PATH}; \
74          export PATH; \
75          echo calling perl ${MACH}.PL; \
76          perl ${MACH}.PL )
77
78Makefile.PL : $(MACH).PL
79        cp -p $< $@
80
81ARB.xs : $(ARB_PROTO_2_XSUB) proto.h ARB.xs.default
82        -@test -f $@ && chmod a+w $@
83        LD_LIBRARY_PATH=$(LIB):$(LD_LIBRARY_PATH) $(ARB_PROTO_2_XSUB) proto.h ARB.xs.default > $@
84        @test -f $@ && chmod a-w $@
85
86proto.h : $(HEADERS) $(THIS) depends.stamp
87        cat $(HEADERS) > $@
88
89debug.h : $(THIS)
90        echo "#undef DEBUG" > $@
91        echo "#undef NDEBUG" >> $@
92ifeq ($(DEBUG),1)
93        echo "#define DEBUG" >> $@
94else
95        echo "#define NDEBUG" >> $@
96endif
97
98clean:
99        -test -f Makefile && $(MAKE) clean
100        rm -f Makefile.old proto.h debug.h ARB.c ARB.xs .depends depends.stamp Makefile.PL $(TARGETS)
101
102.depends: depends.stamp Makefile.main
103        test -f ARB.c || $(MAKETHIS) "AUTODEPENDS=0" ARB.c
104        $(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) ARB.c 2>/dev/null | \
105                perl -ne 's/ARB.o:/depends.stamp:/g; print $$_;' | \
106                ../SOURCE_TOOLS/fix_depends.pl > $@
107
108
109depends.stamp:
110        touch $@
111
112ifeq ($(AUTODEPENDS),1)
113include .depends
114endif
115
Note: See TracBrowser for help on using the repository browser.