--- Makefile.orig	2011-12-08 21:20:05.000000000 +0100
+++ Makefile	2012-01-19 22:38:38.000000000 +0100
@@ -1,7 +1,6 @@
 VERSION=1.2
 
-CC=gcc
-CFLAGS=-Wall -Wno-pointer-sign -g
+CFLAGS=-Wall -Wno-pointer-sign -g $(EXTRACFLAGS)
 INSTALL=install
 PKGCONFIG=pkg-config
 XML2CONFIG=xml2-config
@@ -9,7 +8,7 @@
 
 # these locations seem to work for SuSE and Fedora
 # prefix = $(HOME)
-prefix = $(DESTDIR)/usr
+#prefix = $(DESTDIR)/usr
 BINDIR = $(prefix)/bin
 DATADIR = $(prefix)/share
 DESKTOPDIR = $(DATADIR)/applications
@@ -25,7 +24,7 @@
 MANFILES = $(NAME).1
 XSLTFILES = xslt/*.xslt
 
-MACOSXINSTALL = /Applications/Subsurface.app
+MACOSXINSTALL = ${mpappdir}/Subsurface.app
 MACOSXFILES = packaging/macosx
 
 # find libdivecomputer
@@ -35,40 +34,9 @@
 # subdirectories of /usr/local and /usr and then we give up. You can
 # override by simply setting it here
 #
-ifeq ($(CC), i686-w64-mingw32-gcc)
-# ok, we are cross building for Windows
-	LIBDIVECOMPUTERDIR = /usr/i686-w64-mingw32/sys-root/mingw/include/libdivecomputer
-	LIBDIVECOMPUTERINCLUDES = `$(PKGCONFIG) --cflags libdivecomputer`
-	LIBDIVECOMPUTERARCHIVE = `$(PKGCONFIG) --libs libdivecomputer`
-	RESFILE = packaging/windows/subsurface.res
-	LDFLAGS += -Wl,-subsystem,windows
-else
-
-libdc-local := $(wildcard /usr/local/lib/libdivecomputer.a)
-libdc-local64 := $(wildcard /usr/local/lib64/libdivecomputer.a)
-libdc-usr := $(wildcard /usr/lib/libdivecomputer.a)
-libdc-usr64 := $(wildcard /usr/lib64/libdivecomputer.a)
-
-ifneq ($(strip $(libdc-local)),)
-	LIBDIVECOMPUTERDIR = /usr/local
-	LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
-	LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
-else ifneq ($(strip $(libdc-local64)),)
-	LIBDIVECOMPUTERDIR = /usr/local
-	LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
-	LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
-else ifneq ($(strip $(libdc-usr)),)
-	LIBDIVECOMPUTERDIR = /usr
-	LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
-	LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
-else ifneq ($(strip $(libdc-usr64)),)
-	LIBDIVECOMPUTERDIR = /usr
-	LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
-	LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib64/libdivecomputer.a
-else
-$(error Cannot find libdivecomputer - please edit Makefile)
-endif
-endif
+LIBDIVECOMPUTERDIR = ${mpprefix}
+LIBDIVECOMPUTERINCLUDES = -I$(LIBDIVECOMPUTERDIR)/include/libdivecomputer
+LIBDIVECOMPUTERARCHIVE = $(LIBDIVECOMPUTERDIR)/lib/libdivecomputer.a
 
 # Libusb-1.0 is only required if libdivecomputer was built with it.
 # And libdivecomputer is only built with it if libusb-1.0 is
@@ -116,6 +84,8 @@
 	parse-xml.o save-xml.o libdivecomputer.o print.o uemis.o \
 	gtk-gui.o statistics.o $(OSSUPPORT).o $(RESFILE)
 
+all: $(NAME)
+
 $(NAME): $(OBJS)
 	$(CC) $(LDFLAGS) -o $(NAME) $(OBJS) $(LIBS)
 
