Support for wrapping C++ in C
[dyninst.git] / stackwalk / make.module.tmpl
1 # -*- makefile -*-
2 # Common makefile template for the dyninstAPI library.  This file is not
3 # intended to be a useful Makefile in isolation; instead, it should be
4 # included from within an architecture-specific Makefile.
5 #
6 # $Id: make.module.tmpl,v 1.1 2008/06/30 19:40:26 legendre Exp $
7 #
8
9 SUITE_NAME      = Stackwalker
10 RELEASE_NUM     = 1.0
11
12 CFLAGS               += $(USEFULWARNINGS) $(DEFINES)
13 CXXFLAGS             += $(USEFULWARNINGS) $(DEFINES)
14
15 ifndef TARGET
16 ifdef STATIC_COMPS
17 STATIC_LIBRARY = true
18 TARGET = libstackwalk.a
19 else
20 TARGET = libstackwalk.so
21 MYFLAGS += -fPIC
22 endif
23 endif
24
25 ifndef USES_NATIVE_CC
26 LD              = $(GXX)
27 LDFLAGS         += -shared
28 CFLAGS          += 
29 CXXFLAGS        += 
30 else
31 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
32 LDFLAGS         += -G
33 endif #sparc
34 endif #USES_NATIVE
35 TFLAGS          +=
36
37 TO_INC     = ../h
38 PUBLIC_H   = basetypes.h \
39              framestepper.h \
40              steppergroup.h \
41              symlookup.h \
42              frame.h \
43              procstate.h \
44              swk_errors.h \
45              walker.h \
46                                  local_var.h
47
48 SRCS         += ../src/frame.C \
49                 ../src/framestepper.C \
50                 ../src/swk_errors.C \
51       ../src/symlookup.C \
52                 ../src/walker.C \
53       ../src/procstate.C \
54       ../src/steppergroup.C \
55                 ../src/sw_c.C
56
57
58 IFLAGS       += -I../$(PLATFORM) -I../src -I../h
59
60 # All that, and we finally get a target...
61 all: $(TARGET) $(EXTRA_LIBS)
62
63 ifdef WRAPPER_LIBS
64 all: libstackwalk_c.so
65 install: $(DEST)/libstackwalk_c.so
66 endif
67
68 SWOBJS = $(filter-out sw_c.o, $(OBJS))
69 SWOBJS += $(wildcard $(TO_CORE)/common/$(PLATFORM)/*.o)
70
71 comma:=,
72 empty:=
73 space:= $(empty) $(empty)
74 WRAPPER_LIBS_NOCOMMA = $(subst $(comma),$(space),$(WRAPPER_LIBS))
75
76 echo2:
77         @echo $(WRAPPER_LIBS_NOCOMMA)
78
79 libsw.a: $(SWOBJS)
80         ar rs $@ $(SWOBJS)
81
82 libstackwalk_c.so: libsw.a sw_c.o
83         g++ -o $@ -shared sw_c.o -Wl,--exclude-libs -Wl,ALL libsw.a $(WRAPPER_LIBS_NOCOMMA)
84
85 $(DEST)/libstackwalk_c.so: libstackwalk_c.so
86         -$(CP) libstackwalk_c.so $(DEST)