bug-gnulib
[Top][All Lists]
Advanced

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

gnulib-tool: Create distributed built sources also for the tests


From: Bruno Haible
Subject: gnulib-tool: Create distributed built sources also for the tests
Date: Fri, 2 Apr 2010 16:17:32 +0100
User-agent: KMail/1.9.9

So far, "gnulib-tool --create-testdir" creates distributed built sources
(e.g. getdate.c from getdate.y) only in the lib directory. This is also needed
in the tests directory:
  1) because getdate might occur as a test-related module, or
  2) because some tests can also have distributed built sources.


2010-04-02  Bruno Haible  <address@hidden>

        gnulib-tool: Create distributed built sources also for the tests.
        * gnulib-tool (func_create_testdir): Also generate distributed built
        sources in the tests directory.

--- gnulib-tool.orig    Fri Apr  2 16:57:43 2010
+++ gnulib-tool Fri Apr  2 16:57:36 2010
@@ -5122,13 +5122,13 @@
   fi
   # Need to run configure and make once, to create built files that are to be
   # distributed (such as getdate.c).
+  sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
   # Extract the value of "CLEANFILES += ..." and "MOSTLYCLEANFILES += ...".
   cleaned_files=`sed -e "$sed_remove_backslash_newline" < 
"$testdir/$sourcebase/Makefile.am" \
                  | sed -n -e 's,^CLEANFILES[    ]*+=\([^#]*\).*$,\1,p' -e 
's,^MOSTLYCLEANFILES[         ]*+=\([^#]*\).*$,\1,p'`
   cleaned_files=`for file in $cleaned_files; do echo " $file "; done`
   # Extract the value of "BUILT_SOURCES += ...". Remove variable references
   # such $(FOO_H) because they don't refer to distributed files.
-  sed_remove_make_variables='s,[$]([A-Za-z0-9_]*),,g'
   built_sources=`sed -e "$sed_remove_backslash_newline" < 
"$testdir/$sourcebase/Makefile.am" \
                  | sed -n -e 's,^BUILT_SOURCES[         ]*+=\([^#]*\).*$,\1,p' 
\
                  | sed -e "$sed_remove_make_variables"`
@@ -5138,16 +5138,44 @@
                                  *) echo $file ;;
                                esac;
                              done`
-  if test -n "$distributed_built_sources"; then
+  tests_distributed_built_sources=
+  if test -n "$inctests"; then
+    # Likewise for built files in the $testsbase directory.
+    tests_cleaned_files=`sed -e "$sed_remove_backslash_newline" < 
"$testdir/$testsbase/Makefile.am" \
+                         | sed -n -e 's,^CLEANFILES[    ]*+=\([^#]*\).*$,\1,p' 
-e 's,^MOSTLYCLEANFILES[         ]*+=\([^#]*\).*$,\1,p'`
+    tests_cleaned_files=`for file in $tests_cleaned_files; do echo " $file "; 
done`
+    tests_built_sources=`sed -e "$sed_remove_backslash_newline" < 
"$testdir/$testsbase/Makefile.am" \
+                         | sed -n -e 's,^BUILT_SOURCES[         
]*+=\([^#]*\).*$,\1,p' \
+                         | sed -e "$sed_remove_make_variables"`
+    tests_distributed_built_sources=`for file in $tests_built_sources; do
+                                       case "$tests_cleaned_files" in
+                                         *" "$file" "*) ;;
+                                         *) echo $file ;;
+                                       esac;
+                                     done`
+  fi
+  if test -n "$distributed_built_sources" || test -n 
"$tests_distributed_built_sources"; then
     (cd "$testdir"
      ./configure || func_exit 1
-       cd "$sourcebase"
-       echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
-       $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" 
ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" 
AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
-             built_sources \
-         || func_exit 1
-       cd ..
-     $MAKE distclean || func_exit 1
+       if test -n "$distributed_built_sources"; then
+         cd "$sourcebase"
+         echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
+         $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" 
ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" 
AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
+               built_sources \
+           || func_exit 1
+         cd ..
+       fi
+       if test -n "$tests_distributed_built_sources"; then
+         cd "$testsbase"
+         echo 'built_sources: $(BUILT_SOURCES)' >> Makefile
+         $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" 
ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" 
AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
+               built_sources \
+           || func_exit 1
+         cd ..
+       fi
+     $MAKE AUTOCONF="${AUTOCONF}" AUTOHEADER="${AUTOHEADER}" 
ACLOCAL="${ACLOCAL}" AUTOMAKE="${AUTOMAKE}" AUTORECONF="${AUTORECONF}" 
AUTOPOINT="${AUTOPOINT}" LIBTOOLIZE="${LIBTOOLIZE}" \
+           distclean \
+       || func_exit 1
     ) || func_exit 1
   fi
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]