89 lines
2.7 KiB
Makefile
89 lines
2.7 KiB
Makefile
# **************************************************************************** #
|
|
# #
|
|
# :::::::: #
|
|
# Makefile |o_o || | #
|
|
# +:+ #
|
|
# By: djonker <marvin@codam.nl> +#+ #
|
|
# +#+ #
|
|
# Created: 2020/12/19 06:09:46 by djonker #+# #+# #
|
|
# Updated: 2023/03/07 05:39:51 by houtworm \___)=(___/ #
|
|
# #
|
|
# **************************************************************************** #
|
|
|
|
NAME =push_swap
|
|
CC =cc
|
|
CFLAGS =-Wall -Werror -Wextra #-g -fsanitize=address
|
|
RM =rm -f
|
|
PSSRC =src/push_swap.c
|
|
PSOBJ =obj/push_swap.o
|
|
CHSRC =src/checker.c
|
|
CHOBJ =obj/checker.o
|
|
SRC =src/checkandinit.c \
|
|
src/faster.c \
|
|
src/fewnumbers.c \
|
|
src/finale.c \
|
|
src/manynumbers.c \
|
|
src/printshit.c \
|
|
src/push.c \
|
|
src/reverserotate.c \
|
|
src/rotate.c \
|
|
src/swap.c
|
|
OBJ =$(SRC:src/%.c=obj/%.o)
|
|
LIB =printf/ft_printf.a getnextline/get_next_line.a libft/libft.a
|
|
|
|
all: libft getnextline printf $(NAME)
|
|
|
|
bonus: libft getnextline printf checker
|
|
|
|
clean:
|
|
@$(RM) -r obj
|
|
@$(MAKE) -C libft clean > /dev/null
|
|
@$(MAKE) -C printf clean > /dev/null
|
|
@$(MAKE) -C getnextline clean > /dev/null
|
|
@printf "\e[1;35mCleaned Object Files\n\e[0;00m"
|
|
|
|
fclean: clean
|
|
@$(RM) $(NAME) checker
|
|
@$(MAKE) -C libft fclean > /dev/null
|
|
@$(MAKE) -C printf fclean > /dev/null
|
|
@$(MAKE) -C getnextline fclean > /dev/null
|
|
@printf "\e[1;31mCleaned Executables\n\e[0;00m"
|
|
|
|
re: fclean all
|
|
|
|
$(OBJ): $(SRC)
|
|
@mkdir -p $(dir $@)
|
|
@printf "\e[1;34mBuilding $@\n\e[0;00m"
|
|
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
|
|
|
|
$(PSOBJ): $(PSSRC)
|
|
@mkdir -p $(dir $@)
|
|
@printf "\e[1;34mBuilding $@\n\e[0;00m"
|
|
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
|
|
|
|
$(CHOBJ): $(CHSRC)
|
|
@mkdir -p $(dir $@)
|
|
@printf "\e[1;34mBuilding $@\n\e[0;00m"
|
|
@$(CC) $(CFLAGS) -c $(@:obj/%.o=src/%.c) -o $@
|
|
|
|
$(NAME): $(OBJ) $(PSOBJ)
|
|
@printf "\e[1;36mCompiling $@\e[0;00m\n"
|
|
@$(CC) $(CFLAGS) -o $@ $(PSOBJ) $(OBJ) $(LIB)
|
|
@printf "\e[1;32mDone\e[0;00m\n"
|
|
|
|
checker: $(OBJ) $(CHOBJ)
|
|
@printf "\e[1;36mCompiling checker\e[0;00m\n"
|
|
@$(CC) $(CFLAGS) -o $@ $(CHOBJ) $(OBJ) $(LIB)
|
|
@printf "\e[1;32mDone\e[0;00m\n"
|
|
|
|
libft:
|
|
@$(MAKE) -C libft all
|
|
|
|
printf:
|
|
@$(MAKE) -C printf all
|
|
|
|
getnextline:
|
|
@$(MAKE) -C getnextline all
|
|
|
|
.PHONY: libft getnextline printf
|