From 9abc30c383303fab68aa5ed2841113876bfa90d1 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 8 Jan 2022 22:10:54 +0100 Subject: [PATCH] gnulib-tool: Remove all *.Po files upon distclean (regr. 2022-01-05). Reported by Mohammad Akhlaghi in . * 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 | 10 ++++++++++ gnulib-tool | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/ChangeLog b/ChangeLog index 7a53784ccf..332d511595 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2022-01-08 Bruno Haible + + gnulib-tool: Remove all *.Po files upon distclean (regr. 2022-01-05). + Reported by Mohammad Akhlaghi in + . + * 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 Add another example. diff --git a/gnulib-tool b/gnulib-tool index a91847f55a..6f2b10cf79 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -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 " ])" } -- 2.39.5