installation des fichiers
This commit is contained in:
67
Makefile
Normal file
67
Makefile
Normal file
@@ -0,0 +1,67 @@
|
||||
|
||||
# - - - - - - - - - - - - - - # name = value \ | .c in srcs/
|
||||
# variables names # value | .h in includes/
|
||||
# - - - - - - - - - - - - - - # ! name is case sensitive | ! use VPATH only for .c
|
||||
|
||||
NAME = pushswap
|
||||
|
||||
CC = gcc
|
||||
|
||||
VPATH = srcs
|
||||
|
||||
IDIR = ./includes
|
||||
|
||||
_DEPS =
|
||||
DEPS = $(_DEPS:%.h=$(IDIR)/%.h)
|
||||
# used to check if a .h has been modify when execute $NAME rule
|
||||
|
||||
LDIR = ./libft
|
||||
_LIBS = libft.a
|
||||
LIBS = $(_LIBS:lib%.a=%)
|
||||
|
||||
SRCS = pushswap.c
|
||||
|
||||
ODIR = ./builds
|
||||
OBJS = $(SRCS:%.c=$(ODIR)/%.o)
|
||||
|
||||
CFLAGS = -I$(IDIR) -g3 -Wall -Wextra -Werror
|
||||
|
||||
LFLAGS = -L$(LDIR) -l$(LIBS)
|
||||
|
||||
|
||||
|
||||
# - - - - - - - - - - - - - - # target: prerequisites | $@ : target
|
||||
# rules to execute # recipe | $< : 1st prerequisite
|
||||
# - - - - - - - - - - - - - - # recipe | $^ : all prerequisites
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(NAME): $(ODIR) $(OBJS) $(DEPS)
|
||||
make -C $(LDIR)
|
||||
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS)
|
||||
|
||||
$(ODIR):
|
||||
mkdir -p $@
|
||||
|
||||
$(ODIR)/%.o: %.c
|
||||
$(CC) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
clean:
|
||||
/bin/rm -f $(OBJS)
|
||||
|
||||
fclean: clean
|
||||
make fclean -C $(LDIR)
|
||||
/bin/rm -rf $(ODIR)
|
||||
/bin/rm -f $(NAME)
|
||||
/bin/rm -rf a.out a.out.dSYM
|
||||
|
||||
re: fclean all
|
||||
|
||||
leaks: CFLAGS += -fsanitize=address
|
||||
leaks: clean $(NAME)
|
||||
|
||||
valgrind: clean $(NAME)
|
||||
valgrind --leak-check=full --show-leak-kinds=all ./$(NAME)
|
||||
|
||||
.PHONY: all clean fclean re gcc
|
||||
|
||||
Reference in New Issue
Block a user