aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-10-25 04:42:08 +0200
committerCharles <sircharlesaze@gmail.com>2019-10-25 04:42:08 +0200
commitfeb71e200972bb78fe86130629ef040ef80811a7 (patch)
tree24b84b3f4937ab4eb930e1ad851494d8d49a9775 /Makefile
parent1b4df01bfa793fe91a58192a4b79917909bf1614 (diff)
downloadft_printf-feb71e200972bb78fe86130629ef040ef80811a7.tar.gz
ft_printf-feb71e200972bb78fe86130629ef040ef80811a7.tar.bz2
ft_printf-feb71e200972bb78fe86130629ef040ef80811a7.zip
WIP: Added libft submodule, make ft_printf lib
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