From: Fabian Greffrath <fabian+debian@greffrath.com>
Date: Mon, 13 Jan 2014 09:57:16 +0000
Subject: Append to {C, LD}FLAGS instead of overriding them,
 to obey dpkg-buildflags

Also include CPPFLAGS in CFLAGS, since dpkg-buildflags separates them
but yquake2 doesn't.

[Updated for yquake2/5.21, added commit message -Simon McVittie]
---
 Makefile | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index d34e54b..ceb08a6 100755
--- a/Makefile
+++ b/Makefile
@@ -131,12 +131,13 @@ endif
 #
 # -fwrapv for defined integer wrapping. MSVC6 did this
 #  and the game code requires it.
+CFLAGS += $(CPPFLAGS)
 ifeq ($(YQ2_OSTYPE), Darwin)
-CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
+CFLAGS += -O2 -fno-strict-aliasing -fomit-frame-pointer \
 		  -Wall -pipe -g -fwrapv
 CFLAGS += $(OSX_ARCH)
 else
-CFLAGS := -std=gnu99 -O2 -fno-strict-aliasing \
+CFLAGS += -std=gnu99 -O2 -fno-strict-aliasing \
 		  -Wall -pipe -g -ggdb -MMD -fwrapv
 endif
 
@@ -245,15 +246,15 @@ GLAD_INCLUDE = -Isrc/client/refresh/gl3/glad/include
 
 # Base LDFLAGS.
 ifeq ($(YQ2_OSTYPE),Linux)
-LDFLAGS := -L/usr/lib -lm -ldl -rdynamic
+LDFLAGS += -L/usr/lib -lm -ldl -rdynamic
 else ifeq ($(YQ2_OSTYPE),FreeBSD)
-LDFLAGS := -L/usr/local/lib -lm
+LDFLAGS += -L/usr/local/lib -lm
 else ifeq ($(YQ2_OSTYPE),OpenBSD)
-LDFLAGS := -L/usr/local/lib -lm
+LDFLAGS += -L/usr/local/lib -lm
 else ifeq ($(YQ2_OSTYPE),Windows)
-LDFLAGS := -L/usr/lib -lws2_32 -lwinmm -static-libgcc
+LDFLAGS += -L/usr/lib -lws2_32 -lwinmm -static-libgcc
 else ifeq ($(YQ2_OSTYPE), Darwin)
-LDFLAGS := $(OSX_ARCH) -lm
+LDFLAGS += $(OSX_ARCH) -lm
 endif
 
 # Keep symbols hidden.
