-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
48 lines (34 loc) · 837 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
42
43
44
45
46
47
48
CC = gcc
LFLAGS =
FLAGS = -ansi -Wall -Wextra -pedantic
OUT = btree-test
SHARED_OUT = libbtree.so
STATIC_OUT = libbtree.a
SRC :=$(wildcard src/*.c)
OBJ :=$(addprefix obj/,$(notdir $(SRC:.c=.o)))
.PHONY: clean check
test: debug
./$(OUT)
gdb: debug src/btree.h
gdb -q -ex r $(OUT)
debug: DEFS += -g3 -DDEBUG
debug: obj build
build: $(OUT)
static: FLAGS += -fpic
static: $(STATIC_OUT)
shared: FLAGS += -fpic
shared: $(SHARED_OUT)
$(SHARED_OUT): $(OBJ)
$(CC) $(DEFS) $(FLAGS) $(LFLAGS) -shared -o $(SHARED_OUT) $(OBJ)
$(STATIC_OUT): $(OBJ)
ar -rcs -o $(STATIC_OUT) $(OBJ)
$(OUT): $(OBJ)
$(CC) $(DEFS) $(FLAGS) $(LFLAGS) -o $(OUT) $(OBJ)
obj/%.o: src/%.c src/btree.h obj
$(CC) $(DEFS) $(FLAGS) -c -o $@ $<
obj:
mkdir -p $@
check:
cppcheck --enable=all --suppress=unusedFunction src
clean:
rm -rf $(OUT) obj