--- Makefile.old	2007-09-05 19:38:01.000000000 +0100
+++ Makefile	2007-09-05 19:37:41.000000000 +0100
@@ -114,44 +114,44 @@
 
 
 install:
-	install -d ${CONFDIR}
-	install -d ${BINDIR}
-	install -d ${TEMPDIR}
-	install -d ${MANDIR}
-	install -d ${PLUGDIR}
-	install -d ${LANGDIR}
-	install -d ${LOGDIR}
-	install -d ${CACHEDIR}
-	chmod 777 ${CACHEDIR}
-	install -d $(SERVEDIR)
-	chmod 777 ${SERVEDIR}
-	chmod a+rx ${LIBDIR}/gnump3d/
-	chmod a+rx ${LIBDIR}/gnump3d/plugins
-	chmod a+rx ${LIBDIR}/gnump3d/lang
-	cp lib/gnump3d/*.pm ${LIBDIR}/gnump3d
-	cp lib/gnump3d/plugins/*.pm ${PLUGDIR}
-	cp lib/gnump3d/lang/*.pm ${LANGDIR}
-	cp bin/gnump3d2 ${BINDIR}
-	chmod 755 ${BINDIR}/gnump3d2
-	-ln -sf ${BINDIR}/gnump3d2 ${BINDIR}/gnump3d
-	cp bin/gnump3d-top $(PREFIX)/bin
-	chmod 755 ${BINDIR}/gnump3d-top
-	cp bin/gnump3d-index ${BINDIR}
-	chmod 755 ${BINDIR}/gnump3d-index
-	cp man/gnump3d-top.1 ${MANDIR}
-	cp man/gnump3d-index.1 ${MANDIR}
-	cp man/gnump3d.1 ${MANDIR}
-	cp man/gnump3d.conf.1 ${MANDIR}
-	cp -R templates/* ${TEMPDIR}
-	chmod -R a+r ${TEMPDIR}
-	chmod +rx ${TEMPDIR}/*/
-	if [ -e ${CONFDIR}/gnump3d.conf ]; then cp ${CONFDIR}/gnump3d.conf ${CONFDIR}/gnump3d.conf-orig ; fi
-	sed "s#PLUGINDIR#${LIBDIR}#g" etc/gnump3d.conf > ${CONFDIR}/gnump3d.conf
-	cp etc/mime.types ${CONFDIR}
-	cp etc/file.types ${CONFDIR}
-	-find $(PREFIX)/share/gnump3d -name "plugin.html" -print | xargs rm -f
-	-rm -f $(LIBDIR)/gnump3d/FreezeThaw.pm
-	-rm -f $(LIBDIR)/gnump3d/playlist.pm
+	install -d $(DESTDIR)${CONFDIR}
+	install -d $(DESTDIR)${BINDIR}
+	install -d $(DESTDIR)${TEMPDIR}
+	install -d $(DESTDIR)${MANDIR}
+	install -d $(DESTDIR)${PLUGDIR}
+	install -d $(DESTDIR)${LANGDIR}
+	install -d $(DESTDIR)${LOGDIR}
+	install -d $(DESTDIR)${CACHEDIR}
+	chmod 777 $(DESTDIR)${CACHEDIR}
+	install -d $(DESTDIR)$(SERVEDIR)
+	chmod 777 $(DESTDIR)${SERVEDIR}
+	chmod a+rx $(DESTDIR)${LIBDIR}/gnump3d/
+	chmod a+rx $(DESTDIR)${LIBDIR}/gnump3d/plugins
+	chmod a+rx $(DESTDIR)${LIBDIR}/gnump3d/lang
+	cp lib/gnump3d/*.pm $(DESTDIR)${LIBDIR}/gnump3d
+	cp lib/gnump3d/plugins/*.pm $(DESTDIR)${PLUGDIR}
+	cp lib/gnump3d/lang/*.pm $(DESTDIR)${LANGDIR}
+	cp bin/gnump3d2 $(DESTDIR)${BINDIR}
+	chmod 755 $(DESTDIR)${BINDIR}/gnump3d2
+	-ln -sf $(DESTDIR)${BINDIR}/gnump3d2 $(DESTDIR)${BINDIR}/gnump3d
+	cp bin/gnump3d-top $(DESTDIR)$(PREFIX)/bin
+	chmod 755 $(DESTDIR)${BINDIR}/gnump3d-top
+	cp bin/gnump3d-index $(DESTDIR)${BINDIR}
+	chmod 755 $(DESTDIR)${BINDIR}/gnump3d-index
+	cp man/gnump3d-top.1 $(DESTDIR)${MANDIR}
+	cp man/gnump3d-index.1 $(DESTDIR)${MANDIR}
+	cp man/gnump3d.1 $(DESTDIR)${MANDIR}
+	cp man/gnump3d.conf.1 $(DESTDIR)${MANDIR}
+	cp -R templates/* $(DESTDIR)${TEMPDIR}
+	chmod -R a+r $(DESTDIR)${TEMPDIR}
+	chmod +rx $(DESTDIR)${TEMPDIR}/*/
+	if [ -e $(DESTDIR)${CONFDIR}/gnump3d.conf ]; then cp $(DESTDIR)${CONFDIR}/gnump3d.conf $(DESTDIR)${CONFDIR}/gnump3d.conf-orig ; fi
+	sed "s#PLUGINDIR#$(DESTDIR)${LIBDIR}#g" etc/gnump3d.conf > $(DESTDIR)${CONFDIR}/gnump3d.conf
+	cp etc/mime.types $(DESTDIR)${CONFDIR}
+	cp etc/file.types $(DESTDIR)${CONFDIR}
+	-find $(DESTDIR)$(PREFIX)/share/gnump3d -name "plugin.html" -print | xargs rm -f
+	-rm -f $(DESTDIR)$(LIBDIR)/gnump3d/FreezeThaw.pm
+	-rm -f $(DESTDIR)$(LIBDIR)/gnump3d/playlist.pm
 
 
 profile:
@@ -176,22 +176,23 @@
 
 
 uninstall:
-	rm -f ${BINDIR}/gnump3d-top
-	rm -f ${BINDIR}/gnump3d-index
-	rm -f ${BINDIR}/gnump3d2
-	rm -f ${BINDIR}/gnump3d
-	rm -f ${MANDIR}/gnump3d-top.1
-	rm -f ${MANDIR}/gnump3d-index.1
-	rm -f ${MANDIR}/gnump3d.1
-	rm -f ${MANDIR}/gnump3d.conf.1
-	rm -rf $(LIBDIR)/gnump3d/
-	rm -rf ${TEMPDIR}
-	rm -f   /etc/gnump3d/gnump3d.conf
-	-rm -rf ${CONFDIR}
-	-rm -rf ${LOGDIR}
-	-rm -rf ${CACHEDIR}
-	-rm -rf ${SERVEDIR}
+	rm -f $(DESTDIR)${BINDIR}/gnump3d-top
+	rm -f $(DESTDIR)${BINDIR}/gnump3d-index
+	rm -f $(DESTDIR)${BINDIR}/gnump3d2
+	rm -f $(DESTDIR)${BINDIR}/gnump3d
+	rm -f $(DESTDIR)${MANDIR}/gnump3d-top.1
+	rm -f $(DESTDIR)${MANDIR}/gnump3d-index.1
+	rm -f $(DESTDIR)${MANDIR}/gnump3d.1
+	rm -f $(DESTDIR)${MANDIR}/gnump3d.conf.1
+	rm -rf $(DESTDIR)$(LIBDIR)/gnump3d/
+	rm -rf $(DESTDIR)${TEMPDIR}
+	rm -f   $(DESTDIR)/etc/gnump3d/gnump3d.conf
+	-rm -rf $(DESTDIR)${CONFDIR}
+	-rm -rf $(DESTDIR)${LOGDIR}
+	-rm -rf $(DESTDIR)${CACHEDIR}
+	-rm -rf $(DESTDIR)${SERVEDIR}
 
 
 update:
 	cvs -z3 update -A -d -P 2>/dev/null
+
