pushswap/Makefile

89 lines
2.7 KiB
Makefile
Raw Normal View History

2023-03-01 04:36:58 +01:00
# **************************************************************************** #
# #
# :::::::: #
# Makefile |o_o || | #
# +:+ #
# By: djonker <marvin@codam.nl> +#+ #
# +#+ #
# Created: 2020/12/19 06:09:46 by djonker #+# #+# #
2023-03-01 23:56:55 +01:00
# Updated: 2023/03/01 23:56:45 by djonker \___)=(___/ #
2023-03-01 04:36:58 +01:00
# #
# **************************************************************************** #
NAME =push_swap
CC =cc
2023-03-01 23:56:55 +01:00
CFLAGS =-Wall -Werror -Wextra -g -fsanitize=address
2023-03-01 04:36:58 +01:00
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"
2023-03-01 23:56:55 +01:00
@$(CC) $(CFLAGS) -o $@ $(PSOBJ) $(OBJ) $(LIB)
2023-03-01 04:36:58 +01:00
@printf "\e[1;32mDone\e[0;00m\n"
checker: $(OBJ) $(CHOBJ)
@printf "\e[1;36mCompiling checker\e[0;00m\n"
2023-03-01 23:56:55 +01:00
@$(CC) $(CFLAGS) -o $@ $(CHOBJ) $(OBJ) $(LIB)
2023-03-01 04:36:58 +01:00
@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