-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
80 lines (59 loc) · 2.2 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
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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: lpaulo-m <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/03/25 21:53:44 by lpaulo-m #+# #+# #
# Updated: 2021/03/26 02:11:25 by lpaulo-m ### ########.fr #
# #
# **************************************************************************** #
NAME = get_next_line.a
OBJECTS_PATH = ./objects
SOURCES_PATH = ./sources
INCLUDES_PATH = ./includes
CC = gcc
CC_FLAGS = -Wall -Wextra -Werror
CC_DEBUG_FLAGS = -g
SAFE_MAKEDIR = mkdir -p
ARCHIVE_AND_INDEX = ar -rcs
REMOVE = /bin/rm -f
REMOVE_RECURSIVE = /bin/rm -rf
HEADER_FILE = get_next_line.h
HEADER = $(addprefix $(INCLUDES_PATH)/,$(HEADER_FILE))
SOURCE_FILES = get_next_line.c get_next_line_utils.c
SOURCES = $(addprefix $(SOURCES_PATH)/,$(SOURCE_FILES))
OBJECTS = $(addprefix $(OBJECTS_PATH)/,$(subst .c,.o,$(SOURCE_FILES)))
EXAMPLE_MAIN = examples/example.c
EXECUTE_EXAMPLE = ./a.out
EXAMPLE_GARBAGE = a.out a.out.dSYM
all: $(NAME)
$(NAME): $(OBJECTS)
$(ARCHIVE_AND_INDEX) $(NAME) $(OBJECTS)
$(OBJECTS_PATH)/%.o: $(SOURCES_PATH)/%.c
$(SAFE_MAKEDIR) $(OBJECTS_PATH)
$(CC) $(CC_FLAGS) -D $d -I $(INCLUDES_PATH) -o $@ -c $<
example: $(NAME)
$(CC) $(CC_DEBUG_FLAGS) -D $d -I $(INCLUDES_PATH) $(EXAMPLE_MAIN) $(NAME)
$(EXECUTE_EXAMPLE)
clean:
$(REMOVE) $(OBJECTS)
fclean: clean
$(REMOVE) $(NAME)
example_clean: fclean
$(REMOVE_RECURSIVE) $(EXAMPLE_GARBAGE)
re: fclean all
norm:
norminette $(INCLUDES_PATH)
@echo ----------------------
norminette $(SOURCES_PATH)
git:
git add -A
git commit -m "update"
git push
gitm:
git add -A
git commit -m $m
git push
.PHONY: all example re clean fclean example_clean norme git gitm