$NetBSD: patch-ae,v 1.1.1.1 2011/02/08 18:32:24 drochner Exp $

--- Makefile.in.orig	2010-12-14 22:30:45.000000000 +0000
+++ Makefile.in
@@ -24,12 +24,12 @@ test-clean:
 	(cd scripts; ./testsuites clean)
 
 install-common:
-	$(MKDIR) $(bindir)
-	$(MKDIR) $(sharedir)
-	$(MKDIR) $(examplesdir)
-	$(MKDIR) $(sharedir)/gps
-	$(MKDIR) $(sharedir)/gps/docgen2
-	$(MKDIR) $(sharedir)/gps/aunit
+	$(MKDIR) $(DESTDIR)$(bindir)
+	$(MKDIR) $(DESTDIR)$(sharedir)
+	$(MKDIR) $(DESTDIR)$(examplesdir)
+	$(MKDIR) $(DESTDIR)$(sharedir)/gps
+	$(MKDIR) $(DESTDIR)$(sharedir)/gps/docgen2
+	$(MKDIR) $(DESTDIR)$(sharedir)/gps/aunit
 ifeq ($(OS),Windows_NT)
 # On Windows we distribute two versions of subversion.xml, one that
 # supports Cygwin/Subversion and one for native Subversion.
@@ -42,45 +42,40 @@ ifeq ($(OS),Windows_NT)
 		share/plug-ins/_subversion_ \
 		> share/plug-ins/subversion_native_windows.xml
 endif
-	$(RM) $(sharedir)/gps/library/*.py
-	$(RM) $(sharedir)/gps/library/*.xml
-	$(RM) $(sharedir)/gps/plug-ins/*.py
-	$(RM) $(sharedir)/gps/plug-ins/*.xml
-	$(RMDIR) $(sharedir)/gps/templates
 # update runtime.xml before copying the plug-ins files.
 	(cd distrib; $(PERL) from_impunit.pl)
-	(cd share; tar cf - plug-ins/*.xml) | (cd $(sharedir)/gps; tar xf -)
+	(cd share; tar cf - plug-ins/*.xml) | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
 ifeq ($(OS),Windows_NT)
 # Clean-up changes made above for Windows.
 	$(MV) share/plug-ins/_subversion_ share/plug-ins/subversion.xml
 	$(RM) share/plug-ins/subversion_native_windows.xml
 endif
-	$(AWK) -f distrib/gnat_switches.awk < gnat/gnat_ugn.texi > $(sharedir)/gps/plug-ins/gnat_switches.py
-	(cd share; tar cf - plug-ins/*.py) | (cd $(sharedir)/gps; tar xf -)
-	(cd share; tar cf - plug-ins/gps_utils/*.py) | (cd $(sharedir)/gps; tar xf -)
-	(cd share; tar cf - plug-ins/spark/*.py) | (cd $(sharedir)/gps; tar xf -)
-	(cd share; tar cf - plug-ins/*.png) | (cd $(sharedir)/gps; tar xf -)
-	(cd share; tar cf - plug-ins/images/*.png) | (cd $(sharedir)/gps; tar xf -)
-	(cd share; tar cf - library/*.xml) | (cd $(sharedir)/gps; tar xf -)
-	(cd share; tar cf - library/*.py) | (cd $(sharedir)/gps; tar xf -)
-	(cd share; tar cf - library/pygps/*.py) | (cd $(sharedir)/gps; tar xf -)
-	$(RM) $(sharedir)/gps/plug-ins/emacs.xml
-	(cd share; tar cf - icons/)  | (cd $(sharedir)/gps; tar xf -)
-	(cd share; tar cf - templates/)  | (cd $(sharedir)/gps; tar xf -)
-	(cd share; tar cf - *.*)  | (cd $(sharedir)/gps; tar xf -)
+	$(AWK) -f distrib/gnat_switches.awk < gnat/gnat_ugn.texi > $(DESTDIR)$(sharedir)/gps/plug-ins/gnat_switches.py
+	(cd share; tar cf - plug-ins/*.py) | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
+	(cd share; tar cf - plug-ins/gps_utils/*.py) | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
+	(cd share; tar cf - plug-ins/spark/*.py) | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
+	(cd share; tar cf - plug-ins/*.png) | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
+	(cd share; tar cf - plug-ins/images/*.png) | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
+	(cd share; tar cf - library/*.xml) | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
+	(cd share; tar cf - library/*.py) | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
+	(cd share; tar cf - library/pygps/*.py) | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
+	$(RM) $(DESTDIR)$(sharedir)/gps/plug-ins/emacs.xml
+	(cd share; tar cf - icons/)  | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
+	(cd share; tar cf - templates/)  | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
+	(cd share; tar cf - *.*)  | (cd $(DESTDIR)$(sharedir)/gps; tar xf -)
 	(cd docgen2/resources; tar cf - *.tmpl custom/*.css support/*.css support/*.js support/images/*.png) \
-		| (cd $(sharedir)/gps/docgen2; tar xf -)
+		| (cd $(DESTDIR)$(sharedir)/gps/docgen2; tar xf -)
 	(cd aunit/templates; tar cf - *.tmpl) \
-		| (cd $(sharedir)/gps/aunit; tar xf -)
+		| (cd $(DESTDIR)$(sharedir)/gps/aunit; tar xf -)
 	$(MAKE) -C docs install
-	(cd examples; tar cf - --exclude .svn . ) | (cd $(examplesdir); tar xf -)
+	(cd examples; tar cf - --exclude .svn . ) | (cd $(DESTDIR)$(examplesdir); tar xf -)
 
 install: install-common
 ifeq ($(OS),Windows_NT)
 	$(INSTALL_PROGRAM) gps/obj/gps.exe $(bindir)
 	$(MAKE) -C common/expect install
 else
-	$(INSTALL_PROGRAM) gps/obj/gps $(bindir)
+	$(INSTALL_PROGRAM) gps/obj/gps $(DESTDIR)$(bindir)
 endif
 
 install-strip: install-common
