protection segfault creation zero philosophs + deplacement fichiers dans philo + ajout exeption philo folder dans gitignore
This commit is contained in:
62
philo/Makefile
Normal file
62
philo/Makefile
Normal file
@@ -0,0 +1,62 @@
|
||||
NAME = philo
|
||||
|
||||
CC = clang
|
||||
|
||||
CFLAGS = -Wall -Wextra -Werror $(INCLUDES) -g3 # del g3
|
||||
|
||||
VPATH = $(DIR_SRCS)
|
||||
DIR_SRCS = srcs
|
||||
|
||||
INCLUDES = -I$(HEADERS_D)
|
||||
|
||||
HEADERS_D = ./headers
|
||||
HEADERS = philo.h \
|
||||
philo_struct.h \
|
||||
philo_proto.h \
|
||||
philo_macro.h
|
||||
|
||||
LIBS = -lpthread
|
||||
|
||||
SRCS = main.c \
|
||||
init.c \
|
||||
launch.c \
|
||||
exec.c \
|
||||
utils.c \
|
||||
generic.c
|
||||
|
||||
DIR_OBJS = builds
|
||||
OBJS = $(SRCS:%.c=$(DIR_OBJS)/%.o)
|
||||
|
||||
# --------------------
|
||||
# ------ RULES -------
|
||||
# --------------------
|
||||
|
||||
all: $(NAME)
|
||||
|
||||
$(DIR_OBJS)/%.o: %.c | $(DIR_OBJS)
|
||||
$(CC) $(CFLAGS) -c $< -o $@
|
||||
|
||||
$(DIR_OBJS):
|
||||
mkdir $@
|
||||
|
||||
$(OBJS): $(HEADERS:%=$(HEADERS_D)/%)
|
||||
|
||||
$(NAME): $(OBJS)
|
||||
$(CC) $(OBJS) -o $(NAME) $(LIBS)
|
||||
|
||||
clean:
|
||||
rm -f $(OBJS)
|
||||
|
||||
fclean: clean
|
||||
rm -f $(NAME)
|
||||
|
||||
re: fclean all
|
||||
|
||||
valgrind: $(NAME)
|
||||
valgrind --leak-check=full --leak-resolution=low --show-reachable=yes ./$(NAME)
|
||||
|
||||
run: $(NAME)
|
||||
./$(NAME)
|
||||
|
||||
.PHONY : all clean fclean re bonus subsystem run valgrind
|
||||
|
||||
Reference in New Issue
Block a user