diff options
| author | Jesper Jensen <jesper@jnsn.dev> | 2025-08-16 11:30:48 +0200 |
|---|---|---|
| committer | Jesper Jensen <jesper@jnsn.dev> | 2025-08-16 11:30:48 +0200 |
| commit | 3fd4bf119c80e9a7df346a1854a4993fa5ece5e9 (patch) | |
| tree | 1c70b9e543678cc43c55158e9eb141aeaa088a4b /Makefile | |
INITIAL COMMIT
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..e2a46c5 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +CC ?= gcc + +SRCDIR ?= src +OBJDIR ?= obj + +LIBS = -LSDL/build/ -lSDL2-2.0 -Wl,-rpath,./SDL/build/ -lglm -lm +INCS = -ISDL/build/include/SDL2 -ISDL/build/include-config-/SDL2 + +CFLAGS ?= -D_FORTIFY_SOURCE=2 -Wall -g -Og +CFLAGS += -std=gnu11 -fms-extensions -flto + +APP_SOURCES = $(shell find $(SRCDIR) -name "*.c") +APP_OBJS = $(APP_SOURCES:%.c=$(OBJDIR)/%.o) +APP_DEPS = $(APP_OBJS:%.o=%.d) + +-include $(APP_DEPS) + +# We don't really need to run the tests for bear to record them +compile_commands.json: clean Makefile $(APP_SOURCES) + @rm -f "$@" + bear -- make main + +main: $(APP_OBJS) + $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(APP_OBJS) $(LIBS) + +$(OBJDIR)/%.o: %.c + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) $(INCS) -MMD -o $@ -c $< + +clean: + @rm -rf $(OBJDIR) + @rm -f main + +.DEFAULT_GOAL := all +all: main |
