Fixed parseThat makefile
[dyninst.git] / parseThat / Makefile
1 # ----------------------------------------------
2 # Configuration variables taken from ./configure
3 # ----------------------------------------------
4 CPPFLAGS     = -I$(DYNINST_ROOT)/core/dynutil/h -I$(DYNINST_ROOT)/core/dyninstAPI/h -I$(DYNINST_ROOT)/core/symtabAPI/h -I$(DYNINST_ROOT)/core -g
5 CXX          = g++
6 CXXFLAGS     = -I$(DYNINST_ROOT)/core/dynutil/h -I$(DYNINST_ROOT)/core/dyninstAPI/h -I$(DYNINST_ROOT)/core/symtabAPI/h -I$(DYNINST_ROOT)/core -g
7 DEFINES      = -DPACKAGE_NAME=\"parseThat\" -DPACKAGE_TARNAME=\"parsethat\" -DPACKAGE_VERSION=\"1.0\" -DPACKAGE_STRING=\"parseThat\ 1.0\" -DPACKAGE_BUGREPORT=\"\" -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_BPATCH_PROCESS_H=1 
8 LDFLAGS      = -L$(DYNINST_ROOT)/$(PLATFORM)/lib
9 LIBS         = 
10
11 prefix       = .
12 PLATFORM    ?= i686-pc-linux-gnu
13 DYNINST_VER  = 5
14
15 INSTALL      =
16 #INSTALL      = install -c
17
18 vpath % ./src
19
20 # -------------------------------------------
21 # Begin Makefile based on variables set above
22 # -------------------------------------------
23 .PHONY: clean ready
24
25 SRCS         = parseThat.C \
26                config.C \
27                ipc.C \
28                record.C \
29                strlist.C \
30                reglist.C \
31                log.C \
32                utils.C \
33                sha1.C \
34                dyninstCore.C
35
36 ifeq ($(DYNINST_VER), 5)
37 SRCS        += dyninstCompat.v5.C
38 endif
39
40 ifeq ($(DYNINST_VER), 4)
41 SRCS        += dyninstCompat.v4.C
42 endif
43
44 OBJDIR       = obj-$(PLATFORM)
45 OBJS         = $(addprefix $(OBJDIR)/, $(SRCS:%.C=%.o))
46
47 CXXFLAGS    += -Wall
48 LIBS        += -ldyninstAPI -lsymtabAPI -liberty
49
50 ifneq (, $(findstring sparc, $(PLATFORM)))
51 LIBS        += -lelf -lstdc++ -lsocket -lrt
52 endif
53
54 ifneq (, $(findstring alpha, $(PLATFORM)))
55 CXXFLAGS    += -pthread
56 endif
57
58 ifneq (, $(findstring ia64, $(PLATFORM)))
59 LIBS        += -ldl
60 endif
61
62 all: ready $(OBJDIR)/parseThat
63
64 install: $(OBJDIR)/parseThat
65         $(INSTALL) -d $(prefix)
66         $(INSTALL) $(OBJDIR)/parseThat $(prefix)/parseThat
67
68 clean:
69         rm -rf $(OBJDIR)
70
71 distclean: clean
72         rm -rf config.log config.status $(OBJDIR) Makefile
73
74 ready:
75         mkdir -p obj-$(PLATFORM)
76         $(INSTALL) -d $(OBJDIR)
77
78 $(OBJDIR)/parseThat: $(OBJS)
79         $(CXX) $(CXXFLAGS) $^ -o $@ $(LDFLAGS) $(LIBS)
80
81 $(OBJS): $(OBJDIR)/%.o: %.C
82         $(CXX) $(CXXFLAGS) $(CPPFLAGS) $(DEFINES) $^ -c -o $@
83
84 alarm: alarm.c liblib.so
85         gcc -Wall -g -o alarm alarm.c liblib.so
86
87 liblib.so: lib.c
88         gcc -Wall -g -shared -o liblib.so lib.c