Move libelf/libdwarf include and link processing out of component directories and...
[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   = 7
11 RELEASE_MINOR = 0
12
13 USES_DWARF_DEBUG = true
14 USES_LIBELF = true
15
16 CFLAGS               += $(USEFULWARNINGS) $(DEFINES)
17 CXXFLAGS             += $(USEFULWARNINGS) $(DEFINES)
18
19 LDFLAGS += -L../../common/$(PLATFORM)
20
21 ifndef TARGET
22 ifdef STATIC_COMPS
23 STATIC_LIBRARY = true
24 TARGET = libstackwalk.a
25 else
26 TARGET = libstackwalk.so
27 MYFLAGS += -fPIC
28 endif
29 endif
30
31 LDFLAGS += -L$(TO_CORE)/common/$(PLATFORM) -L$(LIBRARY_DEST)
32 ifndef USES_NATIVE_CC
33 LD              = $(GXX)
34 LDFLAGS         += -shared
35 CFLAGS          += 
36 CXXFLAGS        += 
37 else
38 ifeq (solaris,$(findstring solaris,$(PLATFORM)))
39 LDFLAGS         += -G
40 endif #sparc
41 endif #USES_NATIVE
42 TFLAGS          +=
43
44 TO_INC     = ../h
45 PUBLIC_H   = basetypes.h \
46              framestepper.h \
47              steppergroup.h \
48              symlookup.h \
49              frame.h \
50              procstate.h \
51              swk_errors.h \
52              walker.h \
53                                  local_var.h \
54                                  sw_c.h
55
56 SRCS         += ../src/frame.C \
57                 ../src/framestepper.C \
58                 ../src/swk_errors.C \
59       ../src/symlookup.C \
60                 ../src/walker.C \
61       ../src/procstate.C \
62       ../src/steppergroup.C \
63                 ../src/libstate.C \
64                 ../src/sw_c.C \
65                 ../src/sw_pcontrol.C
66
67 IFLAGS       += -I../$(PLATFORM) -I../src -I../h -I../../proccontrol/h
68
69 # All that, and we finally get a target...
70 all: $(TARGET) $(EXTRA_LIBS)
71
72 ifdef WRAPPER_LIBS
73 all: libstackwalk_c.so
74 install: $(DEST)/libstackwalk_c.so
75 endif
76
77 SWOBJS = $(filter-out sw_c.o, $(OBJS))
78 SWOBJS += $(wildcard $(TO_CORE)/common/$(PLATFORM)/*.o)
79
80 comma:=,
81 empty:=
82 space:= $(empty) $(empty)
83 WRAPPER_LIBS_NOCOMMA = $(subst $(comma),$(space),$(WRAPPER_LIBS))
84
85 libsw.a: $(SWOBJS)
86         ar rs $@ $(SWOBJS)
87
88 libstackwalk_c.so: libsw.a sw_c.o
89         g++ -o $@ -shared sw_c.o -Wl,--exclude-libs -Wl,ALL libsw.a $(WRAPPER_LIBS_NOCOMMA)
90
91 $(DEST)/libstackwalk_c.so: libstackwalk_c.so
92         -$(INSTALL) libstackwalk_c.so $(DEST)