$NetBSD: patch-Makefile.in,v 1.2 2014/04/30 16:28:09 marino Exp $

Support DESTDIR

--- Makefile.in.orig	2013-03-04 17:43:09.000000000 +0000
+++ Makefile.in
@@ -64,7 +64,7 @@ ADA_GEN_SUBDIR=gnat
 
 .PHONY: all distall gprbuild gprconfig gprclean gprinstall \
 	copy_gnat_src complete bootstrap
-all: $(xmlada_build_target) $(ADA_GEN_SUBDIR)/stamp-snames
+all: $(xmlada_build_target)
 	${GNATMAKE} $(xmlada_prj_flags) -Pgprbuild -XBUILD=${BUILD}
 
 distall:
@@ -124,45 +124,35 @@ bootstrap-clean:
 	  -XBUILD_TOOL=gprbuild
 
 install: install.data install.bin
-	-${MKDIR} ${datadir}/gpr
-	$(RM) -r ${datadir}/examples/gprbuild
-	-${MKDIR} ${datadir}/examples/gprbuild
-	${CP} -r examples/* ${datadir}/examples/gprbuild
-	${RM} -r ${datadir}/doc/gprbuild
-	-${MKDIR} ${datadir}/doc/gprbuild
+	-${MKDIR} ${DESTDIR}${datadir}/gpr \
+		${DESTDIR}${datadir}/examples/gprbuild \
+		${DESTDIR}${datadir}/doc/gprbuild
+	${CP} -r examples/* ${DESTDIR}${datadir}/examples/gprbuild
 	for format in html txt pdf info; do \
 	  if [ -d doc/$$format ] ; then \
-	     ${MKDIR} ${datadir}/doc/gprbuild/$$format; \
-	     ${CP} doc/$$format/* ${datadir}/doc/gprbuild/$$format; \
+	     ${MKDIR} ${DESTDIR}${datadir}/doc/gprbuild/$$format; \
+	     ${CP} doc/$$format/* ${DESTDIR}${datadir}/doc/gprbuild/$$format; \
 	     if [ $$format = html ] ; then \
-	        ${CP} doc/*.png ${datadir}/doc/gprbuild/html; \
+	        ${CP} doc/*.png ${DESTDIR}${datadir}/doc/gprbuild/html; \
 	        sed -e "s/<doc_path>.*//" doc/gprbuild_gps.xml \
-	           > ${datadir}/doc/gprbuild/html/gps_index.xml; \
+	           > ${DESTDIR}${datadir}/doc/gprbuild/html/gps_index.xml; \
 	     fi; \
 	  fi; \
 	done
 
 install.data: force
-	-${MKDIR} ${datadir}/gprconfig
-	${CP} share/gprconfig/*.xml ${datadir}/gprconfig
-	${CP} share/gprconfig/gprconfig.xsd ${datadir}/gprconfig
-	-${MKDIR} ${datadir}/gpr
-	${CP} share/_default.gpr ${datadir}/gpr
+	-${MKDIR} ${DESTDIR}${datadir}/gprconfig ${DESTDIR}${datadir}/gpr
+	${BSD_INSTALL_DATA} share/gprconfig/*.xml \
+		share/gprconfig/gprconfig.xsd ${DESTDIR}${datadir}/gprconfig
+	${BSD_INSTALL_DATA} share/_default.gpr ${DESTDIR}${datadir}/gpr
 
 install.bin: force
-	-${MKDIR} ${bindir}
-	${INSTALL_PROGRAM} gprconfig${EXEXT} ${bindir}
-	${INSTALL_PROGRAM} gprbuild${EXEXT} ${bindir}
-	${INSTALL_PROGRAM} gprclean${EXEXT} ${bindir}
-	${INSTALL_PROGRAM} gprinstall${EXEXT} ${bindir}
-ifeq ($(IS_WINDOWS),true)
-	${CP} src/gprinstall.exe.manifest ${bindir}
-	chmod +x ${bindir}/gprinstall.exe.manifest
-endif
-	${INSTALL_PROGRAM} gprslave${EXEXT} ${bindir}
-	-${MKDIR} ${libexecdir}/gprbuild
-	${INSTALL_PROGRAM} gprbind${EXEXT} ${libexecdir}/gprbuild/
-	${INSTALL_PROGRAM} gprlib${EXEXT} ${libexecdir}/gprbuild/
+	${MKDIR} ${DESTDIR}${bindir} ${DESTDIR}${libexecdir}/gprbuild
+	${BSD_INSTALL_PROGRAM} gprconfig${EXEXT} gprbuild${EXEXT} \
+		gprclean${EXEXT} gprinstall${EXEXT} gprslave${EXEXT} \
+		${DESTDIR}${bindir}
+	${BSD_INSTALL_PROGRAM} gprbind${EXEXT} gprlib${EXEXT} \
+		${DESTDIR}${libexecdir}/gprbuild
 
 $(objdir)/gprbuild_dummies.o: src/gprbuild_dummies.c
 	gcc -c -o $@ $<
