From c80cf60d527b6bacf6fdfd11881ca174a86d7e44 Mon Sep 17 00:00:00 2001 From: Quinn Date: Fri, 24 Jan 2025 15:32:29 +0100 Subject: [PATCH] add language and standard parameters to the compilation process --- makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/makefile b/makefile index 41d50e6..ac08754 100644 --- a/makefile +++ b/makefile @@ -2,8 +2,10 @@ NAME = sdl_template # compiler settings CC := clang -CFLAGS = $(shell pkg-config --cflags sdl2) -Wall -g -LDFLAGS = $(shell pkg-config --libs sdl2) -lm +STD := c17 +LANG = c +CFLAGS := $(shell pkg-config --cflags sdl2) -Wall -g +LDFLAGS := $(shell pkg-config --libs sdl2) -lm # file locations DIR_BIN := bin @@ -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 $(DIR_OBJ)/$(ARCH)/%.o: src/%.c 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): mkdir -p $@