add C versionioning to makefile

This commit is contained in:
2025-01-24 19:41:32 +01:00
parent 6f780e66c1
commit 591d09b610

View File

@@ -2,7 +2,9 @@ NAME = sdl_template
# compiler settings # compiler settings
CC := clang CC := clang
CFLAGS := $(shell pkg-config --cflags sdl2) -Wall -g STD := c17
LANG = c
CFLAGS := $(shell pkg-config --cflags sdl2) -Wall -g -pedantic
LDFLAGS := $(shell pkg-config --libs sdl2) -lm LDFLAGS := $(shell pkg-config --libs sdl2) -lm
# file locations # file locations
@@ -35,7 +37,7 @@ $(TARGET): $(OBJ)
# creates .o and .d files, include a flag for no unused command line arguments, because in this context it's unneeded # creates .o and .d files, include a flag for no unused command line arguments, because in this context it's unneeded
$(DIR_OBJ)/$(ARCH)/%.o: src/%.c $(DIR_OBJ)/$(ARCH)/%.o: src/%.c
mkdir -p $(dir $@) mkdir -p $(dir $@)
$(CC) -o $@ -MD -MP -c $< $(CFLAGS) -Wno-unused-command-line-argument $(CC) -o $@ -MD -MP -c $< $(CFLAGS) -std=$(STD) -x $(LANG) -Wno-unused-command-line-argument
$(DIR): $(DIR):
mkdir -p $@ mkdir -p $@