Merge branch 'dyninst-master' into dyn_pc_integration
[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_MAJOR   = 2
11 RELEASE_MINOR = 1
12
13 CFLAGS               += $(USEFULWARNINGS) $(DEFINES)
14 CXXFLAGS             += $(USEFULWARNINGS) $(DEFINES)
15
16 ifndef TARGET
17 ifdef STATIC_COMPS
18 STATIC_LIBRARY = true
19 TARGET = libstackwalk.a
20 else
21 TARGET = libstackwalk.so
22 MYFLAGS += -fPIC
23 endif
24 endif
25
26 ifndef USES_NATIVE_CC
27 LD              = $(GXX)
28 LDFLAGS         += -shared
29 CFLAGS          += 
30 CXXFLAGS        += 
31 else
32 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
33 LDFLAGS         += -G
34 endif #sparc
35 endif #USES_NATIVE
36 TFLAGS          +=
37
38 TO_INC     = ../h
39 PUBLIC_H   = basetypes.h \
40              framestepper.h \
41              steppergroup.h \
42              symlookup.h \
43              frame.h \
44              procstate.h \
45              swk_errors.h \
46              walker.h \
47                                  local_var.h \
48                                  sw_c.h
49
50 SRCS         += ../src/frame.C \
51                 ../src/framestepper.C \
52                 ../src/swk_errors.C \
53       ../src/symlookup.C \
54                 ../src/walker.C \
55       ../src/procstate.C \
56       ../src/steppergroup.C \
57                 ../src/libstate.C \
58                 ../src/sw_c.C \
59                 ../src/sw_pcontrol.C
60
61 IFLAGS       += -I../$(PLATFORM) -I../src -I../h -I../../proccontrol/h
62
63 # All that, and we finally get a target...
64 all: $(TARGET) $(EXTRA_LIBS)
65
66 ifdef WRAPPER_LIBS
67 all: libstackwalk_c.so
68 install: $(DEST)/libstackwalk_c.so
69 endif
70
71 SWOBJS = $(filter-out sw_c.o, $(OBJS))
72 SWOBJS += $(wildcard $(TO_CORE)/common/$(PLATFORM)/*.o)
73
74 comma:=,
75 empty:=
76 space:= $(empty) $(empty)
77 WRAPPER_LIBS_NOCOMMA = $(subst $(comma),$(space),$(WRAPPER_LIBS))
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)