-
Notifications
You must be signed in to change notification settings - Fork 7
/
Makefile
42 lines (29 loc) · 863 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
CXX = gcc -g
INSTALL_DIR = /usr/local
THREADSCAN = libthreadscan.so
TARGETS = $(THREADSCAN)
THREADSCAN_SRC = queue.c env.c wrappers.c alloc.c util.c thread.c \
proc.c threadscan.c
THREADSCAN_OBJ = $(THREADSCAN_SRC:.c=.o)
# The -fno-zero-initialized-in-bss flag appears to be busted.
#CFLAGS = -fno-zero-initialized-in-bss
CFLAGS := -O2
ifndef DEBUG
CFLAGS := $(CFLAGS) -DNDEBUG
endif
LDFLAGS = -ldl -pthread
all: $(TARGETS)
debug:
DEBUG=1 make all
$(THREADSCAN): $(THREADSCAN_OBJ)
$(CXX) $(CFLAGS) -shared -Wl,-soname,$@ -o $@ $^ $(LDFLAGS)
$(INSTALL_DIR)/lib/$(THREADSCAN): $(THREADSCAN)
cp $< $@
$(INSTALL_DIR)/include/threadscan.h: include/threadscan.h
cp $< $@
install: $(INSTALL_DIR)/lib/$(THREADSCAN) $(INSTALL_DIR)/include/threadscan.h
ldconfig
clean:
rm -f *.o $(TARGETS) core
%.o: %.c
$(CXX) $(CFLAGS) -o $@ -Wall -fPIC -c -ldl $<