Upload files to "/"
This commit is contained in:
43
Makefile
Normal file
43
Makefile
Normal file
@@ -0,0 +1,43 @@
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user