--- Makefile.orig	2015-12-08 12:42:11 UTC
+++ Makefile
@@ -71,7 +71,7 @@
 #    them; you can also ask for a package with convenience libraries instead --
 #    we'll try to provide them somewhere in the near future.
 
-GAME = crawl
+GAME = stonesoup
 
 # Disable GNU Make implicit rules and variables. Leaving them enabled will slow
 # down MinGW and Cygwin builds by a very VERY noticeable degree. Besides, we have
@@ -105,7 +105,7 @@ include Makefile.obj
 # Which C++ standard to support
 STDFLAG = -std=c++11
 
-CFOTHERS := -pipe $(EXTERNAL_FLAGS)
+CFOTHERS := $(CFLAGS)
 CFWARN := 
 CFWARN_L := -Wall -Wformat-security -Wundef
 
@@ -114,7 +114,7 @@ DEFINES := $(EXTERNAL_DEFINES)
 ifdef ANDROID
 LDFLAGS := $(EXTERNAL_LDFLAGS) $(LDFLAGS)
 else
-LDFLAGS := $(EXTERNAL_LDFLAGS)
+# LDFLAGS := $(EXTERNAL_LDFLAGS)
 endif
 
 #
@@ -122,8 +122,6 @@ endif
 #
 AR = ar
 RANLIB = ranlib
-CC = $(GCC)
-CXX = $(GXX)
 RM = rm -f
 COPY = cp
 COPY_R = cp -r
@@ -512,16 +510,6 @@ ifneq ($(GCC_VER),)
 GCC_VER_SUFFIX:=-$(GCC_VER)
 endif
 
-# Attempt to use a full compiler name, to make
-# distcc builds work nicely.
-LMACH := $(shell gcc -dumpmachine)-
-ifeq ($(LMACH),-)
-LMACH :=
-endif
-ifeq ($(shell which $(LMACH)gcc$(GCC_VER_SUFFIX) > /dev/null 2> /dev/null && echo "Yes"),)
-LMACH :=
-endif
-
 ifneq ($(FORCE_CC),)
 GCC := $(FORCE_CC)
 HOSTCC := $(FORCE_CC)
@@ -575,15 +563,6 @@ ifdef USE_ICC
 
 # Some very good optimization flags.
   CFOPTIMIZE := -O2 -parallel
-else
-
-  ifneq (,$(shell $(GXX) --version|grep 'g++.*4\.2\.'))
-    # OS X uses a buggy ancient version of gcc without fixes from even
-    # subsequent point releases of 4.2.
-    CFOPTIMIZE := -O0
-  else
-    CFOPTIMIZE := -O2
-  endif
 endif
 
 ifdef LTO
@@ -655,13 +634,13 @@ ifndef BUILD_LUA
         LUA_PACKAGE = lua-5.1
       endif
     else
-      LUA_PACKAGE = lua5.1
+      LUA_PACKAGE = lua-5.1
     endif
   endif
 endif
 ifndef BUILD_LUA
   ifndef LUA_PACKAGE
-    LUA_PACKAGE = lua5.1
+    LUA_PACKAGE = lua-5.1
   endif
   INCLUDES_L += $(shell $(PKGCONFIG) $(LUA_PACKAGE) --cflags-only-I | sed -e 's/-I/-isystem /')
   CFLAGS_L  += $(shell $(PKGCONFIG) $(LUA_PACKAGE) --cflags-only-other)
@@ -674,7 +653,7 @@ endif
 
 ifndef BUILD_SQLITE
   ifeq ($(shell grep -q sqlite3_prepare $(SQLITE_INCLUDE_DIR)/sqlite3.h 2>/dev/null && echo yes),yes)
-    # INCLUDES_L += -isystem $(SQLITE_INCLUDE_DIR)
+    INCLUDES_L += -isystem $(SQLITE_INCLUDE_DIR)
     LIBS += $(SQLITE_LIB)
     ifneq ($(shell grep -q sqlite3_prepare_v2 $(SQLITE_INCLUDE_DIR)/sqlite3.h 2>/dev/null && echo yes),yes)
       DEFINES_L += -DANCIENT_SQLITE
@@ -762,7 +741,7 @@ endif
 endif
 
 DEFINES_L += $(PNG_CFLAGS) $(FREETYPE_CFLAGS) $(SDL2_CFLAGS)
-INCLUDES_L += $(PNG_INCLUDE) $(FREETYPE_INCLUDE) $(SDL2_INCLUDE)
+INCLUDES_L += $(PNG_INCLUDE) $(FREETYPE_INCLUDE) $(SDL2_INCLUDE) $(GL_INCLUDE)
 
 endif # TILES
 
@@ -831,7 +810,7 @@ ifndef NOWIZARD
 DEFINES += -DWIZARD
 endif
 ifdef NO_OPTIMIZE
-CFOPTIMIZE  := -O0
+CFOPTIMIZE  :=
 endif
 
 ifdef PCH
@@ -958,7 +937,7 @@ else
   SYS_PROPORTIONAL_FONT = $(shell { name=$(OUR_PROPORTIONAL_FONT);\
     {\
       fc-list | sed 's/: .*//' | grep -Fi "/$$name";\
-      for dir in /usr/share/fonts /usr/local/share/fonts /usr/*/lib/X11/fonts;\
+      for dir in %%LOCALBASE%%/share/fonts;\
       do [ -d $$dir ] && echo $$dir; done;\
     } | xargs -I% find % -type f -iname $$name -print | head -n1; } 2>/dev/null)
   ifneq (,$(SYS_PROPORTIONAL_FONT))
@@ -983,7 +962,7 @@ else
   SYS_MONOSPACED_FONT = $(shell { name=$(OUR_MONOSPACED_FONT);\
     {\
       fc-list | sed 's/: .*//' | grep -Fi "/$$name";\
-      for dir in /usr/share/fonts /usr/local/share/fonts /usr/*/lib/X11/fonts;\
+      for dir in %%LOCALBASE%%/share/fonts;\
       do [ -d $$dir ] && echo $$dir; done;\
     } | xargs -I% find % -type f -iname $$name -print | head -n1; } 2>/dev/null)
   ifneq (,$(SYS_MONOSPACED_FONT))
@@ -1050,10 +1029,6 @@ CFWARN := -wd383,810,869,981,1418 -we14,
 CFWARN_L :=
 endif
 
-ifeq (,$(shell echo 'int main(){return 1;}'|$(GXX) -x c++ - -o /dev/null -fuse-ld=gold 2>&1))
-  LDFLAGS += -fuse-ld=gold
-endif
-
 LDFLAGS += $(CFOPTIMIZE) $(CFOPTIMIZE_L)
 
 ifdef REPORT
