diff --git a/ChangeLog b/ChangeLog index 5b85354635..f1b421c505 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2025-02-04 Bruno Haible + + gnulib-tool: Fix the result of --create-testdir (regression yesterday). + * gnulib-tool.sh (func_emit_lib_Makefile_am): If $for_test, revert to + the previous code. + * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): If for_test, revert + to the previous code. + 2025-02-04 Bruno Haible *vasnprintf: Add a stricter runtime check. diff --git a/gnulib-tool.sh b/gnulib-tool.sh index bddd3073d6..0fbd805ebe 100755 --- a/gnulib-tool.sh +++ b/gnulib-tool.sh @@ -4044,8 +4044,16 @@ func_emit_lib_Makefile_am () fi # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However, # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@. - echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${libname}_${perhapsLT}LIBOBJS)" - echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${libname}_${perhapsLT}LIBOBJS)" + if ! $for_test; then + # When there is a ${libname}_${libext}_CFLAGS or ${libname}_${libext}_CPPFLAGS + # definition, Automake emits rules for creating object files prefixed with + # "${libname}_${libext}-". + echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${libname}_${perhapsLT}LIBOBJS)" + echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${libname}_${perhapsLT}LIBOBJS)" + else + echo "${libname}_${libext}_LIBADD = \$(${macro_prefix}_${perhapsLT}LIBOBJS)" + echo "${libname}_${libext}_DEPENDENCIES = \$(${macro_prefix}_${perhapsLT}LIBOBJS)" + fi echo "EXTRA_${libname}_${libext}_SOURCES =" if test "$libtool" = true; then echo "${libname}_${libext}_LDFLAGS = \$(AM_LDFLAGS)" @@ -4081,7 +4089,14 @@ func_emit_lib_Makefile_am () # Extend the 'distclean' rule. echo "distclean-local: distclean-gnulib-libobjs" echo "distclean-gnulib-libobjs:" - echo " -rm -f @${macro_prefix}_${libname}_LIBOBJDEPS@" + if ! $for_test; then + # When there is a ${libname}_${libext}_CFLAGS or ${libname}_${libext}_CPPFLAGS + # definition, Automake emits rules for creating object files prefixed with + # "${libname}_${libext}-". + echo " -rm -f @${macro_prefix}_${libname}_LIBOBJDEPS@" + else + echo " -rm -f @${macro_prefix}_LIBOBJDEPS@" + fi # Extend the 'maintainer-clean' rule. echo "maintainer-clean-local: distclean-gnulib-libobjs" rm -f "$tmp"/allsnippets diff --git a/pygnulib/GLEmiter.py b/pygnulib/GLEmiter.py index 814ccae571..cf16dd8654 100644 --- a/pygnulib/GLEmiter.py +++ b/pygnulib/GLEmiter.py @@ -929,8 +929,15 @@ def lib_Makefile_am(self, destfile: str, modules: list[GLModule], moduletable: G emit += '%s_%s_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_WARNINGS) $(GL_CFLAG_ALLOW_WARNINGS)\n' % (libname, libext) # Here we use $(LIBOBJS), not @LIBOBJS@. The value is the same. However, # automake during its analysis looks for $(LIBOBJS), not for @LIBOBJS@. - emit += '%s_%s_LIBADD = $(%s_%s_%sLIBOBJS)\n' % (libname, libext, macro_prefix, libname, perhapsLT) - emit += '%s_%s_DEPENDENCIES = $(%s_%s_%sLIBOBJS)\n' % (libname, libext, macro_prefix, libname, perhapsLT) + if not for_test: + # When there is a {libname}_{libext}_CFLAGS or {libname}_{libext}_CPPFLAGS + # definition, Automake emits rules for creating object files prefixed with + # "{libname}_{libext}-". + emit += '%s_%s_LIBADD = $(%s_%s_%sLIBOBJS)\n' % (libname, libext, macro_prefix, libname, perhapsLT) + emit += '%s_%s_DEPENDENCIES = $(%s_%s_%sLIBOBJS)\n' % (libname, libext, macro_prefix, libname, perhapsLT) + else: + emit += '%s_%s_LIBADD = $(%s_%sLIBOBJS)\n' % (libname, libext, macro_prefix, perhapsLT) + emit += '%s_%s_DEPENDENCIES = $(%s_%sLIBOBJS)\n' % (libname, libext, macro_prefix, perhapsLT) emit += 'EXTRA_%s_%s_SOURCES =\n' % (libname, libext) if libtool: emit += '%s_%s_LDFLAGS = $(AM_LDFLAGS)\n' % (libname, libext) @@ -969,7 +976,13 @@ def lib_Makefile_am(self, destfile: str, modules: list[GLModule], moduletable: G # Extend the 'distclean' rule. emit += 'distclean-local: distclean-gnulib-libobjs\n' emit += 'distclean-gnulib-libobjs:\n' - emit += '\t-rm -f @%s_%s_LIBOBJDEPS@\n' % (macro_prefix, libname) + if not for_test: + # When there is a {libname}_{libext}_CFLAGS or {libname}_{libext}_CPPFLAGS + # definition, Automake emits rules for creating object files prefixed with + # "{libname}_{libext}-". + emit += '\t-rm -f @%s_%s_LIBOBJDEPS@\n' % (macro_prefix, libname) + else: + emit += '\t-rm -f @%s_LIBOBJDEPS@\n' % (macro_prefix) # Extend the 'maintainer-clean' rule. emit += 'maintainer-clean-local: distclean-gnulib-libobjs\n' return emit