From 043401c3fca477c26f3b93e57c68498b80e1a153 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 16 Oct 2019 14:00:22 -0400 Subject: [PATCH] Add `EXTRA_FLAGS`, `EXTRA_CFLAGS`, `EXTRA_CXXFLAGS`, `EXTRA_LDFLAGS` to build system. --- compile.mk | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/compile.mk b/compile.mk index 81c55f32..96ea4b8d 100644 --- a/compile.mk +++ b/compile.mk @@ -37,10 +37,17 @@ ifdef ARCH_WIN CXXFLAGS += -Wsuggest-override endif +# Allow *appending* rather than prepending to common flags. +# This is useful to force-redefine compiler settings instead of merely setting defaults that may be overwritten. +FLAGS += $(EXTRA_FLAGS) +CFLAGS += $(EXTRA_CFLAGS) +CXXFLAGS += $(EXTRA_CXXFLAGS) +LDFLAGS += $(EXTRA_LDFLAGS) + +# Apply FLAGS to language-specific flags CFLAGS += $(FLAGS) CXXFLAGS += $(FLAGS) - # Derive object files from sources and place them before user-defined objects OBJECTS := $(patsubst %, build/%.o, $(SOURCES)) $(OBJECTS) OBJECTS += $(patsubst %, build/%.bin.o, $(BINARIES))