-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
68 lines (49 loc) · 1.74 KB
/
Makefile
File metadata and controls
68 lines (49 loc) · 1.74 KB
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
CC=cc
CFLAGS=-Wall -Wextra -Werror -O3 -march=native -ftree-vectorize -funroll-loops
FLAGS_SPEED=
PROFILE_FLAGS=
INCLUDES=-I./includes
SOURCES= main.c utils/utils1.c init.c utils/utils2.c forks.c utils/sync_utils.c utils/sleep.c threading.c \
calculate_iteration_time.c debug.c my_print.c main_loop.c
OBJECTS= $(SOURCES:.c=.o)
NAME=p
NAME_PROFILE=$(NAME)_profile
tool=drd
.PHONY: all clean fclean re clean2
all:$(NAME)
$(NAME): build clean2
build: $(OBJECTS)
@$(CC) $(INCLUDES) $^ -o $(NAME) $(CFLAGS) $(FLAGS_SPEED)
@echo "\033[32mBuild complete.\033[0m"
nWWW:
@$(CC) $(INCLUDES) $(SOURCES) $^ -o $(NAME) $(FLAGS_SPEED)
@echo "\033[32mBuild complete.\033[0m"
fsanitize_adress: fclean
@$(CC) $(INCLUDES) $(CFLAGS) $(FLAGS_SPEED) -g $(SOURCES) -o $(NAME) -fsanitize=address
@echo "\033[32mBuild complete.\033[0m"
fsanitize_thread: fclean
@$(CC) $(INCLUDES) $(CFLAGS) $(FLAGS_SPEED) -g $(SOURCES) -o $(NAME) -fsanitize=thread
@echo "\033[32mBuild complete.\033[0m"
prof_mac:
clang -fprofile-instr-generate -fcoverage-mapping $(INCLUDES) $(SOURCES) -o $(NAME)_profile
profile: PROFILE_FLAGS=-pg -g
profile: fclean
$(CC) $(INCLUDES) $(CFLAGS) $(FLAGS_SPEED) $(SOURCES) -o $(NAME_PROFILE) $(PROFILE_FLAGS)
@echo "\033[32mBuild complete.\033[0m"
perf: fclean
perf record @$(CC) $(CFLAGS) $(FLAGS_SPEED) $(INCLUDES) $(SOURCES) -o $(NAME)_perf
%.o: %.c
@$(CC) $(CFLAGS) $(FLAGS_SPEED) $(PROFILE_FLAGS) $(INCLUDES) -o $@ -c $^
clean:
@rm -f $(OBJECTS)
@echo "\033[33mObject files removed.\033[0m"
fclean: clean
@rm -f $(NAME) $(NAME_PROFILE) gmon.out analysis.txt perf.data a.out
@echo "\033[33mExecutable removed.\033[0m"
re: fclean all
clean2:
@rm -f $(OBJECTS)
@echo "\033[33mObject files removed.\033[0m"
norm:
norminette $(SOURCES)
#includes/philo.h