65 lines
2.0 KiB
Makefile
65 lines
2.0 KiB
Makefile
|
# **************************************************************************** #
|
||
|
# #
|
||
|
# .--. _ #
|
||
|
# Makefile |o_o || | #
|
||
|
# |:_/ || |_ _ ___ __ #
|
||
|
# By: djonker <djonker@student.codam.nl> // \ \ __| | | \ \/ / #
|
||
|
# (| | )|_| |_| |> < #
|
||
|
# Created: 2023/02/15 02:12:27 by djonker /'\_ _/`\__|\__,_/_/\_\ #
|
||
|
# Updated: 2023/02/19 19:18:27 by djonker \___)=(___/ #
|
||
|
# #
|
||
|
# **************************************************************************** #
|
||
|
|
||
|
NAME =pipex
|
||
|
CC =gcc
|
||
|
CFLAGS =-Wall -Werror -Wextra# -g -fsanitize=address
|
||
|
RM =rm -f
|
||
|
ifdef PIPEXBONUS
|
||
|
SRC =src/bonus/pipex.c\
|
||
|
src/bonus/init.c\
|
||
|
src/bonus/error.c
|
||
|
else
|
||
|
SRC =src/mandatory/pipex.c\
|
||
|
src/mandatory/init.c\
|
||
|
src/mandatory/error.c
|
||
|
endif
|
||
|
OBJ =$(SRC:src/%.c=obj/%.o)
|
||
|
LIB =libft/libft.a getnextline/get_next_line.a
|
||
|
|
||
|
all: libft getnextline $(NAME)
|
||
|
|
||
|
clean:
|
||
|
@$(RM) -r obj
|
||
|
@$(MAKE) -C libft clean > /dev/null
|
||
|
@$(MAKE) -C getnextline clean > /dev/null
|
||
|
@printf "\e[1;35mCleaned Object Files\n\e[0;00m"
|
||
|
|
||
|
fclean: clean
|
||
|
@$(RM) $(NAME)
|
||
|
@$(MAKE) -C libft 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 $@
|
||
|
|
||
|
$(NAME): $(OBJ)
|
||
|
@printf "\e[1;36mCompiling $@\e[0;00m\n"
|
||
|
@$(CC) $(CFLAGS) -o $(NAME) $^ $(LIB)
|
||
|
@printf "\e[1;32mDone\e[0;00m\n"
|
||
|
|
||
|
libft:
|
||
|
@$(MAKE) -C libft bonus
|
||
|
|
||
|
getnextline:
|
||
|
@$(MAKE) -C getnextline all
|
||
|
|
||
|
bonus:
|
||
|
@$(MAKE) PIPEXBONUS=1 all
|
||
|
|
||
|
.PHONY: libft getnextline# $(NAME)
|