+2024-02-23 Collin Funk <collin.funk1@gmail.com>
+
+ gnulib-tool.py: Follow gnulib-tool changes, part 27.
+ Follow gnulib-tool changes
+ 2017-03-12 Paul Eggert <eggert@cs.ucla.edu>
+ gnulib-tool: new option --gnu-make
+ 2017-03-13 Paul Eggert <eggert@cs.ucla.edu>
+ gnulib-tool: minor --gnu-make fixups
+ 2017-03-14 Paul Eggert <eggert@cs.ucla.edu>
+ gnulib-tool: fix typo in comment output
+ 2017-05-14 Paul Eggert <eggert@cs.ucla.edu>
+ gnulib-tool: improve GNU Make debugging
+ 2018-07-04 Paul Eggert <eggert@cs.ucla.edu>
+ gnulib-tool: minor tweaks for --gnu-make
+ * gnulib-tool.py (main): Add --gnu-make option. Do not allow --gnu-make
+ in test modes, since they all require Automake.
+ * pygnulib/GLConfig.py: Add gnu_make argument to constructor.
+ (getGnuMake, setGnuMake, resetGnuMake): New methods for accessing the
+ gnu_make instance variable.
+ * pygnulib/GLEmiter.py (GLEmiter.lib_Makefile_am): Use the "+=" operator
+ with GNU Make and Automake. Transform conditionals to GNU Make syntax if
+ --gnu-make is in use. Use a Autoconf subprocess to define values and
+ check the return code for errors.
+ (GLEmiter.tests_Makefile_am): Likewise.
+ * pygnulib/GLImport.py (GLImport.actioncmd): Add "--gnu-make" to the
+ output comment if it is in use.
+ (GLImport.gnulib_comp): Don't require "AM_PROG_CC_C_O" when using GNU
+ Make.
+ * pygnulib/GLInfo.py (GLInfo.usage): Update help message to reflect
+ addition of --gnu-make.
+ * pygnulib/GLModuleSystem.py (GLModuleTable.transitive_closure): Don't
+ add Automake snippets as unconditional dependencies when using
+ --gnu-make.
+
2024-02-23 Bruno Haible <bruno@clisp.org>
unistdio/*printf tests: Update expected test results regarding %n.
action='append',
choices=['2', '3orGPLv2', '3'],
nargs='?')
+ # gnu-make
+ parser.add_argument('--gnu-make',
+ dest='gnu_make',
+ default=None,
+ action='store_true')
# makefile-name
parser.add_argument('--makefile-name',
dest='makefile_name',
if cmdargs.pobase == None and cmdargs.podomain != None:
message = '%s: warning: --po-domain has no effect without a --po-base option\n' % constants.APP['name']
sys.stderr.write(message)
+ if modules != None and "tests" in mode and gnu_make:
+ message = '%s: --gnu-make not supported when including tests\n' % constants.APP['name']
+ sys.stderr.write(message)
+ sys.exit(1)
# Determine specific settings.
destdir = cmdargs.destdir
lgpl = True
cond_dependencies = cmdargs.cond_dependencies
libtool = cmdargs.libtool
+ gnu_make = cmdargs.gnu_make == True
makefile_name = cmdargs.makefile_name
if makefile_name != None:
makefile_name = makefile_name[0]
excl_test_categories=excl_test_categories,
libname=libname,
lgpl=lgpl,
+ gnu_make=gnu_make,
makefile_name=makefile_name,
libtool=libtool,
conddeps=cond_dependencies,
--------------------------------------------------------------------------------
-commit 60e8b9303d8ce312bb2322d4801ed08678f93d1e
-Author: Paul Eggert <eggert@cs.ucla.edu>
-Date: Wed Jul 4 20:42:07 2018 -0700
-
- gnulib-tool: minor tweaks for --gnu-make
-
- * gnulib-tool: Do not allow --gnu-make in test modes,
- since they all require automake.
- (func_emit_lib_Makefile_am): Don’t emit automake comment
- if --gnu-make.
-
-commit 8224d65142d7b8cea2b8721a7d09c2cd60d2d312
-Author: Paul Eggert <eggert@cs.ucla.edu>
-Date: Mon May 15 07:41:10 2017 -0700
-
- gnulib-tool: improve GNU Make debugging
-
- * gnulib-tool (func_emit_lib_Makefile_am): Omit unnecessary echo.
- Report autoconf diagnostics when it fails, in the output makefile.
-
-commit fb8289f44a58c9462434eba8eaffd58c3f417c42
-Author: Paul Eggert <eggert@cs.ucla.edu>
-Date: Tue Mar 14 08:39:27 2017 -0700
-
- gnulib-tool: fix typo in comment output
-
- * gnulib-tool (func_import): Fix typo with previous change.
-
-commit d6088547633af472625ab815452004c22fda6d58
-Author: Paul Eggert <eggert@cs.ucla.edu>
-Date: Mon Mar 13 15:50:44 2017 -0700
-
- gnulib-tool: minor --gnu-make fixups
-
- * gnulib-tool (func_emit_lib_Makefile_am):
- Remove useless code that was a blind alley during implementation.
- Problem reported by Thien-Thi Nguyen in:
- http://lists.gnu.org/archive/html/bug-gnulib/2017-03/msg00029.html
- (func_import): Note the "--gnu-make" option in the output comment.
-
-commit dfbe4c0276701e42ffaed13a1c7a79003dc8fb30
-Author: Paul Eggert <eggert@cs.ucla.edu>
-Date: Sun Mar 12 19:18:53 2017 -0700
-
- gnulib-tool: new option --gnu-make
-
- This is for applications like GNU Emacs that use GNU Make
- features instead of Automake.
- * doc/gnulib-tool.texi (Initial import): Mention --gnu-make.
- * doc/gnulib.texi (Unit test modules, Build robot for gnulib):
- Do not assume Automake.
- * gnulib-tool (func_determine_path_separator)
- (func_modules_transitive_closure, func_update_file)
- (func_emit_lib_Makefile_am, func_emit_tests_Makefile_am)
- (func_import): Add support for --gnu-make.
-
---------------------------------------------------------------------------------
-
commit 9bdf6c8a0cdeb13c12e4b65dee9538c5468dbe1d
Author: Bruno Haible <bruno@clisp.org>
Date: Sun Aug 19 14:06:50 2012 +0200
sourcebase=None, m4base=None, pobase=None, docbase=None, testsbase=None,
modules=None, avoids=None, files=None,
incl_test_categories=None, excl_test_categories=None, libname=None,
- lgpl=None, makefile_name=None, libtool=None, conddeps=None, macro_prefix=None,
+ lgpl=None, gnu_make=None, makefile_name=None, libtool=None,
+ conddeps=None, macro_prefix=None,
podomain=None, witness_c_macro=None, vc_files=None, symbolic=None,
lsymbolic=None, configure_ac=None, ac_version=None,
libtests=None, single_configure=None, verbose=None, dryrun=None,
self.resetLGPL()
if lgpl != None:
self.setLGPL(lgpl)
+ # gnu-make
+ self.resetGnuMake()
+ if gnu_make != None:
+ self.setGnuMake(gnu_make)
# makefile_name
self.resetMakefileName()
if makefile_name != None:
Default value is None, which means that lgpl is disabled.'''
self.table['lgpl'] = None
+ # Define gnu-make methods.
+ def getGnuMake(self):
+ '''Return a boolean value describing whether the --gnu-make argument
+ was used.'''
+ return self.table['gnu_make']
+
+ def setGnuMake(self, value):
+ '''Set the --gnu-make argument as if it were invoked using the
+ command-line or disable it.'''
+ if type(value) is bool:
+ self.table['gnu_make'] = value
+ else: # if type(value) is not bool
+ raise TypeError('value must be a bool, not %s'
+ % type(value).__name__)
+
+ def resetGnuMake(self):
+ '''Reset the --gnu-make argument to its default. This feature must be
+ explicitly enabled by programs who utilize GNU Make features instead
+ of Autmake.'''
+ self.table['gnu_make'] = False
+
def getModuleIndicatorPrefix(self):
'''Return module_indicator_prefix to use inside GLEmiter class.'''
return self.getIncludeGuardPrefix()
#===============================================================================
# Define global constants
#===============================================================================
+UTILS = constants.UTILS
TESTS = constants.TESTS
joinpath = constants.joinpath
relinverse = constants.relinverse
libname = self.config['libname']
pobase = self.config['pobase']
auxdir = self.config['auxdir']
+ gnu_make = self.config['gnu_make']
makefile_name = self.config['makefile_name']
libtool = self.config['libtool']
macro_prefix = self.config['macro_prefix']
destfile = os.path.normpath(destfile)
emit = ''
- # When creating an includable Makefile.am snippet, augment variables with
- # += instead of assigning them.
- if makefile_name:
+ # When using GNU make, or when creating an includable Makefile.am snippet,
+ # augment variables with += instead of assigning them.
+ if gnu_make or makefile_name:
assign = '+='
else: # if not makefile_name
assign = '='
else: # if not for_test
edit_check_PROGRAMS = False
emit += "## DO NOT EDIT! GENERATED AUTOMATICALLY!\n"
- emit += "## Process this file with automake to produce Makefile.in.\n"
+ if not gnu_make:
+ emit += "## Process this file with automake to produce Makefile.in.\n"
emit += self.copyright_notice()
if actioncmd:
# The maximum line length (excluding the terminating newline) of
'$(' + module_indicator_prefix + '_GNULIB_')
# Skip the contents if it's entirely empty.
if not (amsnippet1 + amsnippet2).isspace():
- allsnippets += '## begin gnulib module %s\n\n' % str(module)
+ allsnippets += '## begin gnulib module %s\n' % str(module)
+ if gnu_make:
+ allsnippets += 'ifeq (,$(OMIT_GNULIB_MODULE_%s))\n' % str(module)
+ convert_to_gnu_make = True
+ else:
+ convert_to_gnu_make = False
+ allsnippets += '\n'
if conddeps:
if moduletable.isConditional(module):
name = module.getConditionalName()
- allsnippets += 'if %s\n' % name
- allsnippets += amsnippet1
+ if gnu_make:
+ allsnippets += 'ifneq (,$(%s))\n' % name
+ else:
+ allsnippets += 'if %s\n' % name
+ if convert_to_gnu_make:
+ allsnippets += re.sub(r'^if (.*)', r'ifneq (,$(\1))', amsnippet1)
+ else:
+ allsnippets += amsnippet1
if conddeps:
if moduletable.isConditional(module):
allsnippets += 'endif\n'
- allsnippets += amsnippet2
+ if convert_to_gnu_make:
+ allsnippets += re.sub(r'^if (.*)', r'ifneq (,$(\1))', amsnippet2)
+ else:
+ allsnippets += amsnippet2
+ if gnu_make:
+ allsnippets += 'endif\n'
allsnippets += '## end gnulib module %s\n\n' % str(module)
# Test whether there are some source files in subdirectories.
emit += 'DISTCLEANFILES =\n'
emit += 'MAINTAINERCLEANFILES =\n'
+ if gnu_make:
+ emit += '# Start of GNU Make output.\n'
+ result = sp.run([UTILS['autoconf'], '-t', 'AC_SUBST:$1 = @$1@',
+ joinpath(self.config['destdir'], 'configure.ac')],
+ capture_output=True)
+ if result.returncode == 0:
+ # sort -u
+ emit += '\n'.join(sorted(list(set(x.strip() for x in
+ result.stdout.decode(encoding='utf-8').splitlines()))))
+ emit += '\n'
+ else:
+ emit += '== gnulib-tool GNU Make output failed as follows ==\n'
+ emit += ['# stderr: ' + x + '\n' for x in
+ result.stderr.decode(encoding='utf-8').splitlines()]
+ emit += '# End of GNU Make output.\n'
+ else:
+ emit += '# No GNU Make output.\n'
+
# Execute edits that apply to the Makefile.am being generated.
for current_edit in range(0, makefiletable.count()):
dictionary = makefiletable[current_edit]
m4base = self.config['m4base']
pobase = self.config['pobase']
testsbase = self.config['testsbase']
+ gnu_make = self.config['gnu_make']
makefile_name = self.config['makefile_name']
libtool = self.config['libtool']
macro_prefix = self.config['macro_prefix']
# Skip the contents if it's entirely empty.
if not snippet.isspace():
- snippet = ('## begin gnulib module %s\n\n' % str(module)
- + snippet
- + '## end gnulib module %s\n\n' % str(module))
+ nonwrapped_snippet = snippet
+ snippet = '## begin gnulib module %s\n' % str(module)
+ if gnu_make:
+ snippet += 'ifeq (,$(OMIT_GNULIB_MODULE_%s))\n' % str(module)
+ snippet += '\n'
+ snippet += nonwrapped_snippet
+ if gnu_make:
+ snippet += 'endif\n'
+ snippet += '## end gnulib module %s\n' % str(module)
+ snippet += '\n'
# Mention long-running tests at the end.
if 'longrunning-test' in module.getStatuses():
longrun_snippets += snippet
conddeps = self.config.checkCondDeps()
libname = self.config.getLibName()
lgpl = self.config.getLGPL()
+ gnu_make = self.config.getGnuMake()
makefile_name = self.config.getMakefileName()
libtool = self.config.checkLibtool()
macro_prefix = self.config.getMacroPrefix()
actioncmd += ' --lgpl'
else: # if lgpl != True
actioncmd += ' --lgpl=%s' % lgpl
+ if gnu_make:
+ actioncmd += ' --gnu-make'
if makefile_name:
actioncmd += ' --makefile-name=%s' % makefile_name
if conddeps:
testsbase = self.config['testsbase']
lgpl = self.config['lgpl']
libname = self.config['libname']
+ gnu_make = self.config['gnu_make']
makefile_name = self.config['makefile_name']
conddeps = self.config['conddeps']
libtool = self.config['libtool']
and file.count('/') > 1):
uses_subdirs = True
break
- if uses_subdirs:
+ if not gnu_make and uses_subdirs:
emit += ' AC_REQUIRE([AM_PROG_CC_C_O])\n'
for module in moduletable['final']:
emit += ' # Code from module %s:\n' % str(module)
placed (default \"tests\").
--aux-dir=DIRECTORY Directory relative to --dir where auxiliary build
tools are placed (default comes from configure.ac).
+ --gnu-make Output for GNU Make instead of for the default
+ Automake
--lgpl[=2|=3orGPLv2|=3]
Abort if modules aren't available under the LGPL.
Also modify license template from GPL to LGPL.
The version number of the LGPL can be specified;
the default is currently LGPLv3.
- --makefile-name=NAME Name of makefile in automake syntax in the
- source-base and tests-base directories
- (default \"Makefile.am\").
+ --makefile-name=NAME Name of makefile in the source-base and tests-base
+ directories (default \"Makefile.am\", or
+ \"Makefile.in\" if --gnu-make).
--macro-prefix=PREFIX Specify the prefix of the macros 'gl_EARLY' and
'gl_INIT'. Default is 'gl'.
--po-domain=NAME Specify the prefix of the i18n domain. Usually use
automake_snippet = \
module.getAutomakeSnippet_Conditional()
pattern = re.compile('^if', re.M)
- if not pattern.findall(automake_snippet):
+ if not self.config['gnu_make'] and not pattern.findall(automake_snippet):
# A module whose Makefile.am snippet contains a
# reference to an automake conditional. If we were
# to use it conditionally, we would get an error