[gimp-help-2] [make] Enable/fix "make dist*" commands



commit 1f152c8496023c7a1e400a2ebda10de5d35973f2
Author: Ulf-D. Ehlert <ulfehlert svn gnome org>
Date:   Sun Mar 28 18:53:21 2010 +0200

    [make] Enable/fix "make dist*" commands
    
    * configure.ac: add AC_CONFIG_COMMANDS to copy XSL stylesheets and
      authors.dtd if scrdir != builddir.
    * Makefile.am:
      - Add 'authors.dtd' to list of EXTRA_DIST files.
      - Fix "make uninstall", it seems that we must not try to remove
        $(DESTDIR).
      - Rearrange "make *clean" rules to come closer to the GNU Makefile
        Conventions.
      - Reorder 'dist-hook' and 'all-local' targets.
      Warning (automake bug?): it looks like 'automake' is not able to
      place 'all:' at the top of Makefile, so "make" != "make all".

 Makefile.am  |  114 +++++++++++++++++++++++++++++++++++++--------------------
 configure.ac |   12 ++++++
 2 files changed, 86 insertions(+), 40 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 5ece2fd..d594c47 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -143,11 +143,12 @@ COMMON_CSS_FILES = \
 OTHER_CSS_FILES = \
 	stylesheets/gimp22.css
 
-# stylesheets for XSLT
+# stylesheets (and more) for XSLT
 XSL_FILES = \
 	stylesheets/authors_docbook.xsl	\
 	stylesheets/authors_text.xsl	\
 	stylesheets/authors_common.xsl	\
+	stylesheets/authors.dtd 	\
 	stylesheets/makeindex.xsl	\
 	stylesheets/plainprint.xsl	\
 	stylesheets/plainhtml.xsl.in	\
@@ -330,6 +331,19 @@ copy = $(LN_S) $(abs_srcdir)/$(1) $(2)
 
 
 ########################################################################
+####            Main targets                                        ####
+########################################################################
+
+# XXX: It looks like "automake" is unable to place the "all:" target
+# at top of Makefile, so running "make" might create some random file
+# (depending on which target is the first one in the Makefile).
+# Use "make all" instead. (FIXME: and get rid of automake/autoconf!)
+all-local: html-local index AUTHORS
+
+# TODO?: check-local: validate
+
+
+########################################################################
 ####            Help!!!                                             ####
 ########################################################################
 
@@ -876,6 +890,37 @@ html-dist: \
 
 
 ########################################################################
+####            Make a distribution tar file                        ####
+########################################################################
+
+dist-hook: dist-copy-images generate-changelog
+
+##  Note that number of images is *huge*, and if we stick image files in
+##  EXTRA_DIST we get an "Argument list too long" error. So we handle it here.
+
+dist-copy-images:
+	$(cmd) test -d "$(top_srcdir)/images" && test -d "$(distdir)"
+	@echo "Copying images into distdir $(distdir) ..."
+	$(cmd)(cd $(top_srcdir) && tar -cf- --exclude=.git images) \
+	| (cd $(distdir) && tar -xf-)
+	$(cmd) test -d "$(distdir)/images" && test ! -d "$(distdir)/images/.git"
+
+generate-changelog:
+	@if test -d "$(srcdir)/.git"; \
+	then \
+		echo Creating ChangeLog && \
+		( cd "$(top_srcdir)" && \
+		  echo '# Generated by Makefile. Do not edit.'; echo; \
+		  $(top_srcdir)/missing --run git log --stat -t $(LAST_RELEASE_TAG)..HEAD ) > ChangeLog.tmp \
+		&& mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
+		|| ( rm -f ChangeLog.tmp ; \
+			echo Failed to generate ChangeLog >&2 ); \
+	else \
+		echo A git clone is required to generate a ChangeLog >&2; \
+	fi
+
+
+########################################################################
 ####            Installation                                        ####
 ########################################################################
 
@@ -891,13 +936,18 @@ install-data-local:
 	echo .
 
 uninstall-local:
+	$(cmd) test -d $(DESTDIR)$(helpdir) || exit 70
+	$(cmd) $(echo_n) "*** Uninstalling HTML:"
 	$(cmd) for lang in $(LANGUAGES); do \
+		$(echo_n) " $${lang}"; \
 		rm -rf $(DESTDIR)$(helpdir)/$${lang}; \
-	done
-	$(cmd) dir=$(DESTDIR)$(helpdir); \
+	done; \
+	echo .
+	$(cmd) test -z "$(DESTDIR)" || cd $(DESTDIR) && \
+	dir="$(helpdir)" && \
 	while [ -d "$${dir}" ]; do \
 		rmdir $${dir} 2>/dev/null \
-		&& echo removed $${dir} \
+		&& echo removed $(DESTDIR)$${dir} \
 		&& dir=$${dir%/*} \
 		|| break; \
 	done
@@ -949,40 +999,18 @@ dot: build-system.svg
 endif
 
 
-## TODO ## check-local: validate
-
-all-local: html-local index AUTHORS
-
-dist-hook: dist-copy-images generate-changelog
-
-##  Note that number of images is *huge*, and if we stick image files in
-##  EXTRA_DIST we get an "Argument list too long" error. So we handle it here.
-
-generate-changelog:
-	@if test -d "$(srcdir)/.git"; \
-	then \
-		echo Creating ChangeLog && \
-		( cd "$(top_srcdir)" && \
-		  echo '# Generated by Makefile. Do not edit.'; echo; \
-		  $(top_srcdir)/missing --run git log --stat -t $(LAST_RELEASE_TAG)..HEAD ) > ChangeLog.tmp \
-		&& mv -f ChangeLog.tmp $(top_distdir)/ChangeLog \
-		|| ( rm -f ChangeLog.tmp ; \
-			echo Failed to generate ChangeLog >&2 ); \
-	else \
-		echo A git clone is required to generate a ChangeLog >&2; \
-	fi
-
-
-dist-copy-images:
-	$(cmd) test -d "$(top_srcdir)/images" && test -d "$(distdir)"
-	@echo "Copying images into distdir $(distdir) ..."
-	$(cmd)(cd $(top_srcdir) && tar -cf- --exclude=.git images) \
-	| (cd $(distdir) && tar -xf-)
-	$(cmd) test -d "$(distdir)/images" && test ! -d "$(distdir)/images/.git"
+########################################################################
+####            Clean up                                            ####
+########################################################################
 
+# Delete all files that are normally created by building the program.
+clean-local: mostlyclean-local
+	$(cmd) rm -rf html
+	$(cmd) rm -f AUTHORS
 
+# Like `clean-local', but may refrain from deleting a few files that people
+# normally don't want to recompile.
 mostlyclean-local:
-	$(cmd) rm -rf html
 	$(cmd) rm -rf odf
 	$(cmd) rm -rf pdf
 	$(cmd) rm -rf xml
@@ -993,16 +1021,22 @@ mostlyclean-local:
 # HIDE FROM AUTOMAKE #else
 	$(cmd) rm -f $(AUTHORS_DOCBOOK_XML)
 # HIDE FROM AUTOMAKE #endif
+	$(cmd) rm -rf $(tarball_dir)
 	$(cmd) rm -f $(tarball_prefix)-*
 	$(cmd) rm -f build-system.*
 	$(cmd) rm -f .xml2po.mo messages.mo
 
-clean-local: mostlyclean-local
-	$(cmd) rm -rf log
-	$(cmd) rm -f AUTHORS
+# Delete all files in the current directory (or created by this makefile) that
+# are created by configuring or building the program.
+distclean-local: clean-local
+# HIDE FROM AUTOMAKE #ifneq ($(srcdir),$(builddir))
+		$(cmd) rm -rf stylesheets
+# HIDE FROM AUTOMAKE #endif
 
-maintainer-clean-local:
-	$(cmd) rm -rf html
+# Delete almost everything (not 'configure' or anything that needs to exist in
+# order to run 'configure') that can be reconstructed with this Makefile.
+maintainer-clean-local: distclean-local
+	$(cmd) rm -rf log
 
 # Override automake-generated targets
 Makefile: $(srcdir)/Makefile.in $(srcdir)/Makefile.am $(srcdir)/configure.ac $(srcdir)/autogen.sh
diff --git a/configure.ac b/configure.ac
index 15f2614..2d48ec5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -24,6 +24,18 @@ AM_CONDITIONAL(CYGWIN, test $IS_CYGWIN = yes)
 #AC_SUBST(IS_CYGWIN)
 
 AC_CONFIG_SRCDIR([src/gimp.xml])
+AC_CONFIG_COMMANDS(
+    [stylesheets],
+    [test "${srcdir:-.}" != "${builddir:-.}" &&
+     { test -d stylesheets || mkdir stylesheets; } &&
+     cp -f $srcdir/stylesheets/*.xsl $srcdir/stylesheets/*.dtd stylesheets/]
+)
+# XXX: use this if 'configure' (instead of 'config.status') should do it:
+#AC_CONFIG_COMMANDS_POST([
+#    test "${srcdir:-.}" != "${builddir:-.}" &&
+#    { test -d stylesheets || mkdir stylesheets; } &&
+#    cp -f $srcdir/stylesheets/*.xsl $srcdir/stylesheets/*.dtd stylesheets/
+#])
 
 AM_INIT_AUTOMAKE([1.6 dist-bzip2 -Wall -Wno-portability])
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]