+2024-03-12 Collin Funk <collin.funk1@gmail.com>
+
+ gnulib-tool.py: Follow gnulib-tool changes, part 55.
+ Follow gnulib-tool changes
+ 2022-01-05 Bruno Haible <bruno@clisp.org>
+ gnulib-tool: Avoid known warnings that reflect Gnulib's coding style.
+ 2022-01-08 Bruno Haible <bruno@clisp.org>
+ gnulib-tool: Remove all *.Po files upon distclean (regr. 2022-01-05).
+ * pygnulib/GLEmiter.py (GLEmiter.initmacro_end): Collect the *.Po or
+ *.Plo files to remove into an AC_SUBSTed variable gl_LIBOBJDEPS. Use
+ Python f-strings instead of string replacements.
+ (GLEmiter.lib_Makefile_am): Add the GL_CFLAG_GNULIB_WARNINGS to the
+ CFLAGS of all the compilation units of the library. Extend the distclean
+ and maintainer-clean rules.
+ (GLEmiter.tests_Makefile_am): Add the GL_CFLAG_GNULIB_WARNINGS to the
+ CFLAGS.
+ * pygnulib/GLImport.py (GLImport.gnulib_comp): Emit an invocation of
+ gl_CC_GNULIB_WARNINGS.
+
2024-03-11 Collin Funk <collin.funk1@gmail.com>
gnulib-tool.py: Follow gnulib-tool changes, part 54.
--------------------------------------------------------------------------------
-commit 9abc30c383303fab68aa5ed2841113876bfa90d1
-Author: Bruno Haible <bruno@clisp.org>
-Date: Sat Jan 8 22:10:54 2022 +0100
-
- 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.
-
-commit 0c8a563f65d44752b33aec42cceec25bd485f2d5
-Author: Bruno Haible <bruno@clisp.org>
-Date: Wed Jan 5 18:21:55 2022 +0100
-
- gnulib-tool: Avoid known warnings that reflect Gnulib's coding style.
-
- * m4/gnulib-common.m4 (gl_CC_GNULIB_WARNINGS): New macro.
- * gnulib-tool (func_emit_lib_Makefile_am): Add the
- GL_CFLAG_GNULIB_WARNINGS to the CFLAGS of all the compilation units of
- the library.
- (func_emit_tests_Makefile_am): Add the GL_CFLAG_GNULIB_WARNINGS to the
- CFLAGS.
- (func_import): Emit an invocation of gl_CC_GNULIB_WARNINGS.
-
---------------------------------------------------------------------------------
-
commit 87e6634b28df65084321fed22f60d114a0931d21
Author: Bernhard Voelker <mail@bernhard-voelker.de>
Date: Tue Jan 4 00:16:50 2022 +0100
% type(gentests).__name__)
sourcebase = self.config['sourcebase']
automake_subdir = self.config['automake_subdir']
+ libtool = self.config['libtool']
emit = ''
# Check the presence of files that are mentioned as AC_LIBSOURCES
# arguments. The check is performed only when autoconf is run from the
subdir = f'{sourcebase}/'
else:
subdir = ''
- emit += r'''
- m4_ifval(%V1%_LIBSOURCES_LIST, [
- m4_syscmd([test ! -d ]m4_defn([%V1%_LIBSOURCES_DIR])[ ||
- for gl_file in ]%V1%_LIBSOURCES_LIST[ ; do
- if test ! -r ]m4_defn([%V1%_LIBSOURCES_DIR])[/$gl_file ; then
- echo "missing file ]m4_defn([%V1%_LIBSOURCES_DIR])[/$gl_file" >&2
+ if libtool:
+ libobjdeps = f'{macro_prefix_arg}_libobjdeps="${macro_prefix_arg}_libobjdeps {subdir}$i_dir/\$(DEPDIR)/$i_base.Plo"'
+ else:
+ libobjdeps = f'{macro_prefix_arg}_libobjdeps="${macro_prefix_arg}_libobjdeps {subdir}$i_dir/\$(DEPDIR)/$i_base.Po"'
+ emit += fr'''
+ m4_ifval({macro_prefix_arg}_LIBSOURCES_LIST, [
+ m4_syscmd([test ! -d ]m4_defn([{macro_prefix_arg}_LIBSOURCES_DIR])[ ||
+ for gl_file in ]{macro_prefix_arg}_LIBSOURCES_LIST[ ; do
+ if test ! -r ]m4_defn([{macro_prefix_arg}_LIBSOURCES_DIR])[/$gl_file ; then
+ echo "missing file ]m4_defn([{macro_prefix_arg}_LIBSOURCES_DIR])[/$gl_file" >&2
exit 1
fi
done])dnl
])
m4_popdef([GL_MODULE_INDICATOR_PREFIX])
m4_popdef([GL_MACRO_PREFIX])
- m4_popdef([%V1%_LIBSOURCES_DIR])
- m4_popdef([%V1%_LIBSOURCES_LIST])
+ m4_popdef([{macro_prefix_arg}_LIBSOURCES_DIR])
+ m4_popdef([{macro_prefix_arg}_LIBSOURCES_LIST])
m4_popdef([AC_LIBSOURCES])
m4_popdef([AC_REPLACE_FUNCS])
m4_popdef([AC_LIBOBJ])
AC_CONFIG_COMMANDS_PRE([
- %V1%_libobjs=
- %V1%_ltlibobjs=
- if test -n "$%V1%_LIBOBJS"; then
+ {macro_prefix_arg}_libobjs=
+ {macro_prefix_arg}_ltlibobjs=
+ {macro_prefix_arg}_libobjdeps=
+ if test -n "${macro_prefix_arg}_LIBOBJS"; then
# Remove the extension.
+changequote(,)dnl
sed_drop_objext='s/\.o$//;s/\.obj$//'
- for i in `for i in $%V1%_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
- %V1%_libobjs="$%V1%_libobjs %V2%$i.$ac_objext"
- %V1%_ltlibobjs="$%V1%_ltlibobjs %V2%$i.lo"
+ sed_dirname1='s,//*,/,g'
+ sed_dirname2='s,\(.\)/$,\1,'
+ sed_dirname3='s,^[^/]*$,.,'
+ sed_dirname4='s,\(.\)/[^/]*$,\1,'
+ sed_basename1='s,.*/,,'
+changequote([, ])dnl
+ for i in `for i in ${macro_prefix_arg}_LIBOBJS; do echo "$i"; done | sed -e "$sed_drop_objext" | sort | uniq`; do
+ {macro_prefix_arg}_libobjs="${macro_prefix_arg}_libobjs {subdir}$i.$ac_objext"
+ {macro_prefix_arg}_ltlibobjs="${macro_prefix_arg}_ltlibobjs {subdir}$i.lo"
+ i_dir=`echo "$i" | sed -e "$sed_dirname1" -e "$sed_dirname2" -e "$sed_dirname3" -e "$sed_dirname4"`
+ i_base=`echo "$i" | sed -e "$sed_basename1"`
+ {libobjdeps}
done
fi
- AC_SUBST([%V1%_LIBOBJS], [$%V1%_libobjs])
- AC_SUBST([%V1%_LTLIBOBJS], [$%V1%_ltlibobjs])
+ AC_SUBST([{macro_prefix_arg}_LIBOBJS], [${macro_prefix_arg}_libobjs])
+ AC_SUBST([{macro_prefix_arg}_LTLIBOBJS], [${macro_prefix_arg}_ltlibobjs])
+ AC_SUBST([{macro_prefix_arg}_LIBOBJDEPS], [${macro_prefix_arg}_libobjdeps])
])
'''
- emit = emit.replace('%V1%', macro_prefix_arg)
- emit = emit.replace('%V2%', subdir)
return emit
def initmacro_done(self, macro_prefix_arg, sourcebase_arg):
emit += '\n'
emit += '%s_%s_SOURCES =\n' % (libname, libext)
+ if not for_test:
+ emit += '%s_%s_CFLAGS = $(AM_CFLAGS) $(GL_CFLAG_GNULIB_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_%sLIBOBJS)\n' % (libname, libext, macro_prefix, perhapsLT)
emit += '\t fi; \\\n'
emit += '\tdone; \\\n'
emit += '\t:\n'
+ # Emit rules to erase .Po and .Plo files for AC_LIBOBJ invocations.
+ # Extend the 'distclean' rule.
+ emit += 'distclean-local: distclean-gnulib-libobjs\n'
+ emit += 'distclean-gnulib-libobjs:\n'
+ emit += '\t-rm -f @%s_LIBOBJDEPS@\n' % (macro_prefix)
+ # Extend the 'maintainer-clean' rule.
+ emit += 'maintainer-clean-local: distclean-gnulib-libobjs\n'
result = tuple([emit, uses_subdirs])
return result
# CFLAGS, they have asked for errors, they will get errors. But they have
# no right to complain about these errors, because Gnulib does not support
# '-Werror'.
- emit += 'CFLAGS = @GL_CFLAG_ALLOW_WARNINGS@ @CFLAGS@\n'
+ cflags_for_gnulib_code = ''
+ if not for_test:
+ # Enable or disable warnings as suitable for the Gnulib coding style.
+ cflags_for_gnulib_code = ' $(GL_CFLAG_GNULIB_WARNINGS)'
+ emit += 'CFLAGS = @GL_CFLAG_ALLOW_WARNINGS@%s @CFLAGS@\n' % (cflags_for_gnulib_code)
emit += 'CXXFLAGS = @GL_CXXFLAG_ALLOW_WARNINGS@ @CXXFLAGS@\n'
emit += '\n'