From: Markus Koschany <apo@debian.org>
Date: Thu, 8 Nov 2012 16:49:13 +0100
Subject: Modify Makefile.linux

Enables pthread linking for better portability and patches the Makefile
to enable hardening.
Note: Enabling all hardening features is possible but leads to a buggy and
unusable game. For now CFLAGS and CPPFLAGS provided by dpkg-buildflags are
disabled.
---
 etw/Makefile.linux |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/etw/Makefile.linux b/etw/Makefile.linux
index 09bc3a5..c6c7923 100644
--- a/etw/Makefile.linux
+++ b/etw/Makefile.linux
@@ -1,11 +1,18 @@
-CC = gcc
+CC = gcc -pthread
 
-CFLAGS = -Wall -g -fsigned-char -Iinclude \
+CFLAGS = -Wall -g -fPIC -fsigned-char -Iinclude \
     -Wpointer-arith -Wcast-align -Wcast-qual  -Wno-char-subscripts  -Wshadow \
     -Waggregate-return  -Wsign-compare \
     `pkg-config --cflags sdl` `pkg-config --cflags gtk+-2.0`
 
+#CFLAGS += `dpkg-buildflags --get CPPFLAGS`
+#CFLAGS += `dpkg-buildflags --get CFLAGS`
+
+SLIM = -Wl,--as-needed
+
 LDFLAGS = `pkg-config --libs sdl` `pkg-config --libs gtk+-2.0`
+LDFLAGS += `dpkg-buildflags --get LDFLAGS`
+
 DEFINES = -DLINUX -DCD_VERSION -DENABLE_BINRELOC -DHAVE_STDINT_H
 
 OBJECTS = highdirent.o cpu.o human.o myiff.o specials.o \
@@ -26,7 +33,7 @@ OBJECTS = highdirent.o cpu.o human.o myiff.o specials.o \
 all: CHECKTOOLS etw
 
 etw: $(OBJECTS)
-	$(CC) -o etw $(OBJECTS) $(LDFLAGS)
+	$(CC) $(SLIM) -o etw $(OBJECTS) $(LDFLAGS)
 
 clean:
 	rm -rf etw *.o
