From: Debian Games Team <pkg-games-devel@lists.alioth.debian.org>
Date: Tue, 21 May 2013 00:12:15 +0200
Subject: 02-fix-Makefile

===================================================================
---
 Makefile |   63 +++++++++++++++++++++++++++++++++++++-------------------------
 1 file changed, 38 insertions(+), 25 deletions(-)

diff --git a/Makefile b/Makefile
index f1ecef5..539d9fd 100644
--- a/Makefile
+++ b/Makefile
@@ -7,17 +7,21 @@
 ### Installation directory (Installation prefix)
 # If you don't have root privileges, set this to /home/tentacleman/bloboats/
 # for example, otherwise /. Don't use ~ or other environment variables!
-PREFIX = /
+PREFIX ?= /
+
+### Destination directory (Packager only)
+DESTDIR ?=
 
 ### Or if you don't want to run make install at all, uncomments the next line
 # and comment the line below. Compile and run with './bin/bloboats'
 #DATADIR = data
 
-DATADIR = $(PREFIX)/usr/games/bloboats/data
+DATADIR ?= $(PREFIX)/usr/games/bloboats/data
 
 ### If you do make install, you may perhaps want to set these
-BINARYDIR = $(PREFIX)/usr/bin
-CONFIGDIR = $(PREFIX)/etc
+
+BINARYDIR ?= $(PREFIX)/usr/bin
+CONFIGDIR ?= $(PREFIX)/etc
 
 PRIVATEDIR = ~/.bloboats
 
@@ -27,7 +31,10 @@ PRIVATEDIR = ~/.bloboats
 # SDL, SDL_image, SDL_mixer to compile. Libvorbis for music support.
 # OpenGL support.
 
-SOUND = 1
+# since the sound files were removed from the tarball (see: README.Debian), we
+# turn off the sound support
+
+SOUND = 0
 MUSIC = 1
 DEBUG = 0
 
@@ -40,7 +47,7 @@ DEBUG = 0
 
 
 #This should probably be DEFAULT
-TARGET = DEFAULT
+TARGET ?= DEFAULT
 
 
 ### Only some random settings below
@@ -72,7 +79,8 @@ SDLCONFIG_CROSS = i586-mingw32msvc-sdl-config
 SDLCONFIG = $(SDLCONFIG_$(TARGET))
 
 ### Libs
-LIBS_DEFAULT = `$(SDLCONFIG) --libs` -lSDL_image -lSDL_mixer -lGL -lGLU
+# no sound enable => no SDL_Mixer
+LIBS_DEFAULT = `$(SDLCONFIG) --libs` -lSDL_image -lGL -lGLU
 LIBS_FREEBSD = `$(SDLCONFIG) --libs` -lSDL_image -lSDL_mixer -L/usr/X11R6/lib -lGL -lGLU
 LIBS_NETBSD = `$(SDLCONFIG) --libs` -lSDL_image -lSDL_mixer -lGL -lGLU -L/usr/pkg/lib
 LIBS_MACOSX = `$(SDLCONFIG) --libs` -lSDL_image -lSDL_mixer -framework OpenGL
@@ -132,18 +140,22 @@ CXXFLAGS_MACOSX_ = -g `$(SDLCONFIG) --cflags` -o bin/$(BINARY_) -O2
 CXXFLAGS_CROSS_ = -g `$(SDLCONFIG) --cflags` -o bin/$(BINARY_) -O2
 CXXFLAGS_ = $(CXXFLAGS_$(TARGET)_)
 
-all: config main
+all: config-stamp build-stamp
 
-main: $(OBJ)
+#main: $(OBJ)
+build-stamp: build
+build: config-stamp $(OBJ)
 	mkdir -p bin
 	$(CXX) $(OBJ) $(LIBS) $(CXXFLAGS)
-	$(STRIP) bin/$(BINARY)
+	touch build-stamp
+	#$(STRIP) bin/$(BINARY)
 
 icon:
 	$(ICON_CMD)
 	$(CXX) -o bin/$(BINARY) $(OBJ) $(ICON) $(LIBS)
-	$(STRIP) bin/$(BINARY)
+	#$(STRIP) bin/$(BINARY)
 
+config-stamp: config
 config:
 	echo "datadir $(DATADIR)" >bloboats.dirs
 	echo "privatedir $(PRIVATEDIR)" >>bloboats.dirs
@@ -152,16 +164,16 @@ config:
 	echo "#define SOUND $(SOUND)" >> src/compiling_settings.h
 	echo "#define MUSIC $(MUSIC)" >> src/compiling_settings.h
 	echo "#define DEBUG $(DEBUG)" >> src/compiling_settings.h
+	touch config-stamp
 
-install:
-	mkdir -p $(BINARYDIR)/
-	mkdir -p $(CONFIGDIR)/
-	cp bloboats.dirs $(CONFIGDIR)/
-	mkdir -p $(DATADIR)/
-	cp -R data/* $(DATADIR)/
-	cp bin/$(BINARY) $(BINARYDIR)/
-	chmod -R 744 $(DATADIR)
-	chmod 755 `find $(DATADIR) -type d`
+install: build-stamp
+	mkdir -p $(DESTDIR)/$(BINARYDIR)/
+	mkdir -p $(DESTDIR)/$(CONFIGDIR)/
+	cp bloboats.dirs $(DESTDIR)/$(CONFIGDIR)/
+	mkdir -p $(DESTDIR)/$(DATADIR)/
+	cp -R data/* $(DESTDIR)/$(DATADIR)/
+	cp bin/$(BINARY) $(DESTDIR)/$(BINARYDIR)/
+	chmod 755 `find $(DESTDIR)/$(DATADIR) -type d`
 
 uninstall:
 	rm -f $(CONFIGDIR)/bloboats.dirs
@@ -173,10 +185,11 @@ uninstall:
 
 gho: src/viewport.o
 	$(CXX) src/viewport.o $(LIBS) $(CXXFLAGS_)
-	$(STRIP) bin/$(BINARY_)
+	#$(STRIP) bin/$(BINARY_)
 
 clean:
-	rm bloboats.dirs
-	rm src/*.o
-	rm src/models/*.o
-	rm bin/$(BINARY)
+	rm -f bloboats.dirs
+	rm -f src/*.o
+	rm -f src/models/*.o
+	rm -f bin/$(BINARY)
+	rm -f *-stamp
