-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (33 loc) · 928 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
49
NAME = ft_traceroute
SOURCE_FOLDER = ./src
SOURCES = ft_traceroute.c \
parse.c \
network.c \
icmp.c \
utils.c
OBJECT_FOLDER = ./obj
OBJECTS = $(SOURCES:%.c=$(OBJECT_FOLDER)/%.o)
INCLUDE_FOLDER = ./include
INCLUDES = types.h
COMPILER = gcc
COMPILER_FLAGS = -I$(INCLUDE_FOLDER)
COMPILER_FLAGS += -Wall -Wextra -Werror -Wno-implicit-fallthrough
COMPILER_FLAGS += -g3
FLAGS = google.com
all: $(NAME)
$(OBJECT_FOLDER):
mkdir -p $@
$(OBJECT_FOLDER)/%.o: $(SOURCE_FOLDER)/%.c $(INCLUDES:%.h=$(INCLUDE_FOLDER)/%.h)
$(COMPILER) $(COMPILER_FLAGS) -c $< -o $@
$(NAME): $(OBJECT_FOLDER) $(OBJECTS)
$(COMPILER) -o $@ $(OBJECTS)
clean:
rm -rf $(OBJECT_FOLDER)
fclean: clean
rm -rf $(NAME)
re: fclean all
run: $(NAME)
sudo ./$(NAME) $(FLAGS)
valgrind:
valgrind --leak-check=full --show-reachable=yes make run
.PHONY: all clean fclean re run