debut du projet

This commit is contained in:
hugogogo
2021-07-18 14:38:40 +02:00
parent ea12f03a01
commit 59e2fdde4a
100 changed files with 8325 additions and 0 deletions

78
Makefile Normal file
View File

@@ -0,0 +1,78 @@
# have the .c in a "srcs/" directory
# have the .h in a "includes/" directory
# - - - - - - - - - - - - - - #
# variables names #
# - - - - - - - - - - - - - - #
# name = value \
# value
# name is case sensitive
# VPATH where to look for rules preriquisites not found in "./"
# best to use only for ".c", not ".o" nor ".h"
NAME = fdf
CC = gcc
VPATH = srcs
IDIR = ./includes
_DEPS = fdf.h
DEPS = $(_DEPS:%.h=$(IDIR)/%.h)
LDIR = ./libft
_LIBS = libft.a
LIBS = $(_LIBS:lib%.a=%)
SRCS = fdf.c
ODIR = ./builds
OBJS = $(SRCS:%.c=$(ODIR)/%.o)
# flag -g generates debug informations, g3 is maximal version
CFLAGS = -I$(IDIR) -g3 -Wall -Wextra -Werror
LFLAGS = -L$(LDIR) -l$(LIBS)
CFLAGS += -I./minilibx-linux-master
LFLAGS += -lm -lmlx -lXext -lX11 -L./minilibx-linux-master
# - - - - - - - - - - - - - - #
# rules to execute #
# - - - - - - - - - - - - - - #
# target: prerequisites ...
# recipe ...
all: $(NAME)
# it verify if anything has changed in .c and .h files
# then it makes LDIR library, then it compiles NAME
$(NAME): $(ODIR) $(OBJS) $(DEPS)
make -C $(LDIR)
$(CC) $(CFLAGS) -o $@ $(OBJS) $(LFLAGS)
# create "builds/" if doesn't exist
$(ODIR):
mkdir -p $@
# if a file.c has been modified, it's recompiled in object file.o
$(ODIR)/%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
debug: CFLAGS += -fsanitize=address
debug: clean $(NAME)
leaks: clean $(NAME)
valgrind --leak-check=full --show-leak-kinds=all ./$(NAME)
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
.PHONY: all clean fclean re gcc