[gimp-help-2/makefile-auto-update] Enhance automatical Makefile update



commit 223b811f09e787c8b14eb9a7776773705954dccc
Author: Ulf-D. Ehlert <ulfehlert svn gnome org>
Date:   Sun Jun 21 18:44:15 2009 +0200

    Enhance automatical Makefile update
    
    * Move our dirty trick for hiding parts of Makefile.am from automake
      from 'autogen.sh' to 'configure.ac' (so that we don't need to add
      autogen.sh to the dist files).
    * Call 'configure' rather than 'autogen.sh' for updating Makefile.
    * Add simple commands for updating 'Makefile.in' and 'configure'.
    * Change AM_INIT_AUTOMAKE macro in 'configure.ac' to suppress
      override warnings (and also change automake version).
    * Add Minor changes to 'autogen.sh' (e.g. redirect error messages to
      stderr).

 Makefile.am  |   15 ++++++++-------
 autogen.sh   |   27 +++++++--------------------
 configure.ac |   18 +++++++++++++++++-
 3 files changed, 32 insertions(+), 28 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index c0c25b4..5073cb1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -864,19 +864,20 @@ maintainer-clean-local:
 	$(cmd) rm -rf html
 
 # Override automake-generated targets
-Makefile: $(srcdir)/Makefile.in $(srcdir)/Makefile.am $(srcdir)/configure.ac $(srcdir)/autogen.sh
-	$(msg) "!!! Updating '$@' running 'autogen.sh' ($? changed) !!!"
+Makefile: $(srcdir)/Makefile.in
+	$(msg) "!!! Updating '$@' ($? changed) running"
 	$(cmd) opt=`test -e $(srcdir)/config.status && \
 	     $(srcdir)/config.status --version | \
 	     sed -e 's/.*with options "//' \
 	         -e tmatch -e d -e :match -e 's/".*//' \
 		 -e "s/'\([^'=]*\)=\([^']*\)'/\1='\2'/"`; \
-	test -n "$${opt}" && eval $(srcdir)/autogen.sh $${opt}
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(srcdir)/autogen.sh ;
+	echo "!!!   configure $${opt}"; \
+	eval $(srcdir)/configure $${opt}
 
-$(top_builddir)/config.status: $(top_srcdir)/configure ;
-
-$(top_srcdir)/configure: $(top_srcdir)/configure.ac ;
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(builddir)/configure
+	$(cmd) cd $(srcdir) && $(AUTOMAKE) --gnu  Makefile
+$(top_srcdir)/configure: $(srcdir)/configure.ac
+	$(cmd) cd $(srcdir) && $(AUTOCONF)
 
 # GNU Make, please don't delete these targets when a target that depends
 # on them fails, 'kay?
diff --git a/autogen.sh b/autogen.sh
index c67298c..28e692f 100755
--- a/autogen.sh
+++ b/autogen.sh
@@ -17,8 +17,8 @@ test -z "$srcdir" && srcdir=.
 ORIGDIR=`pwd`
 cd $srcdir
 
-DIE=0
-
+# XXX: The AM_INIT_AUTOMAKE macro in 'configure.ac' provides (and checks)
+# the version number - so do we need the following code?
 echo -n "Looking for latest automake version ... "
 required_automake_minor=10
 minor=15
@@ -34,15 +34,12 @@ while [ $minor -ge $required_automake_minor ]; do
 done
 
 if [ -z "$AUTOMAKE" ]; then
+    exec 1>&2
     echo
     echo "  You must have automake 1.$required_automake_minor or newer" \
             "installed to compile $PROJECT."
     echo "  Download the appropriate package for your distribution,"
     echo "  or get the source tarball at ftp://ftp.gnu.org/pub/gnu/automake/";
-    DIE=1
-fi
-
-if test "$DIE" -eq 1; then
     echo
     echo "Please install/upgrade the missing tools and call me again."
     echo
@@ -51,6 +48,7 @@ fi
 
 
 test $TEST_TYPE $FILE || {
+    exec 1>&2
     echo
     echo "You must run this script in the top-level $PROJECT directory."
     echo
@@ -92,22 +90,11 @@ fi
 $ACLOCAL $ACLOCAL_FLAGS
 RC=$?
 if test $RC -ne 0; then
-   echo "$ACLOCAL gave errors. Please fix the error conditions and try again."
+   echo >&2 "$ACLOCAL gave errors. Please fix the error conditions and try again."
    exit 1
 fi
 
 $AUTOMAKE --add-missing || exit 1
-if [ -e Makefile.in ]; then
-    sed -e 's/^# HIDE FROM AUTOMAKE #//' \
-        -e '/^all\(-local\)\?:/i\
-\
-\
-'       Makefile.in > Makefile.in.tmp &&
-    mv Makefile.in.tmp Makefile.in
-else
-    echo >&2 "Error: cannot find Makefile.in"
-    exit 1
-fi
 autoconf || exit 1
 
 rm -rf autom4te.cache
@@ -118,7 +105,7 @@ if $srcdir/configure --enable-maintainer-mode "$@"; then
   echo
   echo "Now type 'make' to compile $PROJECT."
 else
-  echo
-  echo "Configure failed or did not finish!"
+  echo >&2
+  echo >&2 "Configure failed or did not finish!"
   exit 1
 fi
diff --git a/configure.ac b/configure.ac
index c9ad58e..0cd767f 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,7 +14,7 @@ AC_INIT([GIMP-Help], [help_version])
 
 AC_CONFIG_SRCDIR([src/gimp.xml])
 
-AM_INIT_AUTOMAKE([1.6 dist-bzip2 -Wall -Wno-portability])
+AM_INIT_AUTOMAKE([1.10 dist-bzip2 -Wall -Wno-portability -Wno-override])
 
 AM_MAINTAINER_MODE
 
@@ -265,6 +265,22 @@ stylesheets/plainhtml.xsl
 stylesheets/htmlalternate.xsl
 ])
 
+# XXX: is there a way to use the relevant (advanced) 'make' features
+#      in 'Makefile.am' without this dirty trick?
+if test -e Makefile.in; then
+    AC_MSG_WARN([GIMP Doc Team is tricking 'automake'])
+    sed -e '# re-enable special Makefile lines which were commented out' \
+        -e '# in "Makefile.am" since "automake" cannot handle them' \
+        -e 's/^# HIDE FROM AUTOMAKE #//' \
+        -e '# the following command is just adding a few newlines' \
+        -e '/^all\(-local\)\?:/i\
+\
+\
+'       Makefile.in > Makefile.in.tmp && mv -f Makefile.in.tmp Makefile.in
+else
+    AC_MSG_ERROR([cannot find 'Makefile.in'])
+fi
+
 AC_OUTPUT
 
 AC_MSG_RESULT([



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