47 lines
1.2 KiB
Makefile
47 lines
1.2 KiB
Makefile
# The interesting part
|
|
NAME = libft.a
|
|
SRCS = ./
|
|
INCLUDES = ./
|
|
FUNCTIONS = \
|
|
isalpha isdigit isalnum isascii isprint \
|
|
toupper tolower \
|
|
strncmp strlen strlcpy strlcat strchr strrchr strnstr strdup \
|
|
strmapi striteri substr strjoin strtrim split \
|
|
memset bzero memcpy memmove memchr memcmp calloc \
|
|
atoi itoa \
|
|
putchar_fd putstr_fd putendl_fd putnbr_fd
|
|
FUNCTIONS_BONUS = \
|
|
lstnew lstadd_front lstsize lstlast lstadd_back \
|
|
lstdelone lstclear lstiter lstmap
|
|
CODE = $(addprefix ft_, $(FUNCTIONS))
|
|
CODE_BONUS = $(addprefix ft_, $(FUNCTIONS_BONUS))
|
|
|
|
# It works and I probably won't change it for the rest of my life
|
|
C_FILES = $(addsuffix .c,$(addprefix $(SRCS),$(CODE)))
|
|
O_FILES = $(addsuffix .o,$(addprefix $(SRCS),$(CODE)))
|
|
C_FILES_BONUS = $(addsuffix .c,$(addprefix $(SRCS),$(CODE_BONUS)))
|
|
O_FILES_BONUS = $(addsuffix .o,$(addprefix $(SRCS),$(CODE_BONUS)))
|
|
CC = cc -Wall -Wextra -Werror
|
|
AR = ar rcs
|
|
MAKE = make
|
|
|
|
all : $(NAME) bonus
|
|
|
|
$(NAME) : $(O_FILES)
|
|
$(AR) $(NAME) $(O_FILES)
|
|
|
|
%.o : %.c
|
|
$(CC) -I $(INCLUDES) -c $< -o $@
|
|
|
|
clean :
|
|
rm -f $(O_FILES) $(O_FILES_BONUS)
|
|
|
|
fclean : clean
|
|
rm -f $(NAME)
|
|
|
|
re : fclean all
|
|
|
|
bonus : $(O_FILES_BONUS)
|
|
$(AR) $(NAME) $(O_FILES_BONUS)
|
|
|
|
.PHONY : all clean fclean re bonus
|