-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
70 lines (47 loc) · 1.38 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
##
## EPITECH PROJECT, 2019
## my_ls
## File description:
## Makefile
##
SUCCESS = /bin/echo -e "\x1b[1m\x1b[33m\#\#\x1b[32m $1\x1b[0m"
WARNING = /bin/echo -e "\x1b[1m\x1b[33m\#\#\x1b[33m $1\x1b[0m"
ATTENTION = /bin/echo -e "\x1b[1m\x1b[33m\#\#\x1b[31m $1\x1b[0m"
ERROR = /bin/echo -e "\x1b[1m\x1b[33m\#\#\x1b[31m $1\x1b[0m"
DONE = /bin/echo -e "\x1b[1m\x1b[33m\#\#\x1b[34m $1\x1b[0m"
SRC = main.c
.PHONY: all, fclean, clean, re, library, tests_run
BIN = my_ls
CC = @gcc
INCLUDE_DIR = ./include
CFLAGS = -g -I./include/ -D_GNU_SOURCE -pedantic -O3 -O2 -Wunused
LDFLAGS = -lm
FLAGS = $(CFLAGS) -I$(INCLUDE_DIR) -L./lib -lmy_printf
UT_SRC = $(SRC)
UT_OBJ = $(UT_SRC:.c=.o)
UT_FLAGS = $(CFLAGS) -lcriterion -lgcov --coverage $(FLAGS)
all: library $(BIN)
library:
@$(MAKE) -C ./lib/my_printf/
$(BIN): $(SRC)
@$(CC) -o $(BIN) $(SRC) $(FLAGS) $(LDFLAGS) $(CFLAGS)
@$(call SUCCESS, "The binary has been created correctly.")
clean: clean_lib_obj
@$(RM) *.vgcore
@$(RM) *.gc*
@$(call DONE, "[ DONE 100% ]")
clean_lib:
@$(MAKE) clean_lib -C ./lib/my_printf/
clean_lib_obj:
@$(MAKE) clean -C ./lib/my_printf/
fclean: clean clean_lib
@$(RM) $(BIN)
@$(call SUCCESS, "[ DONE ] All library cleaned.")
re: fclean all
run:
./$(BIN)
valgrind:
valgrind ./$(BIN)
tests_run:
gcc -o $(UT_FLAGS) $(UT_OBJ)
./units