Index: Makefile
===================================================================
--- Makefile	(revision 619)
+++ Makefile	(working copy)
@@ -45,28 +45,28 @@
 #DESTDIR?=/tmp/asterisk-gui
 
 ifeq ($(OSARCH),SunOS)
-  ASTETCDIR:=$(DESTDIR)/var/etc/asterisk
+  ASTETCDIR:=/var/etc/asterisk
 else
-  ASTETCDIR:=$(DESTDIR)$(sysconfdir)/asterisk
+  ASTETCDIR:=$(sysconfdir)/asterisk
 endif
 ASTETCDIR:=$(shell cat $(ASTETCDIR)  2>/dev/null | grep -v ^\; | grep astetcdir | cut -f 3 -d ' ')
 ifeq ($(ASTETCDIR),)
   ifeq ($(OSARCH),SunOS)
-    ASTETCDIR:=$(DESTDIR)/var/etc/asterisk
+    ASTETCDIR:=/var/etc/asterisk
   else
-    ASTETCDIR:=$(DESTDIR)$(sysconfdir)/asterisk
+    ASTETCDIR:=$(sysconfdir)/asterisk
   endif
 endif
 
 ASTVARLIBDIR?=$(shell cat $(ASTETCDIR)  2>/dev/null | grep -v ^\; | grep astvarlibdir | cut -f 3 -d ' ')
 ifeq ($(ASTVARLIBDIR),)
   ifeq ($(OSARCH),SunOS)
-    ASTVARLIBDIR:=$(DESTDIR)/var/opt/asterisk
+    ASTVARLIBDIR:=/var/opt/asterisk
   else
     ifeq ($(OSARCH),FreeBSD)
-      ASTVARLIBDIR:=$(DESTDIR)$(prefix)/share/asterisk
+      ASTVARLIBDIR:=$(prefix)/share/asterisk
     else
-      ASTVARLIBDIR:=$(DESTDIR)$(localstatedir)/lib/asterisk
+      ASTVARLIBDIR:=$(localstatedir)/lib/asterisk
     endif
   endif
 endif
@@ -75,9 +75,9 @@
 ASTSBINDIR?=$(shell cat $(ASTETCDIR)  2>/dev/null | grep -v ^\; | grep astsbindir | cut -f 3 -d ' ')
 ifeq ($(ASTSBINDIR),)
   ifeq ($(OSARCH),SunOS)
-    ASTSBINDIR:=$(DESTDIR)/opt/asterisk/sbin
+    ASTSBINDIR:=/opt/asterisk/sbin
   else
-    ASTSBINDIR:=$(DESTDIR)$(sbindir)
+    ASTSBINDIR:=$(sbindir)
   endif
 endif
 
@@ -200,42 +200,42 @@
 	@ASTSBINDIR="$(ASTSBINDIR)" $(MAKE) -C $(@:-install=) install
 
 _install: _all $(SUBDIRS_INSTALL)
-	mkdir -p $(ASTETCDIR)
+	mkdir -p $(DESTDIR)$(ASTETCDIR)
 	@echo "Installing into $(HTTPDIR)"
-	mkdir -p $(CONFIGDIR)
-	mkdir -p $(CONFIGDIR)/images
-	mkdir -p $(CONFIGDIR)/scripts
-	mkdir -p $(CONFIGDIR)/stylesheets
-	mkdir -p $(CONFIGDIR)/bkps
-	mkdir -p $(CONFIGDIR)/setup
-	mkdir -p $(ASTETCDIR)/scripts
+	mkdir -p $(DESTDIR)$(CONFIGDIR)
+	mkdir -p $(DESTDIR)$(CONFIGDIR)/images
+	mkdir -p $(DESTDIR)$(CONFIGDIR)/scripts
+	mkdir -p $(DESTDIR)$(CONFIGDIR)/stylesheets
+	mkdir -p $(DESTDIR)$(CONFIGDIR)/bkps
+	mkdir -p $(DESTDIR)$(CONFIGDIR)/setup
+	mkdir -p $(DESTDIR)$(ASTETCDIR)/scripts
 	@for x in gui_configs/*; do \
-		echo "$$x  -->  $(ASTETCDIR)" ; \
-		cp $$x $(ASTETCDIR)/ ; \
+		echo "$$x  -->  $(DESTDIR)$(ASTETCDIR)" ; \
+		cp $$x $(DESTDIR)$(ASTETCDIR)/ ; \
 	done
 	@for x in scripts/*; do \
-		echo "$$x  -->  $(ASTETCDIR)/scripts" ; \
-		cp $$x $(ASTETCDIR)/scripts ; \
+		echo "$$x  -->  $(DESTDIR)$(ASTETCDIR)/scripts" ; \
+		cp $$x $(DESTDIR)$(ASTETCDIR)/scripts ; \
 	done
 	@for x in config/images/*; do \
-		echo "$$x  -->  $(CONFIGDIR)/images/" ; \
-		$(INSTALL) -m 644 $$x $(CONFIGDIR)/images/ ; \
+		echo "$$x  -->  $(DESTDIR)$(CONFIGDIR)/images/" ; \
+		$(INSTALL) -m 644 $$x $(DESTDIR)$(CONFIGDIR)/images/ ; \
 	done
 	@for x in config/scripts/*; do \
-		echo "$$x  -->  $(CONFIGDIR)/scripts/" ; \
-		$(INSTALL) -m 644 $$x $(CONFIGDIR)/scripts/ ; \
+		echo "$$x  -->  $(DESTDIR)$(CONFIGDIR)/scripts/" ; \
+		$(INSTALL) -m 644 $$x $(DESTDIR)$(CONFIGDIR)/scripts/ ; \
 	done
 	@for x in config/setup/*; do \
-		echo "$$x  -->  $(CONFIGDIR)/setup/" ; \
-		$(INSTALL) -m 644 $$x $(CONFIGDIR)/setup/ ; \
+		echo "$$x  -->  $(DESTDIR)$(CONFIGDIR)/setup/" ; \
+		$(INSTALL) -m 644 $$x $(DESTDIR)$(CONFIGDIR)/setup/ ; \
 	done
 	@for x in config/stylesheets/*; do \
-		echo "$$x  -->  $(CONFIGDIR)/stylesheets/" ; \
-		$(INSTALL) -m 644 $$x $(CONFIGDIR)/stylesheets/ ; \
+		echo "$$x  -->  $(DESTDIR)$(CONFIGDIR)/stylesheets/" ; \
+		$(INSTALL) -m 644 $$x $(DESTDIR)$(CONFIGDIR)/stylesheets/ ; \
 	done
 	@for x in config/*.html; do \
-		echo "$$x  -->  $(CONFIGDIR)" ; \
-		$(INSTALL) -m 644 $$x $(CONFIGDIR)/ ; \
+		echo "$$x  -->  $(DESTDIR)$(CONFIGDIR)" ; \
+		$(INSTALL) -m 644 $$x $(DESTDIR)$(CONFIGDIR)/ ; \
 	done
 	@if [ -x /usr/sbin/asterisk-gui-post-install ]; then \
 		/usr/sbin/asterisk-gui-post-install $(DESTDIR) . ; \
@@ -278,21 +278,21 @@
 	-rm -rf autom4te.cache
 
 samples:
-	mkdir -p $(ASTETCDIR)
+	mkdir -p $(DESTDIR)$(ASTETCDIR)
 	for x in configs/*.sample; do \
-		if [ -f $(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
+		if [ -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ]; then \
 			if [ "$(OVERWRITE)" = "y" ]; then \
-				if cmp -s $(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
+				if cmp -s $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $$x ; then \
 					echo "Config file $$x is unchanged"; \
 					continue; \
 				fi ; \
-				mv -f $(ASTETCDIR)/`$(BASENAME) $$x .sample` $(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
+				mv -f $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` $(ASTETCDIR)/`$(BASENAME) $$x .sample`.old ; \
 			else \
 				echo "Skipping config file $$x"; \
 				continue; \
 			fi ;\
 		fi ; \
-		$(INSTALL) -m 644 $$x $(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
+		$(INSTALL) -m 644 $$x $(DESTDIR)$(ASTETCDIR)/`$(BASENAME) $$x .sample` ;\
 	done
 
 makeopts: configure
