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