-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (56 loc) · 2.24 KB
/
Makefile
File metadata and controls
79 lines (56 loc) · 2.24 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: lgasc <marvin@42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2024/05/08 18:19:19 by lgasc #+# #+# #
# Updated: 2024/07/18 06:29:48 by lgasc ### ########.fr #
# #
# **************************************************************************** #
NAME = minishell
SOURCES = $(NAME).c parsing.c double_quote.c
LIBFT = libft/libft.a
LIB_ARCHIVES = $(LIBFT)
OBJECTS = $(SOURCES:.c=.o) $(LIB_ARCHIVES)
CFLAGS += -Wall -Wmissing-noreturn -Werror \
-Wnull-dereference -Wstrict-overflow=5 -Wpedantic \
-Wattributes -Wmissing-format-attribute -Wnonnull \
-Wextra #-Wsuggest-attribute=returns_nonnull
ifeq ($(CC), gcc)
CFLAGS += -Wduplicated-cond -Wsuggest-attribute=const \
-Wsuggest-attribute=cold -Wsuggest-attribute=pure \
-Wduplicated-branches -Wsuggest-attribute=format \
-Wattribute-alias=2 -Wsuggest-attribute=noreturn \
-Wsuggest-attribute=malloc -Wstringop-overflow=4
else ifeq ($(CC), clang)
CFLAGS += -Wproperty-attribute-mismatch
endif
LDLIBS += -lreadline
.PHONY: all re clean fclean debug test
all: $(NAME)
$(NAME): $(OBJECTS)
$(CC) $(OBJECTS) $(LDLIBS) --output $(NAME)
norminette
-grep 'TODO\|FIXME\|XXX\|?\|!!\|DEPREC\w*\|[Dd]eprec\w*' -r .
clean:
$(MAKE) -C $(dir $(LIBFT)) fclean
for O in $(OBJECTS); \
do if [ -f $$O ]; \
then rm $$O; \
fi done
fclean: clean
if [ -f $(NAME) ]; \
then rm $(NAME); \
fi
re: fclean all
$(LIBFT):
$(MAKE) -C $(dir $@) #bonus
# Use `CC=...` instead.
#test: $(OBJECTS)
# - clang $(CFLAGS) $(OBJECTS) $(LDLIBS)
# - gcc $(CFLAGS) $(OBJECTS) $(LDLIBS)
# $(CC) $(CFLAGS) $(OBJECTS) $(LDLIBS)
#$(SOURCES:.c=.o): $@
# echo '@$@ <$< ?$? ^$^'