From 11c01ea0fd1075a13d7bb8887da932c975bd0da1 Mon Sep 17 00:00:00 2001 From: hugodu69 Date: Sat, 16 Nov 2019 05:14:18 +0100 Subject: [PATCH] some stuff modified --- Makefile | 48 +++++++++++++++++++++--------------------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 7a7f077..b27c3a6 100644 --- a/Makefile +++ b/Makefile @@ -81,53 +81,47 @@ OBJ = $(addprefix $(ODIR)/, $(SRCS:.c=.o)) # rules to execute # - - - - - - - - - - -# when you write "make" in command line it will execute the -# first rule wrote in the Makefile, wich is ALL by convention -# because usually when you type "make" you expect it to build all +# when you write "make" in command line it will execute +# the first rule wrote in the Makefile, wich is ALL by +# convention because usually when you type "make" you +# expect it to build all # it first verify if ODIR is created and if not create it # then it calls NAME to create the library all: $(ODIR) $(NAME) -# ODIR create the folder where all the .o files will be stored +# ODIR create the folder where the files.o will be stored $(ODIR): mkdir -p $(ODIR) -# NAME will create the library libft.a -# first it checks if any OBJ (files.o) have more recent -# date of modification than NAME (libft.a), and for each -# it will execute - -# first it checks if the date of modification of any .o (OBJ) -# is more recent thant the one of libft.a (NAME) -# and for each of them it will execute -# if only one .c has been modified then only one .o will have been too -# so NAME will execute only for this one -# ranlib doesn't need to be seen so it's precedeed by a "@" +# NAME will create the library libft.a : +# - first it checks if any OBJ (files.o) have more recent +# date of modification than NAME (libft.a), and for each +# it will execute "ar rc $@ £<" +# - "ar rc name.a obj1.o obj2.o ..." create the library +# name.a if it doesn't already exist and add the given +# obj.o inside of it +# - ranlib doesn't need to be seen so it's precedeed by @ +# - automatic variables : +# $@ means what's before ":" +# $< means what is after ":" (only first argument) $(NAME): $(OBJ) ar -rc $@ $< @ranlib $@ + $(ODIR)/%.o: %.c $(COMPILE.c) -o $@ $< + clean: /bin/rm -rf $(ODIR) + fclean: clean /bin/rm -f $(NAME) + re: fclean all + .PHONY: clean -all: $(NAME) -$(NAME): $(OBJ) - ar rc $(NAME) $(OBJ) - @ranlib $(NAME) -clean: - /bin/rm -f $(OBJ) -fclean: clean - /bin/rm -f $(NAME) -re: fclean all -.PHONY: clean fclean all re - -