-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
143 lines (124 loc) · 5.4 KB
/
Makefile
File metadata and controls
143 lines (124 loc) · 5.4 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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
# **************************************************************************** #make
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2023/11/12 11:05:05 by rparodi #+# #+# #
# Updated: 2024/10/23 14:49:04 by maiboyer ### ########.fr #
# #
# **************************************************************************** #
# Objdir
BUILD_DIR = $(shell realpath ./build)
BASE_PATH = $(shell pwd)
# Colors
GREEN = \033[32m
CYAN = \033[36m
GREY = \033[0;90m
RED = \033[0;31m
GOLD = \033[38;5;220m
END = \033[0m
BOLD = \033[1m
ITALIC = \033[3m
UNDERLINE = \033[4m
# Rules
SRC_DIR = ./sources
GEN_DIR = ./output
NAME = minishell
# PMAKE_DISABLE =
PMAKE =
ifndef PMAKE_DISABLE
ifeq ($(shell uname), Linux)
PMAKE = -j$(shell grep -c ^processor /proc/cpuinfo)
#CFLAGS_ADDITIONAL += -DPRINT_BACKTRACE
endif
ifeq ($(shell uname), Darwin)
PMAKE = -j$(shell sysctl -n hw.ncpu)
#CFLAGS_ADDITIONAL += -DNVALGRIND
endif
endif
CFLAGS_ADDITIONAL ?=
CFLAGS_ADDITIONAL += -DNVALGRIND
# TODO: REMOVE THIS WHEN FINISHING THIS:
# CFLAGS_ADDITIONAL += -fsanitize=memory -fno-omit-frame-pointer -fsanitize-memory-track-origins #-fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--allow-multiple
# CFLAGS_ADDITIONAL += -O0
# CFLAGS_ADDITIONAL += -Wno-cpp -Wno-type-limits
CFLAGS_ADDITIONAL += -gcolumn-info -g3 -fno-builtin
# CFLAGS_ADDITIONAL += '-DERROR=((void)printf("ERROR HERE: " __FILE__ ":%d in %s\n", __LINE__, __func__), 1)'
# CFLAGS_ADDITIONAL += -O2
# CFLAGS_ADDITIONAL += -fuse-ld=gold -Wl,--print-symbol-counts -Wl,/tmp/symbols_count.log
# CFLAGS_ADDITIONAL += -fuse-ld=lld -ffunction-sections -fdata-sections -Wl,--gc-sections -Wl,-O3
# CFLAGS_ADDITIONAL += -I$(shell realpath ./includes) -I$(shell realpath ./output/include)
export CFLAGS_ADDITIONAL
export CC
export BASE_PATH
export BUILD_DIR
# All (make all)
all:
@$(MAKE) --no-print-directory header
@$(MAKE) --no-print-directory -f ./Minishell.mk $(PMAKE)
@$(MAKE) --no-print-directory footer
bonus:
@$(MAKE) --no-print-directory header
@$(MAKE) --no-print-directory -f ./Minishell.mk $(PMAKE) bonus
@$(MAKE) --no-print-directory footer
# Header
header:
@clear
@echo -e ''
@echo -e '$(GOLD) ******* ****** ******* $(END)'
@echo -e '$(GOLD) ****** *** ******* $(END)'
@echo -e '$(GOLD) ******* * ******* $(END)'
@echo -e '$(GOLD) ****** ******* $(END)'
@echo -e '$(GOLD) ******* ******* $(END)'
@echo -e '$(GOLD) ******************* ******* * $(END)'
@echo -e '$(GOLD) ******************* ******* *** $(END)'
@echo -e '$(GOLD) ****** ******* ****** $(END)'
@echo -e '$(GOLD) ****** $(END)'
@echo -e '$(GOLD) ****** $(END)'
@echo -e '$(GREY) Made by maiboyerlpb x rparodi$(END)'
# Footer
footer:
@echo -e '$(GOLD) _ $(END)'
@echo -e '$(GOLD) | \ $(END)'
@echo -e '$(GOLD) | | $(END)'
@echo -e '$(GOLD) | | $(END)'
@echo -e '$(GOLD) |\ $(CYAN)$(BOLD)$(UNDERLINE)shcat$(END)$(GOLD) | | $(END)'
@echo -e '$(GOLD) /, ~\ / / $(END)'
@echo -e '$(GOLD) X `-.....-------./ / $(END)'
@echo -e '$(GOLD) ~-. ~ ~ | $(END)'
@echo -e '$(GOLD) \ / | $(END)'
@echo -e '$(GOLD) \ /_ ___\ / $(END)'
@echo -e '$(GOLD) | /\ ~~~~~ \ | $(END)'
@echo -e '$(GOLD) | | \ || | $(END)'
@echo -e '$(GOLD) | |\ \ || ) $(END)'
@echo -e '$(GOLD) (_/ (_/ ((_/ $(END)'
@echo -e ' $(GREY)The compilation is $(END)$(GOLD)finished$(END)'
@echo -e ' $(GREY)Have a good $(END)$(GOLD)correction$(END)'
# Clean (make clean)
clean:
@echo -e '$(GREY) Removing $(END)$(RED)Objects$(END)'
@echo -e '$(GREY) Removing $(END)$(RED)Objects Folder$(END)'
@$(RM) -r $(BUILD_DIR)
# Clean (make fclean)
fclean: clean
@echo -e '$(GREY) Removing $(END)$(RED)Program$(END)'
@$(RM) $(NAME)
@echo ""
# Restart (make re)
re: header
@$(MAKE) --no-print-directory fclean
@$(MAKE) --no-print-directory all
tokei:
/bin/sh -c 'tokei -tC,C\ Header -e tree-sitter-sh'
build_filelist:
@$(MAKE) --no-print-directory -C ./stdme/ build_filelist
@$(MAKE) --no-print-directory -C ./allocator/ build_filelist
@$(MAKE) --no-print-directory -C ./ast/ build_filelist
@$(MAKE) --no-print-directory -C ./exec/ build_filelist
@$(MAKE) --no-print-directory -C ./line/ build_filelist
@$(MAKE) --no-print-directory -C ./parser/ build_filelist
@$(MAKE) --no-print-directory -f ./Minishell.mk build_filelist
# phony
.PHONY: all bonus clean fclean re header footer build_filelist