From 47beba686ff9d2aab63738fba7176a5235703d05 Mon Sep 17 00:00:00 2001 From: yctct Date: Sun, 13 Sep 2026 18:58:14 +0200 Subject: Add all files, first commit --- Makefile | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..597fa29 --- /dev/null +++ b/Makefile @@ -0,0 +1,59 @@ +# Program name +NAME := philo + +# Directories +SRC_DIR := src +BUILD_DIR := ./build +INC_DIR := ./include + +SRCS := $(addprefix $(SRC_DIR)/, \ +main.c \ +time.c \ +print.c \ +starve.c \ +free_memory.c \ +forks.c \ +philos.c \ +routine.c \ +monitoring.c \ +threads.c \ +queue.c \ +init.c \ +destroy.c \ +utils.c \ +utils_routine.c \ +validate_parameters.c \ +scheduler.c \ +sim.c) + +OBJS := $(SRCS:%.c=$(BUILD_DIR)/%.o) + +# Automatically generated dependency files +DEPS := $(SRCS:%.c=$(BUILD_DIR)/%.d) + +# -MMD and -MP will assist the rule to create the dependencies using -include ... +#CFLAGS := -Wall -Wextra -Werror -static-libasan -fsanitize=address -g3 -pthread +#CFLAGS := -Wall -Wextra -Werror -static-libasan -fsanitize=thread -g3 -pthread -fno-sanitize=thread +#CFLAGS_DEBUG := -Wall -Wextra -Werror -g3 -O0 -MMD -MP -pthread +CFLAGS := -Wall -Wextra -Werror -MMD -MP -pthread -I$(INC_DIR) + +.DEFAULT_GOAL = all +all: $(NAME) + +# that goes along with DEPS := $(OBJS:.o=.d) +-include $(DEPS) + +$(BUILD_DIR)/%.o: %.c + mkdir -p $(dir $@) + $(CC) -c -o $@ $< $(CFLAGS) + +$(NAME) : $(OBJS) + $(CC) -o $@ $^ $(CFLAGS) + +.PHONY: clean fclean re all + +clean: + rm -rf $(BUILD_DIR) +fclean: clean + rm -f $(NAME) +re: fclean all -- cgit v1.2.3