-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
43 lines (29 loc) · 849 Bytes
/
Makefile
File metadata and controls
43 lines (29 loc) · 849 Bytes
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
CFLAGS = -Wall -Wextra -Wpedantic -O3 -std=c89 -Iinclude/ -fPIC
TEST_FLAGS = -fsanitize=address,undefined
OBJS = dngr_domain.o dngr_list.o
STATIC_LIB = libdanger.a
SHARED_LIB = libdanger.so
TESTS = tests/test_list
EXAMPLES = examples/thread_prog
.PHONY: all shared static clean tests examples
%.o: src/%.c
$(CC) $(CFLAGS) -c -o $@ $^
all: static shared
static: $(STATIC_LIB)
shared: $(SHARED_LIB)
$(STATIC_LIB): $(OBJS)
ar rcs $(STATIC_LIB) $?
$(SHARED_LIB): $(OBJS)
$(CC) $(CFLAGS) -o $@ $? -shared
tests: $(TESTS)
./tests/test_list
tests/test_list: tests/test_list.c $(STATIC_LIB)
$(CC) $^ -o $@ $(CFLAGS) $(TEST_FLAGS)
examples: $(EXAMPLES)
examples/thread_prog: examples/thread_prog.c $(STATIC_LIB)
$(CC) $^ -o $@ $(CFLAGS) $(TEST_FLAGS) -pthread
clean:
rm -f $(OBJS)
rm -f $(STATIC_LIB)
rm -f $(TESTS)
rm -f $(EXAMPLES)