NAME        := seyshell
DRIVE       := disk
CC          := gcc 
CFLAGS      := -Wall -Wextra -Werror -g
OBJ_DIR     := obj
SRC_DIR     := src

SOURCES     := $(shell find $(SRC_DIR) -name "*.c")
OBJECTS     := $(SOURCES:$(SRC_DIR)/%.c=$(OBJ_DIR)/%.o)

all: $(NAME)

$(NAME): $(OBJECTS)
	@$(CC) $(CFLAGS) $(OBJECTS) -o $(NAME)

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.c
	@mkdir -p $(dir $@)
	@$(CC) $(CFLAGS) -c $< -o $@

clean:
	@rm -rf $(OBJ_DIR)

fclean: clean
	@rm -f $(NAME) $(DRIVE)

re: fclean all

.PHONY: all clean fclean re
