Makefile now sets Libft submodule up for build and further work.
authorLukas Jiriste <ljiriste@student.42prague.com>
Wed, 27 Sep 2023 14:21:38 +0000 (16:21 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Wed, 27 Sep 2023 14:21:38 +0000 (16:21 +0200)
libft.a build and incorporation is now more reasonable.

Makefile

index 23ac4cbc03e07a9ec90762e5525df312109e00b3..bdb342c6555dd6e636bcc39a4dc59ce6ce794955 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -14,15 +14,14 @@ NAME = libftprintf.a
 
 all : $(NAME)
 
-$(NAME) : $(OBJECTS) libft.a
-       mv libft.a $(NAME)
+$(NAME) : $(OBJECTS) Libft/libft.a
+       cp Libft/libft.a $(NAME)
        $(AR) rcs $(NAME) $(OBJECTS)
 
-libft.a :
+Libft/libft.a : Libft/libft.h
        $(MAKE) -C ./Libft
-       cp ./Libft/$@ .
 
-%.o : %.c
+%.o : %.c Libft/libft.h
        $(CC) $(CFLAGS) -o $@ -c $< $(INCLUDE)
 
 clean :
@@ -36,4 +35,11 @@ fclean : clean
 re : fclean
        $(MAKE) all
 
+Libft/libft.h : get-Libft
+
+get-Libft :
+       git submodule update --init Libft
+       git -C ./Libft checkout no_crash
+
+
 bonus : all