File cubosphere-0.1-MakefileFixes.patch of Package cubosphere

--- cubosphere-0.1/Makefile	2011-08-01 08:42:56.000000000 +0200
+++ cubosphere-0.1-new/Makefile	2011-08-07 21:24:47.419941346 +0200
@@ -1,18 +1,16 @@
-PREFIX=/usr/local
-BINDIR=$(PREFIX)/bin
-DATADIR=$(PREFIX)/share/cubosphere
+# Calculate prefix from defaults or provided environment varibale
+CALC_PREFIX=$(shell if [ ! -z $(PREFIX) ] ; then echo $(PREFIX); else echo "/usr/local";fi)
+BINDIR=$(CALC_PREFIX)/bin
+DATADIR=$(CALC_PREFIX)/share/cubosphere
 
 EXECUTABLE=cubosphere
 
-CC=g++ 
-
-#LUAINC=$(shell if which lua-config50 >/dev/null; then lua-config50 --include; else echo "";fi)
-#LUALIBS=$(shell if which lua-config50 >/dev/null; then lua-config50 --libs; else echo "-llua -llualib";fi)
+CXX = g++
 
 LUALIBS=-llua5.1
 LUAINC=-I/usr/include/lua5.1
 
-CFLAGS+=$(LUAINC) $(shell sdl-config --cflags) -o $(EXECUTABLE)
+CFLAGS+=$(LUAINC) $(shell sdl-config --cflags) $(shell echo $(RPM_OPT_FLAGS))
 LIBS=$(LUALIBS) $(shell sdl-config --libs) -lGL -lGLEW -lGLU -lSDL_mixer -ljpeg -lSDL_ttf
 
 ifdef DATADIR
@@ -24,14 +22,19 @@
 endif
 
 
+OBJECTS := $(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
+
+.SUFFIXES: .o .cpp
+.cpp.o :
+	$(CXX) -c $(CFLAGS) -o $@ $<
+
+all:	$(EXECUTABLE)
 
-cubo:
-	@echo Compiling Cubosphere
-	$(CC) $(CFLAGS) $(LIBS) src/*.cpp
-all:    cubo
+$(EXECUTABLE): $(OBJECTS)
+	$(CXX) -o $(EXECUTABLE) $(OBJECTS) $(LIBS)
 
 clean:
-	rm $(EXECUTABLE)
+	rm -f *.o $(EXECUTABLE)
 
 install: all
 	@echo Installing Cubosphere binary