-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
52 lines (41 loc) · 1.13 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
CC ?= gcc
CFLAGS ?= -Ofast -Wextra -Wall
LDLIBS ?= -ltps -lSDL2 -lSDL2_ttf -lm
EXEC = main
INCLUDE_PATH ?= ./include
SRC_PATH = ./src
OBJ_PATH = ./obj
BIN_PATH = ./bin
TESTS_PATH = ./tests
SOURCES := $(wildcard $(SRC_PATH)/*.c)
INCLUDES := $(wildcard $(INCLUDE_PATH)/*.h)
OBJECTS := $(SOURCES:$(SRC_PATH)/%.c=$(OBJ_PATH)/%.o)
# Colors for echo
GREEN='\033[32m'
L_BLUE='\033[35m'
NC='\033[0m'
all: $(BIN_PATH)/$(EXEC)
$(BIN_PATH)/$(EXEC): $(OBJECTS)
mkdir -p $(BIN_PATH)
$(CC) -o $@ $^ $(CFLAGS) $(LDLIBS)
@echo "Linking complete!"
$(OBJECTS): $(OBJ_PATH)/%.o : $(SRC_PATH)/%.c
mkdir -p $(OBJ_PATH)
$(CC) -o $@ -c $< $(CFLAGS) -I$(INCLUDE_PATH)
doc:
doxygen Doxyfile
@echo -e ${GREEN}Documentation generated in ./docs/html/index.html${NC}
test:
make -C $(TESTS_PATH) clean
make -C $(TESTS_PATH) all
@echo -e ${L_BLUE}Going into $(TESTS_PATH) for running tests${NC}
@cd $(TESTS_PATH) && ./tests
@echo -e ${L_BLUE}Going back to root directory${NC}
@cd ..
cov:
make -C $(TESTS_PATH) cov
@echo -e ${GREEN}Coverage report generated in $(TESTS_PATH)/rapport/index.html${NC}
.PHONY: clean
clean:
rm -fr $(OBJ_PATH)
rm -fr $(BIN_PATH)