-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
63 lines (47 loc) · 1.17 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
CXX = gcc -g
INSTALL_DIR = /usr/local
MALLOCAR = supermalloc.a
FORKSCAN = libforkscan.so
TARGETS = $(FORKSCAN)
FORKSCAN_SRC = \
queue.c \
env.c \
wrappers.c \
alloc.c \
util.c \
buffer.c \
thread.c \
proc.c \
forkscan.c \
child.c \
frontend.c \
sleep.c
FORKSCAN_OBJ = $(FORKSCAN_SRC:.c=.o)
# The -fno-zero-initialized-in-bss flag appears to be busted.
#CFLAGS = -fno-zero-initialized-in-bss
CFLAGS := -O3
#CFLAGS += -DTIMING
ifndef DEBUG
CFLAGS := $(CFLAGS) -DNDEBUG
endif
LINKMALLOC = -L. -l:$(MALLOCAR)
LDFLAGS = -ldl -pthread -Wl,-z,defs
all: $(TARGETS)
debug:
DEBUG=1 make all
$(FORKSCAN): $(FORKSCAN_OBJ) | $(MALLOCAR)
$(CXX) $(CFLAGS) -shared -Wl,-soname,$@ -o $@ $^ $(LINKMALLOC) $(LDFLAGS)
$(INSTALL_DIR)/lib/$(FORKSCAN): $(FORKSCAN)
cp $< $@
$(INSTALL_DIR)/include/forkscan.h: include/forkscan.h
cp $< $@
$(INSTALL_DIR)/lib/def:
mkdir -p $@
$(INSTALL_DIR)/lib/def/forkscan.defi: include/forkscan.defi $(INSTALL_DIR)/lib/def
cp $< $@
install: $(INSTALL_DIR)/lib/$(FORKSCAN) $(INSTALL_DIR)/include/forkscan.h $(INSTALL_DIR)/lib/def/forkscan.defi
ldconfig
clean:
rm -f *.o $(TARGETS) core
%.o: %.c
$(CXX) $(CFLAGS) -o $@ -Wall -fPIC -c -ldl $<