[AD] [Patch] DESTDIR in make install

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


While creating Allegro packages for Slackware I found that make install is
not accepting DESTDIR like automake-based makefiles do. So I've added it
to all installation targets (not to uninstallation where it is not as
useful). Patch attached (done against 4.0.2 makefile.in, but should apply
without a problem (I hope) to 4.1.x CVS). I suggest to apply it to all
branches.

Have a nice day.

Stepan Roh
--- makefile.in.orig	2002-07-03 22:20:02.000000000 +0200
+++ makefile.in	2002-07-14 14:45:09.000000000 +0200
@@ -324,30 +324,30 @@
 	@echo "and/or make install-gzipped-info"
 
 install-lib: lib
-	$(mkinstalldirs) $(libdir)
+	$(mkinstalldirs) $(DESTDIR)$(libdir)
 	@for l in alleg alld allp; do \
 	  if test -f $(LIBDIR)/lib$${l}.a; then \
-	    echo Installing $(LIBDIR)/lib$${l}.a to $(libdir); \
-	    $(INSTALL_DATA) $(LIBDIR)/lib$${l}.a $(libdir)/; \
+	    echo Installing $(LIBDIR)/lib$${l}.a to $(DESTDIR)$(libdir); \
+	    $(INSTALL_DATA) $(LIBDIR)/lib$${l}.a $(DESTDIR)$(libdir)/; \
 	  fi; \
 	done
 	@for l in alleg alld allp; do \
 	  if test -f $(LIBDIR)/lib$${l}-$(shared_version).so; then \
-	    echo Installing $(LIBDIR)/lib$${l}-$(shared_version).so to $(libdir); \
-	    $(INSTALL_DATA) $(LIBDIR)/lib$${l}-$(shared_version).so $(libdir)/; \
-	    $(INSTALL_DATA) $(LIBDIR)/lib$${l}_unsharable.a $(libdir)/; \
+	    echo Installing $(LIBDIR)/lib$${l}-$(shared_version).so to $(DESTDIR)$(libdir); \
+	    $(INSTALL_DATA) $(LIBDIR)/lib$${l}-$(shared_version).so $(DESTDIR)$(libdir)/; \
+	    $(INSTALL_DATA) $(LIBDIR)/lib$${l}_unsharable.a $(DESTDIR)$(libdir)/; \
 	  fi; \
 	done
 	@if test -n "$(ALLEGRO_MODULE_TARGETS)"; then \
-	  $(mkinstalldirs) $(moduledir); \
+	  $(mkinstalldirs) $(DESTDIR)$(moduledir); \
 	  for m in $(ALLEGRO_MODULE_TARGETS) modules.lst; do \
-	   echo Installing $$m to $(moduledir); \
-	   $(INSTALL_DATA) $$m $(moduledir)/; \
+	   echo Installing $$m to $(DESTDIR)$(moduledir); \
+	   $(INSTALL_DATA) $$m $(DESTDIR)$(moduledir)/; \
 	  done; \
 	fi
-	$(mkinstalldirs) $(bindir)
-	@echo Installing allegro-config to $(bindir)
-	@$(INSTALL_PROGRAM) allegro-config $(bindir)
+	$(mkinstalldirs) $(DESTDIR)$(bindir)
+	@echo Installing allegro-config to $(DESTDIR)$(bindir)
+	@$(INSTALL_PROGRAM) allegro-config $(DESTDIR)$(bindir)
 	@if test -n "$(LIBDIR)/liball*-$(shared_version).so"; then \
 		(cat /etc/ld.so.conf | grep $(libdir) >/dev/null || \
 		 test $(libdir) = /lib || test $(libdir) = /usr/lib) \
@@ -359,55 +359,55 @@
 		) ; \
 	fi
 	@for l in alleg alld allp; do \
-	  if test -f $(libdir)/lib$${l}-$(shared_version).so -a \! -L $(libdir)/lib$${l}.so.${shared_major_minor}; then \
-	    (cd $(libdir); ln -s lib$${l}-$(shared_version).so lib$${l}.so.${shared_major_minor}); \
+	  if test -f $(DESTDIR)$(libdir)/lib$${l}-$(shared_version).so -a \! -L $(DESTDIR)$(libdir)/lib$${l}.so.${shared_major_minor}; then \
+	    (cd $(DESTDIR)$(libdir); ln -s lib$${l}-$(shared_version).so lib$${l}.so.${shared_major_minor}); \
 	  fi; \
 	done
 
 install-headers:
-	$(mkinstalldirs) $(includedir)/allegro
-	$(mkinstalldirs) $(includedir)/allegro/inline
-	$(mkinstalldirs) $(includedir)/allegro/internal
-	$(mkinstalldirs) $(includedir)/allegro/platform
-	$(INSTALL_DATA) $(srcdir)/include/allegro.h $(includedir)/
-	$(INSTALL_DATA) $(srcdir)/include/xalleg.h $(includedir)/
-	$(INSTALL_DATA) $(srcdir)/include/linalleg.h $(includedir)/
-	$(INSTALL_DATA) $(CONFIG_H) $(includedir)/allegro/
+	$(mkinstalldirs) $(DESTDIR)$(includedir)/allegro
+	$(mkinstalldirs) $(DESTDIR)$(includedir)/allegro/inline
+	$(mkinstalldirs) $(DESTDIR)$(includedir)/allegro/internal
+	$(mkinstalldirs) $(DESTDIR)$(includedir)/allegro/platform
+	$(INSTALL_DATA) $(srcdir)/include/allegro.h $(DESTDIR)$(includedir)/
+	$(INSTALL_DATA) $(srcdir)/include/xalleg.h $(DESTDIR)$(includedir)/
+	$(INSTALL_DATA) $(srcdir)/include/linalleg.h $(DESTDIR)$(includedir)/
+	$(INSTALL_DATA) $(CONFIG_H) $(DESTDIR)$(includedir)/allegro/
 	@for file in $(srcdir)/include/allegro/*.h; do \
-	  echo Installing $$file to $(includedir)/allegro; \
-	  $(INSTALL_DATA) $$file $(includedir)/allegro/; \
+	  echo Installing $$file to $(DESTDIR)$(includedir)/allegro; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/allegro/; \
 	done
 	@for file in $(srcdir)/include/allegro/inline/*.inl; do \
-	  echo Installing $$file to $(includedir)/allegro/inline; \
-	  $(INSTALL_DATA) $$file $(includedir)/allegro/inline/; \
+	  echo Installing $$file to $(DESTDIR)$(includedir)/allegro/inline; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/allegro/inline/; \
 	done
 	@for file in $(srcdir)/include/allegro/internal/*.h; do \
-	  echo Installing $$file to $(includedir)/allegro/internal; \
-	  $(INSTALL_DATA) $$file $(includedir)/allegro/internal/; \
+	  echo Installing $$file to $(DESTDIR)$(includedir)/allegro/internal; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/allegro/internal/; \
 	done
 	@for file in $(srcdir)/include/allegro/platform/*.h; do \
-	  echo Installing $$file to $(includedir)/allegro/platform; \
-	  $(INSTALL_DATA) $$file $(includedir)/allegro/platform/; \
+	  echo Installing $$file to $(DESTDIR)$(includedir)/allegro/platform; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(includedir)/allegro/platform/; \
 	done
 
 install-programs: programs
-	$(mkinstalldirs) $(bindir)
+	$(mkinstalldirs) $(DESTDIR)$(bindir)
 	@for prog in $(ALLEGRO_LIB_EXES) $(ALLEGRO_DATAFILE_EXES); do \
 	  if test "X`echo $$prog | sed -e s,tools/.\*,,`" = X; then \
-	    echo Installing $$prog to $(bindir); \
-	    $(INSTALL_PROGRAM) $$prog $(bindir); \
+	    echo Installing $$prog to $(DESTDIR)$(bindir); \
+	    $(INSTALL_PROGRAM) $$prog $(DESTDIR)$(bindir); \
 	  fi; \
 	done
 
 install-info: docs
 	@echo Installing Allegro info documentation...
-	$(mkinstalldirs) $(infodir)
-	@$(INSTALL_DATA) docs/info/allegro.info $(infodir)
+	$(mkinstalldirs) $(DESTDIR)$(infodir)
+	@$(INSTALL_DATA) docs/info/allegro.info $(DESTDIR)$(infodir)
 	-@if $(SHELL) -c "$(INSTALL_INFO) --version" >/dev/null 2>&1; then \
 	  if $(INSTALL_INFO) --version 2>&1 | grep "Debian" >/dev/null; then \
-	    $(INSTALL_INFO) --section Development -- $(infodir)/allegro.info; \
+	    $(INSTALL_INFO) --section Development -- $(DESTDIR)$(infodir)/allegro.info; \
 	  else \
-	    $(INSTALL_INFO) $(infodir)/allegro.info $(INFO_DIR); \
+	    $(INSTALL_INFO) $(DESTDIR)$(infodir)/allegro.info $(INFO_DIR); \
 	  fi; \
 	else \
 	  true; \
@@ -415,21 +415,21 @@
 
 install-gzipped-info: install-info
 	@echo Compressing documentation...
-	@gzip -9 -f $(infodir)/allegro.info
+	@gzip -9 -f $(DESTDIR)$(infodir)/allegro.info
 
 install-man: docs
-	$(mkinstalldirs) $(mandir)/man3
+	$(mkinstalldirs) $(DESTDIR)$(mandir)/man3
 	@for file in $(srcdir)/docs/man/*.3; do \
-	  echo Installing $$file to $(mandir)/man3; \
-	  $(INSTALL_DATA) $$file $(mandir)/man3/; \
+	  echo Installing $$file to $(DESTDIR)$(mandir)/man3; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man3/; \
 	done
 
 install-gzipped-man: docs
-	$(mkinstalldirs) $(mandir)/man3
+	$(mkinstalldirs) $(DESTDIR)$(mandir)/man3
 	@for file in $(srcdir)/docs/man/*.3; do \
-	  echo Installing $$file.gz to $(mandir)/man3; \
-	  $(INSTALL_DATA) $$file $(mandir)/man3/; \
-	  gzip -9 -f $(mandir)/man3/`echo $$file | sed -e "s:.*/::"`; \
+	  echo Installing $$file.gz to $(DESTDIR)$(mandir)/man3; \
+	  $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man3/; \
+	  gzip -9 -f $(DESTDIR)$(mandir)/man3/`echo $$file | sed -e "s:.*/::"`; \
 	done
 
 uninstall: uninstall-lib uninstall-modules uninstall-headers uninstall-programs uninstall-info uninstall-man


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/