some stuff modified
This commit is contained in:
48
Makefile
48
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
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user