--- Makefile.orig	2010-05-06 16:54:46.000000000 +0200
+++ Makefile	2010-08-22 14:31:31.000000000 +0200
@@ -7,36 +7,39 @@
 VERSION=$(shell awk '/Version:/ { print $$2 }' ${PKGNAME}.spec)
 RELEASE=$(shell awk '/Release:/ { print $$2 }' ${PKGNAME}.spec)
 CVSTAG=yum-$(subst .,_,$(VERSION)-$(RELEASE))
+MAKE=make
 PYTHON=python
 WEBHOST = yum.baseurl.org
 WEB_DOC_PATH = /srv/projects/yum/web/download/docs/yum-api/
 
+prefix = /usr
+
 all: subdirs
 
 clean:
 	rm -f *.pyc *.pyo *~ *.bak
-	for d in $(SUBDIRS); do make -C $$d clean ; done
+	for d in $(SUBDIRS); do $(MAKE) -C $$d clean ; done
 	cd test; rm -f *.pyc *.pyo *~ *.bak
 
 subdirs:
-	for d in $(SUBDIRS); do make PYTHON=$(PYTHON) -C $$d; [ $$? = 0 ] || exit 1 ; done
+	for d in $(SUBDIRS); do $(MAKE) PYTHON=$(PYTHON) -C $$d; [ $$? = 0 ] || exit 1 ; done
 
 install:
-	mkdir -p $(DESTDIR)/usr/share/yum-cli
+	mkdir -p $(DESTDIR)$(prefix)/share/yum-cli
 	for p in $(PYFILES) ; do \
-		install -m 644 $$p $(DESTDIR)/usr/share/yum-cli/$$p; \
+		install -m 644 $$p $(DESTDIR)$(prefix)/share/yum-cli/$$p; \
 	done
-	mv $(DESTDIR)/usr/share/yum-cli/yum-updatesd.py $(DESTDIR)/usr/share/yum-cli/yumupd.py
-	$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)/usr/share/yum-cli', 1, '$(PYDIR)', 1)"
+	mv $(DESTDIR)$(prefix)/share/yum-cli/yum-updatesd.py $(DESTDIR)$(prefix)/share/yum-cli/yumupd.py
+	$(PYTHON) -c "import compileall; compileall.compile_dir('$(DESTDIR)$(prefix)/share/yum-cli', 1, '$(PYDIR)', 1)"
 
-	mkdir -p $(DESTDIR)/usr/bin $(DESTDIR)/usr/sbin
-	install -m 755 bin/yum.py $(DESTDIR)/usr/bin/yum
-	install -m 755 bin/yum-updatesd.py $(DESTDIR)/usr/sbin/yum-updatesd
+	mkdir -p $(DESTDIR)$(prefix)/bin $(DESTDIR)$(prefix)/sbin
+	install -m 755 bin/yum.py $(DESTDIR)$(prefix)/bin/yum
+	install -m 755 bin/yum-updatesd.py $(DESTDIR)$(prefix)/sbin/yum-updatesd
 
 	mkdir -p $(DESTDIR)/var/cache/yum
 	mkdir -p $(DESTDIR)/var/lib/yum
 
-	for d in $(SUBDIRS); do make PYTHON=$(PYTHON) DESTDIR=`cd $(DESTDIR); pwd` -C $$d install; [ $$? = 0 ] || exit 1; done
+	for d in $(SUBDIRS); do $(MAKE) PYTHON=$(PYTHON) DESTDIR=`if [ ! -z "$(DESTDIR)" ]; then cd $(DESTDIR); pwd; fi` -C $$d install; [ $$? = 0 ] || exit 1; done
 
 .PHONY: docs test
 
@@ -64,7 +67,7 @@
 test:
 	@nosetests -i ".*test" test
 	-@test/check-po-yes-no.py
-	cd po; make test
+	cd po; $(MAKE) test
 
 test-skipbroken:
 	@nosetests -i ".*test" test/skipbroken-tests.py
