Synthesize also an EXTRA_lib_SOURCES augmentation.
authorBruno Haible <bruno@clisp.org>
Mon, 13 Nov 2006 12:33:07 +0000 (12:33 +0000)
committerBruno Haible <bruno@clisp.org>
Mon, 13 Nov 2006 12:33:07 +0000 (12:33 +0000)
ChangeLog
gnulib-tool

index 16f0e1a548641a3d440998de435c6a9d0d4389f0..cee682d420fe170c8d4cae4eb3ab9a6adb65c851 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2006-11-12  Bruno Haible  <bruno@clisp.org>
+
+       * gnulib-tool (func_get_automake_snippet): Synthesize also an
+       EXTRA_lib_SOURCES augmentation.
+       (func_emit_lib_Makefile_am): Initialize EXTRA_lib..._SOURCES to empty.
+
 2006-11-12  Jim Meyering  <jim@meyering.net>
 
        Make fts (in FTS_CWDFD mode) more efficient by caching a few open
index 0f1eb4912432f7266d407925a6f502c62e7a6adb..3c337e17ce12f494fb5eeab7d66b8e2c4167f748 100755 (executable)
@@ -22,7 +22,7 @@
 
 progname=$0
 package=gnulib
-cvsdatestamp='$Date: 2006-11-12 09:53:16 $'
+cvsdatestamp='$Date: 2006-11-13 12:33:07 $'
 last_checkin_date=`echo "$cvsdatestamp" | sed -e 's,^\$[D]ate: ,,'`
 version=`echo "$last_checkin_date" | sed -e 's/ .*$//' -e 's,/,-,g'`
 nl='
@@ -939,6 +939,23 @@ func_get_automake_snippet ()
         echo "EXTRA_DIST +=" $extra_files
         echo
       fi
+      # Synthesize also an EXTRA_lib_SOURCES augmentation.
+      # This is necessary so that automake can generate the right list of
+      # dependency rules.
+      # A possible approach would be to use autom4te --trace of the redefined
+      # AC_LIBOBJ and AC_REPLACE_FUNCS macros when creating the Makefile.am
+      # (use autom4te --trace, not just grep, so that AC_LIBOBJ invocations
+      # inside autoconf's built-in macros are not missed).
+      # But it's simpler and more robust to do it here, based on the file list.
+      # If some .c file exists and is not used with AC_LIBOBJ - for example,
+      # a .c file is preprocessed into another .c file for BUILT_SOURCES -,
+      # automake will generate a useless dependency; this is harmless.
+      sed_extract_c_files='/\.c$/p'
+      extra_files=`echo "$extra_files" | sed -n -e "$sed_extract_c_files"`
+      if test -n "$extra_files"; then
+        echo "EXTRA_lib_SOURCES +=" $extra_files
+        echo
+      fi
       ;;
   esac
 }
@@ -1186,6 +1203,7 @@ func_emit_lib_Makefile_am ()
   # automake during its analyses looks for $(LIBOBJS), not for @LIBOBJS@.
   echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
   echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)"
+  echo "EXTRA_${libname}_${libext}_SOURCES ="
   if test "$libtool" = true; then
     echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)"
   fi