Browse Source

Better Makefile

master
narnaud 3 years ago
parent
commit
3b2e60240d
  1. 37
      Makefile
  2. 20
      libft/Makefile

37
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

20
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

Loading…
Cancel
Save