-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
59 lines (46 loc) · 1.68 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
# **************************************************************************** #
# #
# ::: :::::::: #
# Makefile :+: :+: :+: #
# +:+ +:+ +:+ #
# By: wbraeckm <[email protected]> +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2018/06/12 08:11:26 by wbraeckm #+# #+# #
# Updated: 2018/09/14 15:02:18 by wbraeckm ### ########.fr #
# #
# **************************************************************************** #
NAME = libftprintf.a
CC = gcc
FLAGS = -O3 -Wall -Wextra -Werror
INCLUDES = includes/
SRCSFOLDER = srcs
OBJFOLDER = obj
ITEMS = $(shell find srcs -type f | grep -E "\.c$$" | sed 's/srcs//g')
SRCS = $(addprefix $(SRCSFOLDER), $(ITEMS))
OBJ = $(addprefix $(OBJFOLDER), $(ITEMS:.c=.o))
SRCSUBS = $(shell find ./srcs -type d)
OBJSUBS = $(SRCSUBS:./srcs%=./obj%)
ccred = "\033[0;91m"
ccgreen = "\033[0;92m"
ccmagenta = "\033[0;96m"
all: $(NAME)
$(OBJFOLDER)/%.o:$(SRCSFOLDER)/%.c
@printf $(ccgreen)
$(CC) $(FLAGS) -o $@ -c $< -I $(INCLUDES)
$(OBJSUBS):
@mkdir $@
$(NAME): $(OBJSUBS) $(OBJ)
@printf $(ccmagenta)
@make compile
compile:
ar rc $(NAME) $(OBJ)
ranlib $(NAME)
clean:
@printf $(ccred)
/bin/rm -rf obj/
fclean: clean
/bin/rm -f $(NAME)
re: fclean all
norm:
@norminette $(SRCS)
.PHONY: norm clean fclean re