source: tags/old_import_filter/PERL2ARB/Makefile.main

Last change on this file was 9574, checked in by westram, 11 years ago
  • show from where dependencies are updated
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 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
12
13# code in -> ../PERLTOOLS/arb_proto_2_xsub.cxx
14ARB_PROTO_2_XSUB=$(ARBHOME)/bin/arb_proto_2_xsub
15
16HEADERS = \
17        $(ARBDB)/ad_prot.h \
18        $(ARBDB)/ad_t_prot.h \
19
20ifdef DARWIN
21SO:=bundle
22else
23SO:=so
24endif
25
26ARB_SO=blib/arch/auto/ARB/ARB.$(SO)
27
28TARGET_PM=$(LIB)/ARB.pm
29TARGET_SO=$(LIB)/ARB.$(SO)     
30
31TARGETS=$(TARGET_PM) $(TARGET_SO)
32
33XS_DEPENDS = Makefile Makefile.main ARB.xs debug.h Makefile.PL
34
35# ------------------------------------------------------------
36# variables for Makefile
37
38MYEXTLIB :=
39PASTHRU_INC :=
40PASTHRU_DEFINE :=
41
42export MYEXTLIB PASTHRU_INC PASTHRU_DEFINE dflags
43
44# ------------------------------------------------------------
45
46ifeq ($(AUTODEPENDS),1)
47all:
48        +test -f .depends || $(MAKETHIS) "AUTODEPENDS=0" .depends
49        +$(MAKETHIS) "AUTODEPENDS=2" all
50else
51all: realall
52endif
53
54realall: perlmain.c $(TARGETS)
55
56perlmain.c: perlmain_source.c
57        cp $< $@
58
59$(TARGET_PM) : ARB.pm
60        cp $< $@
61
62$(TARGET_SO) : $(ARB_SO)
63        cp $< $@
64
65$(ARB_SO) : $(XS_DEPENDS) depends.stamp
66        -rm $(ARB_SO)
67        @echo "-------- calling MakeMaker-Makefile"
68        ( $(MAKE) "dflags=${dflags} " $@ || \
69                (echo "------ failed.. retry once"; \
70                 $(MAKE) "dflags=${dflags}" $@))
71        @echo "-------- post-recreating .depends"
72        +$(MAKETHIS) "DEPENDS=0" .depends
73        +$(MAKETHIS) $@ # recurse
74
75ARB.c : $(XS_DEPENDS)
76        @echo "-------- calling MakeMaker-Makefile (to get depends)"
77        ( $(MAKE) "dflags=${dflags}" $@ || \
78                (echo "------ failed.. retry once"; \
79                 $(MAKE) "dflags=${dflags}" $@ ))
80        @echo "-------- end of MakeMaker-Makefile"
81
82# buildMakefile
83Makefile : $(MACH).PL typemap Makefile.main arb_common.pm
84        ( PATH=/usr/arb/bin:${PATH}; \
85          export PATH; \
86          echo calling perl ${MACH}.PL "$(cross_cflags)" "$(cross_lflags)"; \
87          perl ${MACH}.PL "$(cross_cflags)" "$(cross_lflags)" )
88
89Makefile.PL : $(MACH).PL
90        ( \
91                echo "system('perl $< \"$(cross_cflags)\" \"$(cross_lflags)\"');" \
92        ) > $@
93
94ARB.xs : $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs perlmain_source.c typemap
95        -@test -f $@ && chmod a+w $@
96        $(ARB_PROTO_2_XSUB) proto.h ARB.default.xs typemap >$@
97        @test -f $@ && chmod a-w $@
98
99proto.h : $(HEADERS) $(THIS) depends.stamp
100        cat $(HEADERS) > $@
101
102debug.h : $(THIS)
103        echo "#undef DEBUG" > $@
104        echo "#undef NDEBUG" >> $@
105ifeq ($(DEBUG),1)
106        echo "#define DEBUG" >> $@
107else
108        echo "#define NDEBUG" >> $@
109endif
110
111clean:
112        -test -f Makefile && $(MAKE) clean
113        rm -f Makefile.old proto.h debug.h ARB.c ARB.xs .depends depends.stamp Makefile.PL $(TARGETS)
114        rm -f Makefile
115
116.depends: depends.stamp Makefile.main
117        +test -f ARB.c || $(MAKETHIS) "AUTODEPENDS=0" ARB.c
118        $(MAKEDEPEND) -f- $(MAKEDEPENDFLAGS) ARB.c 2>/dev/null | \
119                perl -ne 's/ARB.o:/depends.stamp:/g; print $$_;' | \
120                ../SOURCE_TOOLS/fix_depends.pl "(from PERL2ARB)" > $@
121
122
123depends.stamp:
124        touch $@
125
126ifeq ($(AUTODEPENDS),2)
127include .depends
128endif
129
Note: See TracBrowser for help on using the repository browser.