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
|
# rules to execute
|
||||||
# - - - - - - - - - -
|
# - - - - - - - - - -
|
||||||
|
|
||||||
# when you write "make" in command line it will execute the
|
# when you write "make" in command line it will execute
|
||||||
# first rule wrote in the Makefile, wich is ALL by convention
|
# the first rule wrote in the Makefile, wich is ALL by
|
||||||
# because usually when you type "make" you expect it to build all
|
# 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
|
# it first verify if ODIR is created and if not create it
|
||||||
# then it calls NAME to create the library
|
# then it calls NAME to create the library
|
||||||
all: $(ODIR) $(NAME)
|
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):
|
$(ODIR):
|
||||||
mkdir -p $(ODIR)
|
mkdir -p $(ODIR)
|
||||||
|
|
||||||
# NAME will create the library libft.a
|
# NAME will create the library libft.a :
|
||||||
# first it checks if any OBJ (files.o) have more recent
|
# - first it checks if any OBJ (files.o) have more recent
|
||||||
# date of modification than NAME (libft.a), and for each
|
# date of modification than NAME (libft.a), and for each
|
||||||
# it will execute
|
# it will execute "ar rc $@ £<"
|
||||||
|
# - "ar rc name.a obj1.o obj2.o ..." create the library
|
||||||
# first it checks if the date of modification of any .o (OBJ)
|
# name.a if it doesn't already exist and add the given
|
||||||
# is more recent thant the one of libft.a (NAME)
|
# obj.o inside of it
|
||||||
# and for each of them it will execute
|
# - ranlib doesn't need to be seen so it's precedeed by @
|
||||||
# if only one .c has been modified then only one .o will have been too
|
# - automatic variables :
|
||||||
# so NAME will execute only for this one
|
# $@ means what's before ":"
|
||||||
# ranlib doesn't need to be seen so it's precedeed by a "@"
|
# $< means what is after ":" (only first argument)
|
||||||
$(NAME): $(OBJ)
|
$(NAME): $(OBJ)
|
||||||
ar -rc $@ $<
|
ar -rc $@ $<
|
||||||
@ranlib $@
|
@ranlib $@
|
||||||
|
|
||||||
$(ODIR)/%.o: %.c
|
$(ODIR)/%.o: %.c
|
||||||
$(COMPILE.c) -o $@ $<
|
$(COMPILE.c) -o $@ $<
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm -rf $(ODIR)
|
/bin/rm -rf $(ODIR)
|
||||||
|
|
||||||
fclean: clean
|
fclean: clean
|
||||||
/bin/rm -f $(NAME)
|
/bin/rm -f $(NAME)
|
||||||
|
|
||||||
re: fclean all
|
re: fclean all
|
||||||
|
|
||||||
.PHONY: clean
|
.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