-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
52 lines (37 loc) · 1.05 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
NAME = tests_lvector
CC = gcc
SRCS = tests/vector.c
OBJS = $(SRCS:.c=.o)
RM = rm -f
CFLAGS += -Werror -Wall -Wextra -g3
CFLAGS += -I./include
LDFLAGS += -lcriterion
GREEN = `tput setaf 2`
RED = `tput setaf 1`
YELLOW = `tput setaf 3`
NO_COLOR = `tput sgr0`
%.o : %.c
@$ $(CC) $(CFLAGS) -c $< -o $@
@echo "$(CC) $(CFLAGS) -c $< -o $@ ["$(GREEN)"OK"$(NO_COLOR)"]"
.SUFFIXES: .o .c
tests_run: $(OBJS)
@$ $(CC) $(OBJS) $(LDFLAGS) -o $(NAME)
@echo "$(CC) $(OBJS) $(LDFLAGS) -o $(NAME) \
["$(GREEN)"LINKING OK"$(NO_COLOR)"]"
./$(NAME)
val_run: $(OBJS)
@$ $(CC) $(OBJS) $(LDFLAGS) -o $(NAME)
@echo "$(CC) $(OBJS) $(LDFLAGS) -o $(NAME) \
["$(GREEN)"LINKING OK"$(NO_COLOR)"]"
valgrind --trace-children=yes -q ./$(NAME)
clean:
$(RM) $(OBJS)
fclean: clean
$(RM) $(NAME)
install:
@cp ./include/lvector.h /usr/local/include 2> /dev/null && \
printf "\033[1m\033[32mLibrary lvector successfully installed !\033[0m\n" || \
printf "\033[1m\033[31mError : try sudo make install\033[0m\n"
static:
@echo not implemented
.PHONY: tests_run val_run clean fclean install