Files
42_INT_08_philosophers/philo/Makefile
2022-01-28 15:16:08 +01:00

63 lines
916 B
Makefile

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 -rf $(DIR_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