Index: Makefile
===================================================================
--- Makefile	(revision 2065)
+++ Makefile	(revision 2571)
@@ -21,24 +21,24 @@
 
 prep-install-dirs:
-	mkdir -p '$(PREFIX_BIN)'
-	mkdir -p '$(PREFIX_LIB)'
-	mkdir -p '$(PREFIX_INC)'
-	mkdir -p '$(PREFIX_MAN)'
-	mkdir -p '$(PREFIX_COMP)'
+	mkdir -p '$(DESTDIR)$(PREFIX_BIN)'
+	mkdir -p '$(DESTDIR)$(PREFIX_LIB)'
+	mkdir -p '$(DESTDIR)$(PREFIX_INC)'
+	mkdir -p '$(DESTDIR)$(PREFIX_MAN)'
+	mkdir -p '$(DESTDIR)$(PREFIX_COMP)'
 	cd doc; make prep-install-dirs; cd ..
 
 install: prep-install-dirs
-	cp $(cp_v) lib/roar*     '$(PREFIX_BIN)'
-	cp $(cp_v) lib/lib*$(SHARED_SUFFIX)*  '$(PREFIX_LIB)'
-	sh -c 'cd lib; for file in $(COMP_LIB); do for i in "" .{0,1}; do ln -fs '$(PREFIX_LIB)'/$$file$(SHARED_SUFFIX) '$(PREFIX_COMP)'/`echo $$file | sed s/roar//`$(SHARED_SUFFIX)$$i; done; done'
-	sh -c 'for file in include/roar* include/lib*; do cp $(cp_v) -r $$file '$(PREFIX_INC)'/; done'
+	cp $(cp_v) lib/roar*     '$(DESTDIR)$(PREFIX_BIN)'
+	cp $(cp_v) lib/lib*$(SHARED_SUFFIX)*  '$(DESTDIR)$(PREFIX_LIB)'
+	sh -c 'cd lib; for file in $(COMP_LIB); do for i in "" .{0,1}; do ln -fs '$(DESTDIR)$(PREFIX_LIB)'/$$file$(SHARED_SUFFIX) '$(DESTDIR)$(PREFIX_COMP)'/`echo $$file | sed s/roar//`$(SHARED_SUFFIX)$$i; done; done'
+	sh -c 'for file in include/roar* include/lib*; do cp $(cp_v) -r $$file '$(DESTDIR)$(PREFIX_INC)'/; done'
 	cd doc; make install; cd ..
 	for i in $(PLUGINS); do if [ "$$i" != '' ]; then cd $$i; make install; cd ../..; fi; done
 
 semi-install: prep-install-dirs
-	sh -c 'for file in lib/roar*;    do ln -fs `pwd`/$$file '$(PREFIX_BIN)'/; done'
-	sh -c 'for file in lib/lib*$(SHARED_SUFFIX)*; do ln -fs `pwd`/$$file '$(PREFIX_LIB)'/; done'
-	sh -c 'cd lib; for file in $(COMP_LIB); do for i in "" .{0,1}; do ln -fs `pwd`/$$file$(SHARED_SUFFIX) '$(PREFIX_COMP)'/`echo $$file | sed s/roar//`$(SHARED_SUFFIX)$$i; done; done'
-	sh -c 'for file in include/roar* include/lib*; do ln -fs `pwd`/$$file '$(PREFIX_INC)'/; done'
+	sh -c 'for file in lib/roar*;    do ln -fs `pwd`/$$file '$(DESTDIR)$(PREFIX_BIN)'/; done'
+	sh -c 'for file in lib/lib*$(SHARED_SUFFIX)*; do ln -fs `pwd`/$$file '$(DESTDIR)$(PREFIX_LIB)'/; done'
+	sh -c 'cd lib; for file in $(COMP_LIB); do for i in "" .{0,1}; do ln -fs `pwd`/$$file$(SHARED_SUFFIX) '$(DESTDIR)$(PREFIX_COMP)'/`echo $$file | sed s/roar//`$(SHARED_SUFFIX)$$i; done; done'
+	sh -c 'for file in include/roar* include/lib*; do ln -fs `pwd`/$$file '$(DESTDIR)$(PREFIX_INC)'/; done'
 	cd doc; make semi-install; cd ..
 	for i in $(PLUGINS); do if [ "$$i" != '' ]; then cd $$i; make semi-install; cd ../..; fi; done
Index: doc/Makefile
===================================================================
--- doc/Makefile	(revision 901)
+++ doc/Makefile	(revision 2571)
@@ -14,9 +14,9 @@
 	sh -c 'for dir in man*; do (cd $$dir; mkdir ../html/$$dir 2>/dev/null; for file in *.?; do man2html -r $$file > ../html/$$dir/$$file.html; done); done'
 
-prep-install-dirs:
-	sh -c 'for dir in man*; do mkdir -p $(PREFIX_MAN)/$$dir; done'
+
+	sh -c 'for dir in man*; do mkdir -p $(DESTDIR)$(PREFIX_MAN)/$$dir; done'
 
 install: prep-install-dirs
-	sh -c 'for dir in man*; do cp $(cp_v) $$dir/*.?* $(PREFIX_MAN)/$$dir/; done'
+	sh -c 'for dir in man*; do cp $(cp_v) $$dir/*.?* $(DESTDIR)$(PREFIX_MAN)/$$dir/; done'
 semi-install: prep-install-dirs
-	sh -c 'for dir in man*; do for file in $$dir/*.?*; do ln -fs `pwd`/$$file $(PREFIX_MAN)/$$dir/; done; done'
+	sh -c 'for dir in man*; do for file in $$dir/*.?*; do ln -fs `pwd`/$$file $(DESTDIR)$(PREFIX_MAN)/$$dir/; done; done'
Index: plugins/ao/Makefile
===================================================================
--- plugins/ao/Makefile	(revision 2383)
+++ plugins/ao/Makefile	(revision 2571)
@@ -17,7 +17,7 @@
 
 install: libroar.so
-	cp libroar.so ${INSTALL_DIR}
+	cp libroar.so ${DESTDIR}${INSTALL_DIR}
 semi-install: libroar.so
-	ln -fs `pwd`/libroar.so ${INSTALL_DIR}
+	ln -fs `pwd`/libroar.so ${DESTDIR}${INSTALL_DIR}
 
 libroar.so: $(OBJ)
Index: plugins/audacious/Makefile
===================================================================
--- plugins/audacious/Makefile	(revision 2383)
+++ plugins/audacious/Makefile	(revision 2571)
@@ -18,7 +18,7 @@
 
 install: libroar.so
-	cp libroar.so ${INSTALL_DIR}/
+	cp libroar.so ${DESTDIR}${INSTALL_DIR}/
 semi-install: libroar.so
-	ln -fs `pwd`/libroar.so ${INSTALL_DIR}/
+	ln -fs `pwd`/libroar.so ${DESTDIR}${INSTALL_DIR}/
 
 libroar.so: $(OBJ)
Index: plugins/xine/Makefile
===================================================================
--- plugins/xine/Makefile	(revision 1715)
+++ plugins/xine/Makefile	(revision 2571)
@@ -18,5 +18,5 @@
 
 install: ${TARGET}
-	cp ${TARGET} ${INSTALL_DIR}/
+	cp ${TARGET} ${DESTDIR}${INSTALL_DIR}/
 
 xineplug_ao_out_roar.so: $(OBJ)
Index: plugins/xmms/Makefile
===================================================================
--- plugins/xmms/Makefile	(revision 2383)
+++ plugins/xmms/Makefile	(revision 2571)
@@ -18,7 +18,7 @@
 
 install: libroar.so
-	cp libroar.so ${INSTALL_DIR}/
+	cp libroar.so ${DESTDIR}${INSTALL_DIR}/
 semi-install: libroar.so
-	ln -fs `pwd`/libroar.so ${INSTALL_DIR}/
+	ln -fs `pwd`/libroar.so ${DESTDIR}${INSTALL_DIR}/
 
 libroar.so: $(OBJ)
