-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmakefile
42 lines (30 loc) · 1.24 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
LIBDIRS=-Llibunwind-1.3-rc1/src/.libs/
INCDIRS=-Ilibunwind-1.3-rc1/include/
CFLAGS=-std=gnu99 -O2 -fno-omit-frame-pointer -fno-builtin-malloc -ggdb -Wall -fPIC -D_GNU_SOURCE $(LIBDIRS) $(INCDIRS) -Werror=implicit-function-declaration
CFLAGS_TEST=-std=gnu99 -O0 -fno-omit-frame-pointer -ggdb -Wall -fPIC -D_GNU_SOURCE -Werror=implicit-function-declaration
LUNWIND:=https://download-mirror.savannah.gnu.org/releases/libunwind/libunwind-1.3-rc1.tar.gz
CC=gcc
AR=ar
all: libguardrails.a libguardrails.so.0.0 test
libguardrails.a: GuardRails.o DelayFree.o
rm -f $@
$(AR) crv $@ $?
libguardrails.so.0.0: GuardRails.o DelayFree.o
$(CC) -shared -Wl,-soname,libguardrails.so.0 -o $@ \
$(CFLAGS) $? -lpthread -lc -l:libunwind.a -l:libunwind-x86_64.a
GuardRails.o: GuardRails.c GuardRails.h
$(CC) $(CFLAGS) -c $< -o $@
DelayFree.o: DelayFree.c GuardRails.h
$(CC) $(CFLAGS) -c $< -o $@
test: test.o
$(CC) -o $@ test.o
test.o: test.c
$(CC) $(CFLAGS_TEST) -c $< -o $@
clean:
rm -f test *.o libguardrails.a libguardrails.so.0.0
deps:
# See http://download.savannah.nongnu.org/releases/libunwind/
curl $(LUNWIND) | tar -zxf -
cd libunwind-1.3-rc1 && ./configure --with-pic && patch -p2 < ../libunwindcfg.patch && make
clean-deps:
rm -rf libunwind-1.3-rc1