-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
120 lines (96 loc) · 3.46 KB
/
Makefile
File metadata and controls
120 lines (96 loc) · 3.46 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: amalsago <amalsago@student.42.fr> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2019/02/03 12:02:20 by amalsago #+# #+# #
# Updated: 2019/05/22 13:30:21 by amalsago ### ########.fr #
# #
# **************************************************************************** #
# **************************************************************************** #
# General
NAME = libftprintf.a
LIBNAME = libft.a
# **************************************************************************** #
# GNU Compiler Collection
GCC = /usr/bin/clang
WOPT = -Wall -Wextra -Werror
OOPT = -O2
IOPT = -I $(INCDIR)
# **************************************************************************** #
# System commands
AR = /usr/bin/ar -rc
MAKE = /usr/bin/make -C
RANLIB = /usr/bin/ranlib
NORMINETTE = /usr/bin/norminette
MKDIR = /bin/mkdir -p
RM = /bin/rm -rf
# **************************************************************************** #
# Directories of source and object files
LIBDIR = ./libft
SRCDIR = ./sources
OBJDIR = ./objects
INCDIR = ./includes
# **************************************************************************** #
# List of source files
SRCNAME = ft_printf.c \
parsing.c \
tools/buffer.c \
tools/initialization.c \
tools/get_si.c \
tools/get_ui.c \
tools/get_f.c \
specs/wildcard.c \
specs/set_specs.c \
specs/set_flags.c \
specs/set_length.c \
specs/apply_specs.c \
types/type_b.c \
types/type_c.c \
types/type_d.c \
types/type_f.c \
types/type_o.c \
types/type_p.c \
types/type_s.c \
types/type_u.c \
types/type_x.c \
types/unknown.c \
types/percent.c
# **************************************************************************** #
# Automatic variables where are listed the names of sources and objects files
SRC = $(addprefix $(SRCDIR)/, $(SRCNAME))
OBJ = $(addprefix $(OBJDIR)/, $(SRCNAME:.c=.o))
LFT = $(addprefix $(LIBDIR)/, $(LIBNAME))
LFTOBJ = $(LIBDIR)/objects/*.o
# **************************************************************************** #
# Extra
CLEAR = "\033[K"
EOC = "\033[0;0m"
GREEN = "\033[0;32m"
CR = "\r"$(CLEAR)
BASENAME = `basename $(PWD)`
# **************************************************************************** #
# Rules
all: $(NAME) $(LFT)
$(NAME): $(LFT) $(OBJ)
$(AR) $(NAME) $(OBJ) $(LFTOBJ)
$(RANLIB) $(NAME)
printf $(CR)$(GREEN)"✓ $(NAME) is created\n"$(EOC)
$(OBJDIR)/%.o: $(SRCDIR)/%.c
-@$(MKDIR) $(OBJDIR)/{types,tools,specs}
$(GCC) $(WOPT) $(OOPT) $(IOPT) -c $< -o $@
printf $(CR)"[ $(BASENAME)/%s ]"$(CLEAR) $@
$(LFT):
$(MAKE) $(LIBDIR)
clean:
$(RM) $(OBJ) $(OBJDIR)
$(MAKE) $(LIBDIR) clean
fclean: clean
$(RM) $(NAME)
$(MAKE) $(LIBDIR) fclean
re: fclean all
norm:
$(NORMINETTE) $(SRCDIR) $(INCDIR) $(LIBDIR)/sources
.PHONY: all clean fclean re norm