Files
Gods-bot/Makefile
2025-11-03 22:50:12 +00:00

44 lines
871 B
Makefile

TARGET := bot
# Directories
SRC_DIR := src
INC_DIR := include
WREN_DIR := lib/wren
# --- Compiler / Flags ---
CC := gcc
CFLAGS := -I$(INC_DIR) -I$(WREN_DIR) -Wall -Wextra -O2
LDFLAGS := -L$(WREN_DIR) -Wl,-rpath,$(WREN_DIR) -lwren -ldiscord -lcurl -lpthread
# --- Automatic Source & Object Discovery ---
SRC := $(shell find $(SRC_DIR) -type f -name '*.c')
OBJ := $(SRC:.c=.o)
# --- Default Target ---
all: $(TARGET)
# Link all objects into final binary
$(TARGET): $(OBJ)
@echo "🔗 Linking $(TARGET)"
$(CC) $(OBJ) -o $@ $(LDFLAGS)
# Compile each C source file into an object
%.o: %.c
@echo "🧱 Compiling $<"
$(CC) $(CFLAGS) -c $< -o $@
# --- Utility Targets ---
run: all
./$(TARGET)
clean:
@echo "🧹 Cleaning build files"
rm -f $(OBJ) $(TARGET)
# --- Optional Debug Build ---
debug: CFLAGS += -g -DDEBUG
debug: clean all
.PHONY: all clean run debug