--- Makefile.orig	2011-03-25 12:51:07.000000000 +0100
+++ Makefile	2011-03-25 12:48:43.000000000 +0100
@@ -1,6 +1,6 @@
 CFLAGS=-g -O2 -Wall -Isrc -DNDEBUG $(OPTFLAGS)
 LIBS=-lzmq -lsqlite3 $(OPTLIBS)
-PREFIX?=/usr/local
+PREFIX?=@@PREFIX@@
 
 ASM=$(wildcard src/**/*.S src/*.S)
 RAGEL_TARGETS=src/state.c src/http11/http11_parser.c
@@ -69,8 +69,8 @@
 install: all install-bin install-m2sh
 
 install-bin:
-	install -d $(PREFIX)/bin/
-	install bin/mongrel2 $(PREFIX)/bin/
+	install -d $(DESTDIR)/$(PREFIX)/bin/
+	install bin/mongrel2 $(DESTDIR)/$(PREFIX)/bin/
 
 install-m2sh:
 	${MAKE} -C tools/m2sh install
