84 lines
2.8 KiB
Makefile
84 lines
2.8 KiB
Makefile
|
# **************************************************************************** #
|
||
|
# #
|
||
|
# :::::::: #
|
||
|
# Makefile |o_o || | #
|
||
|
# +:+ #
|
||
|
# By: djonker <marvin@codam.nl> +#+ #
|
||
|
# +#+ #
|
||
|
# Created: 2020/12/19 06:09:46 by djonker #+# #+# #
|
||
|
# Updated: 2023/02/20 13:24:46 by houtworm \___)=(___/ #
|
||
|
# #
|
||
|
# **************************************************************************** #
|
||
|
|
||
|
NAME = ft_printf.a
|
||
|
CC = gcc
|
||
|
FC = -Wall -Werror -Wextra# -fsanitize=address
|
||
|
RM = rm -f
|
||
|
UNAME_S := $(shell uname -s)
|
||
|
ifeq ($(UNAME_S),Linux)
|
||
|
OS = Freedom Respecting Linux! :)
|
||
|
SRC = src/ft_printf.c \
|
||
|
src/ft_printf_flags.c \
|
||
|
src/ft_printf_length.c \
|
||
|
src/Linux/ft_printf_proc_c.c \
|
||
|
src/Linux/ft_printf_proc_s.c \
|
||
|
src/Linux/ft_printf_proc_p.c \
|
||
|
src/Linux/ft_printf_proc_d.c \
|
||
|
src/Linux/ft_printf_proc_u.c \
|
||
|
src/Linux/ft_printf_proc_x.c \
|
||
|
src/Linux/ft_printf_proc_f.c \
|
||
|
src/Linux/ft_printf_proc_g.c \
|
||
|
src/Linux/ft_printf_proc_e.c \
|
||
|
src/Linux/ft_printf_proc_o.c \
|
||
|
src/Linux/ft_printf_proc_a.c \
|
||
|
src/Linux/ft_printf_proc_b.c \
|
||
|
src/Linux/ft_printf_proc_inf.c \
|
||
|
src/Linux/ft_printf_proc_prec.c
|
||
|
else
|
||
|
OS = Proprietary Malware :(
|
||
|
SRC = src/ft_printf.c \
|
||
|
src/ft_printf_flags.c \
|
||
|
src/ft_printf_length.c \
|
||
|
src/Mac/ft_printf_proc_c.c \
|
||
|
src/Mac/ft_printf_proc_s.c \
|
||
|
src/Mac/ft_printf_proc_p.c \
|
||
|
src/Mac/ft_printf_proc_d.c \
|
||
|
src/Mac/ft_printf_proc_u.c \
|
||
|
src/Mac/ft_printf_proc_x.c \
|
||
|
src/Mac/ft_printf_proc_f.c \
|
||
|
src/Mac/ft_printf_proc_g.c \
|
||
|
src/Mac/ft_printf_proc_e.c \
|
||
|
src/Mac/ft_printf_proc_o.c \
|
||
|
src/Mac/ft_printf_proc_a.c \
|
||
|
src/Mac/ft_printf_proc_b.c \
|
||
|
src/Mac/ft_printf_proc_inf.c \
|
||
|
src/Mac/ft_printf_proc_prec.c
|
||
|
endif
|
||
|
OBJ =$(SRC:src/%.c=obj/%.o)
|
||
|
FAR = ar -sr
|
||
|
LIB =../libft/libft.a
|
||
|
|
||
|
all: $(NAME)
|
||
|
|
||
|
clean:
|
||
|
@$(RM) -r obj
|
||
|
@printf "\e[1;35mCleaned Object Files\n\e[0;00m"
|
||
|
|
||
|
fclean: clean
|
||
|
@$(RM) $(NAME)
|
||
|
@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"
|
||
|
@$(FAR) $(NAME) $(OBJ) $(LIB) > /dev/null 2>&1
|
||
|
@printf "\e[1;32mDone\e[0;00m\n"
|
||
|
|
||
|
.PHONY: libft
|