chore: prettier Makefile
This commit is contained in:
parent
e487bff7ac
commit
b16dd2c39d
21
Makefile
21
Makefile
|
@ -1,6 +1,7 @@
|
|||
NAME = woody_woodpacker
|
||||
|
||||
SRC_FILE = main.c \
|
||||
woody_woodpacker.c \
|
||||
|
||||
OBJ_FILE = $(SRC_FILE:.c=.o)
|
||||
|
||||
|
@ -27,11 +28,7 @@ WHITE = \033[0m
|
|||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJ) $(INC)
|
||||
@echo -e "$(PURPLE)[MAKE]$(WHITE) ft_printf"
|
||||
@make --no-print-directory -C ft_printf
|
||||
@$(CC) $(CFLAGS) -I $(INC_DIR) -c $(SRC)
|
||||
@mv $(OBJ_FILE) $(OBJ_DIR)
|
||||
$(NAME): ft_printf $(OBJ) $(INC)
|
||||
@$(CC) $(CFLAGS) $(OBJ) $(LIB) -o $(NAME)
|
||||
@echo -e "$(GREEN)[OK]$(WHITE) $(NAME)"
|
||||
|
||||
|
@ -39,19 +36,25 @@ $(OBJ_DIR)%.o: $(SRC_DIR)%.c $(INC)
|
|||
@if [ ! -d ./obj ]; then \
|
||||
mkdir -p ./obj; \
|
||||
fi;
|
||||
@$(CC) $(CFLAGS) -I $(INC_DIR) -o $@ -c $<
|
||||
@echo -e "$(CYAN)[CC]$(WHITE) $<"
|
||||
@$(CC) $(CFLAGS) -I $(INC_DIR) -I ft_printf/inc -o $@ -c $<
|
||||
@echo -e "$(CYAN)[CC]$(WHITE) $(<:$(SRC_DIR)%=%)"
|
||||
|
||||
ft_printf:
|
||||
@echo -e "$(PURPLE)[MAKE]$(WHITE) ft_printf"
|
||||
@make --no-print-directory -C ft_printf
|
||||
|
||||
clean:
|
||||
@make --no-print-directory -C ft_printf clean
|
||||
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
|
||||
@rm -rf $(OBJ_DIR)
|
||||
|
||||
fclean: clean
|
||||
fclean:
|
||||
@make --no-print-directory -C ft_printf fclean
|
||||
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
|
||||
@rm -rf $(OBJ_DIR)
|
||||
@echo -e "$(RED)[DELETE]$(WHITE) $(NAME)"
|
||||
@rm -f $(NAME)
|
||||
|
||||
re: fclean all
|
||||
|
||||
.PHONY: all clean fclean re
|
||||
.PHONY: all ft_printf clean fclean re
|
||||
|
|
|
@ -34,9 +34,7 @@ WHITE = \033[0m
|
|||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(OBJ) $(INC)
|
||||
@echo -e "$(PURPLE)[MAKE]$(WHITE) libft"
|
||||
@make --no-print-directory -C ./libft
|
||||
$(NAME): libft $(OBJ) $(INC)
|
||||
@cp libft/libft.a $(NAME)
|
||||
@ar -rcs $(NAME) $(OBJ)
|
||||
@ranlib $(NAME)
|
||||
|
@ -47,18 +45,24 @@ $(OBJ_DIR)%.o: $(SRC_DIR)%.c libft/ $(INC)
|
|||
mkdir -p ./obj; \
|
||||
fi;
|
||||
@$(CC) $(CFLAGS) -I $(INC_DIR) -I libft/inc -o $@ -c $<
|
||||
@echo -e "$(CYAN)[CC]$(WHITE) $<"
|
||||
@echo -e "$(CYAN)[CC]$(WHITE) $(<:$(SRC_DIR)%=%)"
|
||||
|
||||
libft:
|
||||
@echo -e "$(PURPLE)[MAKE]$(WHITE) libft"
|
||||
@make --no-print-directory -C ./libft
|
||||
|
||||
clean:
|
||||
@make --no-print-directory -C libft clean
|
||||
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
|
||||
@rm -rf $(OBJ_DIR)
|
||||
|
||||
fclean: clean
|
||||
fclean:
|
||||
@make --no-print-directory -C libft fclean
|
||||
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
|
||||
@rm -rf $(OBJ_DIR)
|
||||
@echo -e "$(RED)[DELETE]$(WHITE) $(NAME)"
|
||||
@rm -f $(NAME)
|
||||
|
||||
re: fclean all
|
||||
|
||||
.PHONY: all clean fclean re
|
||||
.PHONY: all libft clean fclean re
|
||||
|
|
|
@ -85,13 +85,15 @@ $(OBJ_DIR)%.o: $(SRC_DIR)%.c $(INC)
|
|||
mkdir -p ./obj; \
|
||||
fi;
|
||||
@$(CC) $(CFLAGS) -I $(INC_DIR) -o $@ -c $<
|
||||
@echo -e "$(CYAN)[CC]$(WHITE) $<"
|
||||
@echo -e "$(CYAN)[CC]$(WHITE) $(<:$(SRC_DIR)%=%)"
|
||||
|
||||
clean:
|
||||
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
|
||||
@rm -rf $(OBJ_DIR)
|
||||
|
||||
fclean: clean
|
||||
fclean:
|
||||
@echo -e "$(ORANGE)[CLEAN]$(WHITE) $(NAME)"
|
||||
@rm -rf $(OBJ_DIR)
|
||||
@echo -e "$(RED)[DELETE]$(WHITE) $(NAME)"
|
||||
@rm -f $(NAME)
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#ifndef WOODY_H
|
||||
# define WOODY_H
|
||||
|
||||
# include "../ft_printf/inc/ft_printf.h"
|
||||
# include "ft_printf.h"
|
||||
|
||||
int woody_woodpacker(char *path);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#include "woody.h"
|
||||
|
||||
int main(void) {
|
||||
ft_printf("Hello, World!\n");
|
||||
int main(int ac, char **av) {
|
||||
if (ac == 2) {
|
||||
return woody_woodpacker(av[1]);
|
||||
} else {
|
||||
ft_printf("usage: %s [filename]\n", av[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
#include "ft_printf.h"
|
||||
|
||||
int woody_woodpacker(char *path) {
|
||||
ft_printf("%s\n", path);
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue