Use install-sh to install dyninst libraries and includes rather than cp
[dyninst.git] / dyninstAPI_RT / x86_64-unknown-linux2.4 / Makefile
1 #
2 # $Id: Makefile,v 1.13 2008/04/11 23:30:47 legendre Exp $
3 #
4
5 # Define any symbols needed to invoke configuration changes in make.config
6
7 # none
8
9 # Include standard make configuration stuff that applies to everything
10 # in the paradyn tree.
11
12 include ../../make.config 
13
14 ifndef STATIC_TARGET
15     STATIC_TARGET = libdyninstAPI_RT.a
16 endif
17
18 # Now make any necessary architecture specific changes to variables:
19 LD              = $(GCC)
20 LDFLAGS         += -shared
21 LDFLAGS         += -m64
22 CFLAGS          += -Wall -m64 -DMUTATEE64
23
24 # if we want to produce a shared object...
25 CC              = $(GCC)
26 LD              = $(GCC)
27 STATIC_CFLAGS   := $(CFLAGS) -DDYNINST_RT_STATIC_LIB -I. -I../..
28 CFLAGS          += -I. -I../.. -fPIC
29
30 LIBS            += -ldl
31
32 ASFLAGS         += 
33
34 SRCS            += ../src/RTposix.c \
35                    ../src/RTlinux.c \
36                    ../src/RTheap.c \
37                    ../src/RTheap-linux.c \
38                         ../src/RTthread-x86-64.c \
39                         ../src/RTthread.c \
40                         ../src/RTspace.S \
41                         ../src/RTstatic_ctors_dtors-x86.c \
42                         ../src/RTtlsgetaddr-x86_64.S
43 #                  ../src/RTmutatedBinary.c \
44 #                  ../src/RTmutatedBinary_ELF.c \
45
46 #CFLAGS += -DDEBUG_PRINT_RT    # enable debug/trace messages from library
47
48 ifdef DETACH_ON_THE_FLY
49 CFLAGS += -DDETACH_ON_THE_FLY
50 SRCS += ../src/RTsigill-x86.S
51 endif
52
53 # Include the module-specific Makefile, which defines everything about
54 # the module that is common across architectures.
55
56 include ../make.module.tmpl
57
58 # 32-bit runtime library
59 ASM_SRCS_32  = ../src/RTspace.S ../src/RTtlsgetaddr-x86.S
60
61 TARGET_32_SO = libdyninstAPI_RT_m32.so
62 XTARGET_32   = $(basename $(basename $(TARGET_32_SO)))
63 VOUCHER_32   = V_$(XTARGET_32)
64 OBJS_32      = $(patsubst %.c, %_m32.o, $(filter %.c,$(notdir $(SRCS))))
65 ASM_OBJS_32  = $(patsubst %.S, %_m32.o, $(filter %.S,$(notdir $(ASM_SRCS_32))))
66 CFLAGS_32    = $(subst -DMUTATEE64,-DMUTATEE_32,$(CFLAGS))
67 LDFLAGS_32   = $(LDFLAGS)
68 LIBS_32      = -L/usr/lib $(LIBS)
69
70
71 $(OBJS_32): %_m32.o: ../src/%.c
72         @echo "Compiling $< (32-bit)"
73         $(HIDE_COMP)$(CC) $(subst -m64,-m32,$(CFLAGS_32)) -c $< -o $@
74 $(ASM_OBJS_32): %_m32.o: ../src/%.S
75         @echo "Compiling $< (32-bit)"
76         $(HIDE_COMP)$(CC) $(subst -m64,-m32,$(CFLAGS_32)) -c $< -o $@
77 $(VOUCHER_32):
78         @echo Updating build voucher information: $(VOUCHER_32)
79         $(HIDE_COMP)$(BUILDSTAMP) $(BUILD_ID) $(XTARGET)
80         $(HIDE_COMP)$(MODCC) -m32 -c $(VOUCHER).c -o $(VOUCHER_32).o
81 $(TARGET_32_SO): $(OBJS_32) $(ASM_OBJS_32)
82         $(HIDE_COMP)$(RM) $(TARGET_32_SO)
83         $(HIDE_COMP)$(MAKE) $(VOUCHER_32)
84         $(HIDE_COMP)$(LD) $(subst -m64,-m32,$(LDFLAGS_32)) -o $(TARGET_32_SO) $(VOUCHER_32).o $(OBJS_32) $(ASM_OBJS_32) $(LIBS_32)
85 RTspace.o: ../src/RTspace.S
86         @echo "Compiling RTspace"
87         $(HIDE_COMP)$(CC) $(CFLAGS) -c $< -o $@
88
89 RELEASE_NUM ?= $(RELEASE_MAJOR).$(RELEASE_MINOR)
90
91 $(DEST)/$(TARGET_32_SO): $(TARGET_32_SO)
92         -$(INSTALL) $(TARGET_32_SO) $(DEST)/$(TARGET_32_SO).$(RELEASE_NUM)
93         -$(LN) -f $(TARGET_32_SO).$(RELEASE_NUM) $(DEST)/$(TARGET_32_SO)
94
95 # 32-bit static runtime library
96
97 STATIC_TARGET_32 = libdyninstAPI_RT_m32.a
98 STATIC_OBJS_32      = $(patsubst %.c, %_nopic_m32.o, $(filter %.c,$(notdir $(SRCS))))
99 STATIC_ASM_OBJS_32  = $(patsubst %.S, %_nopic_m32.o, $(filter %.S,$(notdir $(ASM_SRCS_32))))
100 STATIC_CFLAGS_32    =  $(subst -DMUTATEE64,-DMUTATEE_32,$(STATIC_CFLAGS))
101
102 $(STATIC_OBJS_32): %_nopic_m32.o: ../src/%.c
103         @echo "Compiling $< (static 32-bit)"
104         $(HIDE_COMP)$(CC) $(subst -m64,-m32,$(STATIC_CFLAGS_32)) -c $< -o $@
105 $(STATIC_ASM_OBJS_32): %_nopic_m32.o: ../src/%.S
106         @echo "Compiling $< (static 32-bit)"
107         $(HIDE_COMP)$(CC) $(subst -m64,-m32,$(STATIC_CFLAGS_32)) -c $< -o $@
108 $(STATIC_TARGET_32): $(STATIC_OBJS_32) $(STATIC_ASM_OBJS_32)
109         $(HIDE_COMP)$(RM) $(STATIC_TARGET_32)
110         $(HIDE_COMP)$(AR) rcs $(STATIC_TARGET_32) $(STATIC_OBJS_32) $(STATIC_ASM_OBJS_32)
111
112 $(DEST)/$(STATIC_TARGET_32): $(STATIC_TARGET_32)
113         -$(INSTALL) $(STATIC_TARGET_32) $(DEST)
114
115 ifndef SKIP_BUILD_RTLIB_32
116 install: $(DEST)/$(TARGET_32_SO) $(DEST)/$(STATIC_TARGET_32)
117 all: $(TARGET_32_SO) $(STATIC_TARGET_32)
118 endif
119
120 # Include the "standard program template".  This defines all the
121 # common targets like "clean", "install", etc.
122
123 include ../../make.library.tmpl
124
125 # This is just a dirty hack to make the build process complete
126 # smoothly.  It should be removed when we can correctly build
127 # a 64-bit runtime library.
128 #$(TARGET3_SO):
129 #       touch $(TARGET3_SO)