Skip to content

Commit 4a3db94

Browse files
committed
Makefiles vars & colors
1 parent 8dabf33 commit 4a3db94

File tree

7 files changed

+81
-45
lines changed

7 files changed

+81
-45
lines changed

Makefile

+60-32
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,96 @@
1+
# PATH : /
12
NAME = libft.a
23

4+
# FILES
5+
GD = gnl
6+
PD = printfd
7+
MD = minmax
8+
LD = libft
9+
G = $(GD).a
10+
P = libftprintf.a
11+
M = $(MD).a
12+
L = $(LD).a
13+
14+
# COMMANDS
15+
MS = make --silent
16+
MFCLEAN = make --silent fclean -C
17+
18+
# TEXT
19+
RED = \033[1;31m
20+
GREEN = \033[1;32m
21+
YELLOW = \033[1;33m
22+
BLUE = \033[1;34m
23+
MAGENTA = \033[1;35m
24+
CYAN = \033[1;36m
25+
WHITE = \033[1;37m
26+
PURPLE = \033[38;5;105m
27+
PINK = \033[38;5;206m
28+
BOLD = \033[1m
29+
UNDERLINE = \033[4m
30+
RESET = \033[0m
331
UP = \033[1A
432
ERASE = \033[0J
533

634
all: check_libft
735

836
check_libft:
937
@if [ ! -f $(NAME) ]; then \
10-
make --silent making; \
11-
make --silent $(NAME); \
12-
make --silent echo; \
13-
make --silent oclean; \
38+
$(MS) making; \
39+
$(MS) $(NAME); \
40+
$(MS) echo; \
41+
$(MS) oclean; \
1442
fi
1543

1644
$(NAME):
17-
@make --silent -C gnl
18-
@make --silent -C printfd
19-
@make --silent -C minmax
20-
@cp printfd/libftprintf.a $(NAME)
21-
@cp gnl/gnl.a .
22-
@cp minmax/minmax.a .
23-
@ar x gnl.a
24-
@ar x minmax.a
45+
@$(MS) -C $(GD)
46+
@$(MS) -C $(PD)
47+
@$(MS) -C $(MD)
48+
@cp $(PD)/$(P) $(NAME)
49+
@cp $(GD)/$(G) .
50+
@cp $(MD)/$(M) .
51+
@ar x $(G)
52+
@ar x $(M)
2553
@ar rc $(NAME) *.o
2654
@rm *.o
27-
@rm gnl.a
28-
@rm minmax.a
55+
@rm $(G)
56+
@rm $(M)
2957

3058
echo:
31-
@echo "$(UP)$(UP)$(ERASE)\033[1;32mMade QuoicouLibft :)\033[0m"
59+
@echo "$(UP)$(UP)$(ERASE)$(GREEN)Made QuoicouLibft :)$(RESET)"
3260

3361
making:
34-
@echo "\033[1;35m🦑🦑🦑 Making QuoicouLibft... 🦑🦑🦑\033[0m"
62+
@echo "$(GREEN)🦑🦑🦑 Making QuoicouLibft... 🦑🦑🦑$(RESET)"
3563

3664
oclean:
37-
@make --silent fclean -C ./libft
38-
@make --silent fclean -C ./gnl
39-
@make --silent fclean -C ./printfd
40-
@make --silent fclean -C ./minmax
65+
@$(MFCLEAN) $(LD)
66+
@$(MFCLEAN) $(GD)
67+
@$(MFCLEAN) $(PD)
68+
@$(MFCLEAN) $(MD)
4169

4270
clean: clean_o clean_a
43-
@echo "\033[35m🦑🦑🦑 Crampting QuoicouLibft... 🦑🦑🦑\033[0m"
44-
@make --silent fclean -C ./libft
45-
@echo "\033[31m Redlight FIRST LIBFT!\033[0m"
46-
@make --silent fclean -C ./gnl
47-
@echo "$(UP)$(ERASE)\033[31m Redlight GNL!\033[0m"
48-
@make --silent fclean -C ./printfd
49-
@echo "$(UP)$(ERASE)\033[31m Redlight PRINTFs!\033[0m"
50-
@make --silent fclean -C ./minmax
51-
@echo "$(UP)$(ERASE)\033[31m Redlight MINMAX!\033[0m"
71+
@echo "$(BOLD)$(PINK)🦑🦑🦑 Crampting QuoicouLibft... 🦑🦑🦑$(RESET)"
72+
@$(MFCLEAN) $(LD)
73+
@echo "$(PINK) Redlight FIRST LIBFT!$(RESET)"
74+
@$(MFCLEAN) $(GD)
75+
@echo "$(UP)$(ERASE)$(PINK) Redlight GNL!$(RESET)"
76+
@$(MFCLEAN) $(PD)
77+
@echo "$(UP)$(ERASE)$(PINK) Redlight PRINTFs!$(RESET)"
78+
@$(MFCLEAN) $(MD)
79+
@echo "$(UP)$(ERASE)$(PINK) Redlight MINMAX!$(RESET)"
5280

5381
fclean:
5482
@if [ -f $(NAME) ]; then \
55-
make --silent fclean_no_check; \
83+
$(MS) fclean_no_check; \
5684
fi
5785

5886
fclean_no_check: clean
5987
@rm -f $(NAME)
60-
@echo "$(UP)$(UP)$(ERASE)\033[1;31mQuoicouLibft crampted :(\033[0m"
88+
@echo "$(UP)$(UP)$(ERASE)$(BOLD)$(PINK)QuoicouLibft crampted :($(RESET)"
6189

6290
re: fclean all
6391

6492
clean_o:
6593
@rm -f *.o
6694

6795
clean_a:
68-
@rm -f gnl.a libftprintf.a minmax.a
96+
@rm -f $(G) $(P) $(M)

gnl/Makefile

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
# Makefile de mon get_next_line en respectant la norme de 42 (pas de wildcards par exemple)
2-
1+
# PATH : /libft
32
NAME = gnl.a
43

4+
# COMPILATION
5+
CC = cc
6+
FLAGS = -Wall -Wextra -Werror
7+
8+
# FILES
59
SRC = get_next_line.c \
610
get_next_line_utils.c
711
OBJ = $(SRC:.c=.o)
812

9-
CC = cc
10-
FLAGS = -Wall -Wextra -Werror
11-
13+
# TEXT
1214
UP = \033[1A
1315
ERASE = \033[0J
1416

libft/Makefile

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
# PATH : /libft
12
NAME = libft.a
23

4+
# COMPILATION
35
CC = cc
46
CFLAGS = -Wall -Wextra -Werror
57

8+
# FILES
69
SRCS = ft_striteri.c ft_strmapi.c ft_putnbr_fd.c ft_putchar_fd.c \
710
ft_putstr_fd.c ft_putendl_fd.c ft_itoa.c ft_split.c ft_strtrim.c \
811
ft_strjoin.c ft_substr.c ft_calloc.c ft_strdup.c ft_atoi.c \
@@ -11,11 +14,10 @@ SRCS = ft_striteri.c ft_strmapi.c ft_putnbr_fd.c ft_putchar_fd.c \
1114
ft_memcpy.c ft_strchr.c ft_strlen.c ft_strrchr.c ft_isalnum.c \
1215
ft_isdigit.c ft_memmove.c ft_strlcat.c ft_strncmp.c ft_tolower.c \
1316
ft_split_charset.c ft_split_charset_utils.c
14-
OBJS = $(SRCS:.c=.o)
15-
1617
BONUS_SRCS = ft_lstmap_bonus.c ft_lstiter_bonus.c ft_lstclear_bonus.c \
1718
ft_lstdelone_bonus.c ft_lstadd_back_bonus.c ft_lstlast_bonus.c \
1819
ft_lstsize_bonus.c ft_lstadd_front_bonus.c ft_lstnew_bonus.c
20+
OBJS = $(SRCS:.c=.o)
1921
BONUS_OBJS = $(BONUS_SRCS:.c=.o)
2022

2123
all: $(NAME) bonus clean

minmax/Makefile

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
# inspire toi du makefile de gnl (/home/cviegas/Documents/adventofcode/libft/gnl/Makefile)
2-
3-
# Path: libft/minmax/Makefile
1+
# Path: /minmax
42

53
NAME = minmax.a
64

@@ -13,7 +11,7 @@ FLAGS = -Wall -Wextra -Werror
1311
UP = \033[1A
1412
ERASE = \033[0J
1513

16-
all: ccc $(NAME) echo clean
14+
all: ccc $(NAME) echo
1715

1816
$(NAME): $(OBJ)
1917
@ar rc $@ $^

minmax/ft_min_max.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/* By: cviegas <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2023/12/04 16:21:11 by cviegas #+# #+# */
9-
/* Updated: 2023/12/04 17:30:30 by cviegas ### ########.fr */
9+
/* Updated: 2024/02/02 16:58:46 by cviegas ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

minmax/ft_min_max.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
/* By: cviegas <[email protected]> +#+ +:+ +#+ */
77
/* +#+#+#+#+#+ +#+ */
88
/* Created: 2023/12/04 16:31:59 by cviegas #+# #+# */
9-
/* Updated: 2023/12/04 17:07:01 by cviegas ### ########.fr */
9+
/* Updated: 2024/02/02 16:56:51 by cviegas ### ########.fr */
1010
/* */
1111
/* ************************************************************************** */
1212

1313
#ifndef FT_MIN_MAX_H
1414
# define FT_MIN_MAX_H
1515
# include <stdarg.h>
16+
# include <stdio.h>
17+
# include <stdlib.h>
1618
# include <unistd.h>
1719

1820
int ft_bmin(int a, int b);

printfd/Makefile

+4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1+
# PATH : /printfd
12
NAME = libftprintf.a
23

4+
# COMPILATION
35
CC = cc
46
CFLAGS = -Wall -Wextra -Werror
57

8+
# FILES
69
SRCS = ft_printfd.c ft_printf.c ft_putunsigned.c ft_putaddr.c ft_puthexa.c
710
OBJS = $(SRCS:.c=.o)
811

12+
# TEXT
913
UP = \033[1A
1014
ERASE = \033[0J
1115

0 commit comments

Comments
 (0)