From 3b2e60240d080b77c9b0bbd762c041f8be4a14a3 Mon Sep 17 00:00:00 2001 From: narnaud Date: Tue, 24 May 2022 09:34:30 +0200 Subject: [PATCH] Better Makefile --- Makefile | 37 ++++++++++++++++++++----------------- libft/Makefile | 20 +++++++++++--------- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 9f0836e..aac777d 100755 --- a/Makefile +++ b/Makefile @@ -14,31 +14,34 @@ ifeq ($(UNAME_S), Darwin) LIB = -L ~/.brew/lib -lreadline -L ~/.brew/lib -lhistory -L. -lft endif +all: $(NAME) + +$(VERBOSE).SILENT: + $(NAME): $(LIBFT) $(OBJS) - @echo "Making Minishell." - @gcc -g ${OBJS} ${LIB} -o ${NAME} - @echo "Done." + echo Making Minishell... + gcc -g ${OBJS} ${LIB} -o ${NAME} + echo ✅ $(LIBFT): - @${MAKE} -C ./libft - @cp ./libft/libft.a . + ${MAKE} -C ./libft + cp ./libft/libft.a . -all: $(NAME) %.o: %.c - @gcc -Werror -Wextra -Wall -g -c $< ${READLINE_INC} + gcc -Werror -Wextra -Wall -g -c $< ${READLINE_INC} clean: - @echo "Cleaning objects." - @rm -rf ${OBJS} - @echo "Done." - -fclean: clean - @${MAKE} -C ./libft fclean - @rm -rf libft.a - @echo "Cleaning binary." - @rm -rf ${NAME} - @echo "Done." + echo Cleaning objects... + rm -rf ${OBJS} + echo ✅ + +fclean: clean + ${MAKE} -C ./libft fclean + rm -rf libft.a + echo Cleaning binary... + rm -rf ${NAME} + echo ✅ re: fclean all diff --git a/libft/Makefile b/libft/Makefile index e3f3af6..dcb4594 100755 --- a/libft/Makefile +++ b/libft/Makefile @@ -36,24 +36,26 @@ RM = rm -rf CFLAGS = -Wall -Wextra -Werror +$(VERBOSE).SILENT: + .c.o: - @${CC} ${CFLAGS} -c $< -o ${<:.c=.o} + ${CC} ${CFLAGS} -c $< -o ${<:.c=.o} all : $(NAME) $(NAME): $(OBJS) - @echo "Making libft." - @${AR} ${NAME} ${OBJS} - @echo "Done." + echo Making libft... + ${AR} ${NAME} ${OBJS} + echo ✅ clean: - @echo "Cleaning libft." - @${RM} ${OBJS} - @${RM} ${OBJS_BONUS} - @echo "Done." + echo Cleaning libft... + ${RM} ${OBJS} + ${RM} ${OBJS_BONUS} + echo ✅ fclean: clean - @${RM} ${NAME} + ${RM} ${NAME} re: fclean all