]> Savannah Git Hosting - gnulib.git/commitdiff
gnulib-tool: Remove all *.Po files upon distclean (regr. 2022-01-05).
authorBruno Haible <bruno@clisp.org>
Sat, 8 Jan 2022 21:10:54 +0000 (22:10 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 8 Jan 2022 21:10:54 +0000 (22:10 +0100)
Reported by Mohammad Akhlaghi <mohammad@akhlaghi.org> in
<https://lists.gnu.org/archive/html/bug-gnulib/2022-01/msg00061.html>.

* gnulib-tool (func_emit_initmacro_end): Collect the *.Po or *.Plo files
to remove into an AC_SUBSTed variable gl_LIBOBJDEPS.
(func_emit_lib_Makefile_am): Extend the distclean and maintainer-clean
rules.

ChangeLog
gnulib-tool

index 7a53784ccfc0bc8e7c41e80ce59eae379727bd1a..332d511595c481acc2f40d654ba29b5cc18b6cb7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2022-01-08  Bruno Haible  <bruno@clisp.org>
+
+       gnulib-tool: Remove all *.Po files upon distclean (regr. 2022-01-05).
+       Reported by Mohammad Akhlaghi <mohammad@akhlaghi.org> in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2022-01/msg00061.html>.
+       * gnulib-tool (func_emit_initmacro_end): Collect the *.Po or *.Plo files
+       to remove into an AC_SUBSTed variable gl_LIBOBJDEPS.
+       (func_emit_lib_Makefile_am): Extend the distclean and maintainer-clean
+       rules.
+
 2022-01-08  Bruno Haible  <bruno@clisp.org>
 
        Add another example.
index a91847f55a5a85bf7d41bca492681faad6b38521..6f2b10cf7999cc1ecd0b58aa957995c2030b8817 100755 (executable)
@@ -4012,6 +4012,13 @@ func_emit_lib_Makefile_am ()
   echo "         fi; \\"
   echo "       done; \\"
   echo "       :"
+  # Emit rules to erase .Po and .Plo files for AC_LIBOBJ invocations.
+  # Extend the 'distclean' rule.
+  echo "distclean-local: distclean-gnulib-libobjs"
+  echo "distclean-gnulib-libobjs:"
+  echo "       -rm -f @${macro_prefix}_LIBOBJDEPS@"
+  # Extend the 'maintainer-clean' rule.
+  echo "maintainer-clean-local: distclean-gnulib-libobjs"
   rm -f "$tmp"/allsnippets
 }
 
@@ -4481,6 +4488,8 @@ func_emit_initmacro_start ()
 # - gentests                 true if a tests Makefile.am is being generated,
 #                            false otherwise
 # - automake_subdir  true if --automake-subdir was given, false otherwise
+# - libtool         true if --libtool was given, false if --no-libtool was
+#                   given, blank otherwise
 func_emit_initmacro_end ()
 {
   macro_prefix_arg="$1"
@@ -4509,9 +4518,17 @@ func_emit_initmacro_end ()
   echo "  AC_CONFIG_COMMANDS_PRE(["
   echo "    ${macro_prefix_arg}_libobjs="
   echo "    ${macro_prefix_arg}_ltlibobjs="
+  echo "    ${macro_prefix_arg}_libobjdeps="
   echo "    if test -n \"\$${macro_prefix_arg}_LIBOBJS\"; then"
   echo "      # Remove the extension."
+  echo "changequote(,)dnl"
   echo "      sed_drop_objext='s/\\.o\$//;s/\\.obj\$//'"
+  echo "      sed_dirname1='s,//*,/,g'"
+  echo "      sed_dirname2='s,\\(.\\)/\$,\\1,'"
+  echo "      sed_dirname3='s,^[^/]*\$,.,'"
+  echo "      sed_dirname4='s,\\(.\\)/[^/]*\$,\\1,'"
+  echo "      sed_basename1='s,.*/,,'"
+  echo "changequote([, ])dnl"
   if $automake_subdir && ! "$2" && test -n "$sourcebase" && test "$sourcebase" != '.'; then
     subdir="$sourcebase/"
   else
@@ -4520,10 +4537,18 @@ func_emit_initmacro_end ()
   echo "      for i in \`for i in \$${macro_prefix_arg}_LIBOBJS; do echo \"\$i\"; done | sed -e \"\$sed_drop_objext\" | sort | uniq\`; do"
   echo "        ${macro_prefix_arg}_libobjs=\"\$${macro_prefix_arg}_libobjs ${subdir}\$i.\$ac_objext\""
   echo "        ${macro_prefix_arg}_ltlibobjs=\"\$${macro_prefix_arg}_ltlibobjs ${subdir}\$i.lo\""
+  echo "        i_dir=\`echo \"\$i\" | sed -e \"\$sed_dirname1\" -e \"\$sed_dirname2\" -e \"\$sed_dirname3\" -e \"\$sed_dirname4\"\`"
+  echo "        i_base=\`echo \"\$i\" | sed -e \"\$sed_basename1\"\`"
+  if test "$libtool" = true; then
+    echo "        ${macro_prefix_arg}_libobjdeps=\"\$${macro_prefix_arg}_libobjdeps ${subdir}\$i_dir/\\\$(DEPDIR)/\$i_base.Plo\""
+  else
+    echo "        ${macro_prefix_arg}_libobjdeps=\"\$${macro_prefix_arg}_libobjdeps ${subdir}\$i_dir/\\\$(DEPDIR)/\$i_base.Po\""
+  fi
   echo "      done"
   echo "    fi"
   echo "    AC_SUBST([${macro_prefix_arg}_LIBOBJS], [\$${macro_prefix_arg}_libobjs])"
   echo "    AC_SUBST([${macro_prefix_arg}_LTLIBOBJS], [\$${macro_prefix_arg}_ltlibobjs])"
+  echo "    AC_SUBST([${macro_prefix_arg}_LIBOBJDEPS], [\$${macro_prefix_arg}_libobjdeps])"
   echo "  ])"
 }