--- src/Makefile.orig	2012-12-05 08:14:05.000000000 +0400
+++ src/Makefile	2013-05-23 03:08:09.903921308 +0400
@@ -1,6 +1,6 @@
 
-CXX = g++
-CXXFLAGS = -O3
+CXX ?= g++
+CXXFLAGS ?= -O3
 AR = ar
 
 all: libosmpbf.a ../include/osmpbf/fileformat.pb.h ../include/osmpbf/osmformat.pb.h
@@ -16,12 +16,12 @@
 	cp *.pb.h ../include/osmpbf/
 
 install:
-	install -m 755 -g root -o root -d $(DESTDIR)/usr/lib
-	install -m 644 -g root -o root libosmpbf.a $(DESTDIR)/usr/lib
-	install -m 755 -g root -o root -d $(DESTDIR)/usr/include/osmpbf
-	install -m 644 -g root -o root ../include/osmpbf/osmpbf.h $(DESTDIR)/usr/include/osmpbf
-	install -m 644 -g root -o root ../include/osmpbf/fileformat.pb.h $(DESTDIR)/usr/include/osmpbf
-	install -m 644 -g root -o root ../include/osmpbf/osmformat.pb.h $(DESTDIR)/usr/include/osmpbf
+	install -m 755 -d $(DESTDIR)$(PREFIX)/lib
+	install -m 644 libosmpbf.a $(DESTDIR)$(PREFIX)/lib
+	install -m 755 -d $(DESTDIR)$(PREFIX)/include/osmpbf
+	install -m 644 ../include/osmpbf/osmpbf.h $(DESTDIR)$(PREFIX)/include/osmpbf
+	install -m 644 ../include/osmpbf/fileformat.pb.h $(DESTDIR)$(PREFIX)/include/osmpbf
+	install -m 644 ../include/osmpbf/osmformat.pb.h $(DESTDIR)$(PREFIX)/include/osmpbf
 
 clean:
 	rm -f *.pb.h *.pb.cc *.pb.o libosmpbf.a
