Improve Makefile
authorLukas Jiriste <ljiriste@student.42prague.com>
Sat, 31 Aug 2024 09:06:49 +0000 (11:06 +0200)
committerLukas Jiriste <ljiriste@student.42prague.com>
Sat, 31 Aug 2024 09:06:49 +0000 (11:06 +0200)
Make now tries to build Libft everytime but when libft.a stays the same
(no change made in Libft) the libft.a is considered not changed.
Before the libft.a was assumed to never be up to date (PHONY) hence the
minishell was always rebuilt.
Before that even the changes in Libft didn't trigger building of libft.a
when minishell make was run.

Makefile

index fe257ef0a7607795770d4de0ebe06d0bc16fecfe..92ccf3336def2496a2211ab1364fe663613b0860 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -76,12 +76,12 @@ readline :
        $(MAKE) shallow_fclean
        touch $@
 
-.PHONY : Libft/libft.a
-
 $(NAME) : $(OBJECTS) Libft/libft.a
        $(CC) $(CFLAGS) -o $@ $^ $(LINKS)
 
-Libft/libft.a : | Libft/Makefile
+FORCE: ;
+
+Libft/libft.a : FORCE | Libft/Makefile
        $(MAKE) -C Libft
 
 %.o : %.c | Libft/Makefile