main.c (find_and_set_default_shell): Don't use file_exists_p or
dir_file_exists_p, as those call readdir, which can fail if PATH
includes directories with non-ASCII characters, and that would
cause Make to fail at startup with confusing diagnostics. See
https://sourceforge.net/mailarchive/message.php?msg_id=30846737
for the details.
In various places we were passing flags and characters to compare, then
using complex conditionals to see where to stop in string searches.
Performance numbers reveal that we were spending as much as 23% of our
processing time in these functions, most of it in the comparison lines.
Instead create a character map and use a single bitwise comparison to
determine if this is any one of the stop characters.
Ensure all simple flags are kept in the initial batch of flags.
Do not allow any flags with options in that batch.
If there are only non-simple flags ensure MAKEFLAGS begins with " ".
Don't let MFLAGS start with "- ".
guile.c: Move inclusion of makeint.h before gnumake.h. This
order must be observed when building Make, because gnumake.h must
be included with GMK_BUILDING_MAKE defined, which makeint.h
already does. Otherwise, the linker will look for, and fail to
find, gmk_* functions in some external dynamic library.
This pointer is almost never needed, and it increases the size of the filedef
struct for all files (of which there are a huge number for large builds).
Instead keep a bit field marking whether the file is a loaded object and if so
call a new function to unload it. In load.c we keep a simple linked list of
loaded objects (of which there will be very few typically) and their dlopen()
pointers.
If -R is set in the makefile and not the command line, then go through all the
default variables and undefine them. If -r is set in the makefile and not in
the command line, then remove all .SUFFIX prefixes (unless the user set it)
and SUFFIX variable setting. In -p mode don't print builtins.
This mode replaces the previous heuristic setting enabled with -O, where we
would log directory enter/leave for each synchronized output. Now we only
do that if --trace=dir is given.
job.c (child_out): Output the newline following the message
before fllush-ing the stream. Avoids displaying the following
failure message, which goes to stderr, on the same line.
gnumake.h (GMK_EXPORT) [_WIN32]: Move the dllexport declaration
here from makeint.h.
makeint.h (GMK_BUILDING_MAKE) [WINDOWS32]: Define before
including gnumake.h.
On 04/30/2013 05:11 PM, Stefano Lattarini wrote:
> * configure.ac (AM_INIT_AUTOMAKE): Here. The future major Automake
> version 2.0 (ETA about one, one and half year from now) will likely
> enable them by default, so better prepare ourselves.
>
Please drop this patch. Enabling 'subdir-objects' would require
sublter changes to several other parts of the build system that I
don't know how to test properly. We should only enable the
'silent-rules' option for the moment. The updated patch below
does this.
Sorry for the noise,
Stefano
---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ---- 8< ----
>From 46623411f017a447caa8fe75b3b42ec2fbeac458 Mon Sep 17 00:00:00 2001
Message-Id: <46623411f017a447caa8fe75b3b42ec2fbeac458.1367335124.git.stefano.lattarini@gmail.com>
From: Stefano Lattarini <stefano.lattarini@gmail.com>
Date: Tue, 30 Apr 2013 16:30:04 +0200
Subject: [PATCH] build: enable the 'silent-rules' automake options
* configure.ac (AM_INIT_AUTOMAKE): Here. The future major Automake
version 2.0 (ETA about one, one and half year from now) will enable
it by default, so better prepare ourselves.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Older versions of those tools should be considered fully obsolete.
Also, GNU make already requires Gettext >= 0.18.1, which has been
released six months after Automake 1.11.1 and two years after
Autoconf 2.62; so the new requirement shouldn't be problematic
for people already bootstrapping GNU make from the Git repository.
* configure.ac (AC_PREREQ): Require Autoconf 2.62 or later.
(AM_INIT_AUTOMAKE): Require Automake 1.11.1 or later (1.11 had
some serious bugs, and should not be used).
Copyright-paperwork-exempt: yes
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
GNU make already assume C89 or later throughout the codebase, and
that preprocessor conditional was no longer used anyway.
* configure.ac: Remove AC_DEFINE of HAVE_ANSI_COMPILER.
* config.ami.template: Remove #define of HAVE_ANSI_COMPILER.
* config.h-vms.template: Likewise.
* config.h.W32.template: Likewise.
* configh.dos.template: Likewise.
Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
If output-sync is enabled, have make write the command line to the temp file
instead of printing it directly to the screen to ensure that the output is
ordered properly. Also, remove extraneous enter/leave operations by having
them printed directly when dumping temp file output.
If we are not going to sync a command line then dump any collected output
first to preserve ordering. Do some code cleanup:
* Move the handle init to a separate function.
* Move the temp file truncation to the output function.
* Remember whether we sync in a variable for readability.
* Handle EINTR and short writes in child_out().
* Always call sync_output() in case output_sync was changed due to error.
job.c (start_job_command): Make the condition for creating a
temporary output file be identical to the Posix code branch.
Suggested by Frank Heckenbach <f.heckenbach@fh-soft.de>.
w32/subproc/sub_proc.c: Include makeint.h. Remove a private
incompatible prototype of xmalloc.
(batch_file_with_spaces): New function, detects Windows batch
files whose names include whitespace characters.
(process_begin): If exec_name is a batch file with whitespace
characters in its name, pass NULL as the first argument to
CreateProcess. This avoids weird failures due to buggy quoting by
CreateProcess. For the details, see the discussion starting at
http://lists.gnu.org/archive/html/make-w32/2013-04/msg00008.html.
load.c (load_object, load_file): Accept an additional argument
DLP and return in it a pointer that can be used to unload the
dynamic object.
read.c (eval): Call load_file with an additional argument, and
record the pointer returned there in the 'struct file' object of
dynamic objects in that object's 'struct file'.
commands.c (execute_file_commands): Unload dynamic objects
before remaking them, to avoid failure to remake if the OS doesn't
allow overwriting objects that are in use.
filedef.h (struct file): New member dlopen_ptr.
gnumake.h (GMK_EXPORT): Define to dllexport/dllimport
decorations for Windows and to nothing on other platforms.
(gmk_eval, gmk_expand, gmk_add_function): Add GMK_EXPORT qualifier
to prototypes.
makeint.h (MAIN): Define before including gnumake.h, to give
correct dllexport decorations to exported functions.
(load_file): Adjust prototype.
loadapi.c: Don't include gnumake.h, since makeint.h already
includes it, and takes care of defining MAIN before doing so.
build_w32.bat (LinkGCC): Produce an import library for functions
exported by Make for loadable dynamic objects.
w32/compat/posixfcn.c (dlclose): New function.
w32/include/dlfcn.h (dlclose): Add prototype.
scripts/features/load: Fix signatures of testload_gmk_setup and
explicit_setup, to bring them in line with the documentation.
w32/include/dlfcn.h: New file.
w32/compat/posixfcn.c: Include dlfcn.h.
(dlopen, dlerror, dlsym) [MAKE_LOAD]: New functions, in support of
dynamic loading.
config.h.W32.template (MAKE_LOAD): Define.
load.c (load_object) [HAVE_DOS_PATHS]: Support backslashes and
drive letters in file names of dynamic objects.
job.c (construct_command_argv_internal) [WINDOWS32]: Return
right after generating new_argv for one_shell case. This fixes
the Windows build for both Unixy shell and stock Windows shells.
Enhance the child_error() function so that it will write error output to the
child's sync output buffer, if it exists. If it doesn't the output goes to
stdout/stderr.