diff options
| author | Wayne Cole <waynecole339@gmail.com> | 2026-04-26 16:29:30 +0000 |
|---|---|---|
| committer | Wayne Cole <waynecole339@gmail.com> | 2026-04-26 16:29:30 +0000 |
| commit | c45c35cf85f3f10dadff964165cff3e5dba5fffc (patch) | |
| tree | 06005afbdd1d63691ace663e0aacedb152f50889 /Makefile | |
| download | hoodsgate-main.tar.xz hoodsgate-main.zip | |
chore: actually vcs this proj, working on it for monthsmain
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1269521 --- /dev/null +++ b/Makefile @@ -0,0 +1,47 @@ +# need to make a test command to run them easily +CC = gcc +CFLAGS_BASE = -Wall -Wextra -Wpedantic -Werror -std=c99 -Isrc +CFLAGS_DEBUG = $(CFLAGS_BASE) -g -DDEBUG +CFLAGS_PROD = $(CFLAGS_BASE) -O2 -DNDEBUG +LDFLAGS = + +SRC_DIR = src +TEST_DIR = test +BUILD_DIR = build + +TARGET = hoodsgate +SOURCES := $(shell find $(SRC_DIR) -type f -name '*.c') +OBJECTS = $(patsubst $(SRC_DIR)/%.c,$(BUILD_DIR)/%.o,$(SOURCES)) + +CFLAGS = $(CFLAGS_DEBUG) +CFLAGS += -D_POSIX_C_SOURCE=200809L + +all: $(BUILD_DIR) $(TARGET) + +prod: CFLAGS = $(CFLAGS_PROD) +prod: clean all + @echo "Production build complete" + +debug: CFLAGS = $(CFLAGS_DEBUG) +debug: clean all + @echo "Debug build complete" + +$(BUILD_DIR): + mkdir -p $(BUILD_DIR) + +$(TARGET): $(OBJECTS) + $(CC) $(OBJECTS) $(LDFLAGS) -o $(TARGET) + +$(BUILD_DIR)/%.o: $(SRC_DIR)/%.c + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) -c $< -o $@ + +clean: + rm -rf $(BUILD_DIR) $(TARGET) + +rebuild: clean all + +run: $(TARGET) + ./$(TARGET) + +.PHONY: all prod debug clean rebuild run |
