-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
36 lines (25 loc) · 805 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
CC = gcc
CFLAGS = -ggdb -Og -Wall -Wextra
CPPFLAGS = -DDEBUG $(shell pkg-config --cflags libbsd-overlay)
LDLIBS = $(shell pkg-config --libs libbsd-overlay) -Wl,-rpath=.
all: malloc.so test thread-test
%.lo: %.c
$(CC) $(CFLAGS) $(CPPFLAGS) -fPIC -c -o $@ $<
%.so: %.lo
$(CC) -shared $^ -ldl -o $@
debug.lo: debug.c malloc.h
wrappers.lo: wrappers.c malloc.h
malloc.lo: malloc.c malloc.h
malloc.so: debug.lo malloc.lo wrappers.lo
TESTS = $(wildcard tst-*.c)
test: test.o $(TESTS:.c=.o) malloc.so
thread-test: LDLIBS += -lpthread
thread-test: thread-test.o malloc.so
thread-test.o: thread-test.c thread-lran2.h thread-st.h thread-test.h
format:
clang-format -style=file -i *.c *.h
clean:
rm -f test thread-test *.so *.lo *.o *~
.PRECIOUS: %.o
.PHONY: all clean format run
# vim: ts=8 sw=8 noet