aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile46
1 files changed, 32 insertions, 14 deletions
diff --git a/Makefile b/Makefile
index 7011d89..bc3e13c 100644
--- a/Makefile
+++ b/Makefile
@@ -1,32 +1,50 @@
+LIBFT_ROOT = ./libft
+
CC = gcc
-CCFLAGS = -Wall -Wextra #-Werror
+CCFLAGS = -Wall -Wextra -Werror
+LDFLAGS = -L. -lftprintf
+INCFLAGS = -I$(LIBFT_ROOT)
RM = rm -f
+LIB = ar rcs
+MAKE = make -j4
-NAME = ft_printf
+NAME = libftprintf.a
SRC = ft_printf.c utils.c printer.c parse.c list.c extract.c
OBJ = $(SRC:.c=.o)
INCLUDE = header.h
-all: $(NAME)
-
-debug: CCFLAGS += -g -fsanitize=address
-debug: re
+all: libft_all $(NAME)
$(NAME): $(OBJ)
- $(CC) $(CCFLAGS) -o $@ $(OBJ)
+ cp $(LIBFT_ROOT)/libft.a $(NAME)
+ $(LIB) $(NAME) $(OBJ)
%.o: %.c $(INCLUDE)
- $(CC) $(CCFLAGS) -c -o $@ $<
+ $(CC) $(CCFLAGS) $(INCFLAGS) -c -o $@ $<
-clean:
- $(RM) $(OBJ)
+bonus: all
-fclean: clean
+clean: libft_clean
$(RM) $(OBJ)
+fclean: libft_fclean clean
+ $(RM) $(NAME)
+
re: fclean all
-test: fclean
- make -C ../schooltest
- ../schooltest/all_tests
+test: all
+ $(CC) $(CCFLAGS) $(LDFLAGS) $(INCFLAGS) -o test main.c
+
+
+libft_all:
+ $(MAKE) -C $(LIBFT_ROOT) all
+
+libft_bonus:
+ $(MAKE) -C $(LIBFT_ROOT) bonus
+
+libft_clean:
+ $(MAKE) -C $(LIBFT_ROOT) clean
+
+libft_fclean:
+ $(MAKE) -C $(LIBFT_ROOT) fclean