This reverts commit 6264deece3.
Further investigation discovers that the real issue is that
GNU Emacs compile mode doesn't have a matching regex for GNU
make error messages generated when targets fail. I submitted
a patch to GNU Emacs adding a matcher for compile mode.
Ensure we properly reduce job_slots_used if a command fails because
it doesn't exist/can't be started.
* src/job.h (struct child): Add a field jobslot to be set when using
a job slot.
* src/job.c (start_waiting_job): Remember if we are using a job slot.
(reap_children): Reduce number of job slots used by jobslot.
Go through both run_make_tests.pl and test_driver.pl and slightly
modernize the Perl and clean up indentation etc. Fix a number of
warnings in the test scripts detected by running with -w.
* tests/test_driver.pl: Move make error string detection out of the
base test driver.
(run_all_tests): Ensure that we always look for tests in the cwd.
* tests/run_make_tests.pl: Use File::Spec for path manipulations.
Correctly use setlocale() when detecting error strings.
Get configuration from the config-flags.pm file not config.status.
* tests/scripts/features/archives: Use new $cwddir variable.
* tests/scripts/features/reinvoke: Add missing semicolon.
* tests/scripts/features/vpath2: Avoid non-existent variable.
* tests/scripts/functions/foreach: Escape variables.
* tests/scripts/misc/bs-nl: Remove non-existing \v escape sequence.
* tests/scripts/misc/general4: Use handy create_file().
* tests/scripts/options/dash-C: Use Cwd/$cwddir.
* tests/scripts/options/dash-I: Use subst_make_string() and #PWD#.
* tests/scripts/options/symlinks: Use File::Spec.
* tests/scripts/targets/DEFAULT: Use create_file and run_make_test.
* tests/scripts/variables/CURDIR: Use run_make_test.
* tests/scripts/variables/automatic: Remove extraneous "\".
* tests/scripts/vms/library: Remove extra "my" and extraneous "\".
When using exec we install the child's environment before invoking
execlp(), so commands are found on the child's PATH. posix_spawnp
searches on the parent's PATH, which we don't want.
Import gnulib's findprog-in module and use it to search the child's
PATH, then use posix_spawn() to run it.
Also, posix_spawn() does not fall back to trying sh on ENOEXEC, as
execlp() does, so implement that as well.
* bootstrap.conf: Add the findprog-in gnulib module
* src/job.c: Include findprog.h if we're using posix_spawn.
(start_job_command): Remove the handling of child->cmd_name,
(child_execute_job): and add it here. Look up the command to be
run in the child's path and invoke it if found. If it fails with
ENOEXEC then retry it as an argument to the default shell.
* tests/scripts/misc/general4: Test makefile PATH assignments.
* tests/scripts/features/targetvars: Ditto, for target variables.
The built-in glob implementation does not correctly handle dangling
symlinks. This needs to be fixed by switching to the latest glob
implementation from gnulib but that's a big job: for now avoid the
test if we know it will fail.
The check for matching a file's command to the default rule's command
does not account for null. If no .DEFAULT is defined a rule with no
recipe has it's $< variable set to the value of $@. This breaks second
expansion, particularly when used with pattern rules.
* src/commands.c [set_file_variables]: Check that cmds is set
* tests/scripts/features/se_explicit: Test case
* tests/scripts/features/se_implicit: Test case
Copyright-paperwork-exempt: yes
Ensure that variable overrides are passed to recursive make instances
even if no overrides were provided on the command line.
Fix suggested by Rici Lake <ricilake@gmail.com>
* src/main.c (define_makeflags): Add overrides without respect to the
value of command_variables.
* tests/scripts/features/recursion: Add a test.
When merging the variable_set_lists for two targets it could be
that the "from" set list is a subset of the "to" set list: check
for this situation to avoid freeing used memory.
* src/variable.c (merge_variable_set_lists): Walk the "to" list and
if the "from" list is contained in it, nothing to do.
* tests/scripts/features/se_explicit: Add a test.
Create a new variable run_silent to hold the current instance's global
silence setting, allowing silent_flag to represent only whether the -s
option was provided on the command line.
* src/makeint.h: Change silent_flag variable to run_silent.
* src/job.c: Ditto.
* src/remake.c: Ditto.
* src/file.c: Ditto.
* src/main.c: Add a new global variable run_silent.
(decode_switches): After switches are decoded, initialize run_silent.
* tests/scripts/targets/SILENT: Add a test for recursive behavior.
This patch allows "grouped targets" using the &: syntax:
tgt1 tgt2 ... tgtn &: pre1 pre2 ...
recipe
When the &: separator is used (in single or double colon forms), all
the targets are understood to be built by a single invocation of the
recipe. This is accomplished by piggy-backing on the already-existing
pattern rule feature, using the file's "also_make" list.
* NEWS: Add information about grouped targets.
* doc/make.texi (Multiple Targets): Add information on grouped targets.
(Pattern Intro): Refer to the new section to discuss multiple patterns.
* src/main.c (main): Add "grouped-targets" to .FEATURES
* src/read.c (make_word_type): Add new types for &: and &::.
(eval): Recognize the &: and &:: separator and remember when used.
(record_files): Accept an indicator of whether the rule is grouped.
If so, update also_make for each file to depend on the other files.
(get_next_mword): Recognize the &: and &:: word types.
* tests/scripts/features/grouped_targets: New test script.
* AUTHORS: Add Kaz Kylheku
Fixes an issue seen in the Linux kernel build system, reported by
Masahiro Yamada <yamada.masahiro@socionext.com>. Fix suggested
on the bug-make mailing list by Mike Shal <marfey@gmail.com>.
* tests/scripts/features/parallelism: Add a test to verify this.
* NEWS: Update with a backward-compatibility warning.
* src/rule.c (convert_to_pattern): If a suffix rule has dependencies,
do not create a pattern rule for it. According to the manual suffix
rules with prerequisites are treated as normal targets.
* tests/scrips/features/suffixrules: Create some regression tests for
.SUFFIXES and suffix rules.
If multiple pattern rules have the same pattern as also-make targets
and we attempt to run them at the same time, we might downgrade the
command state from 'running' to 'deps_running'; this will prevent
that also_make from being considered complete causing make to wait
forever for it to finish.
Ensure that set_command_state never downgrades the state of a target.
* src/file.c (set_command_state): Don't downgrade command_state.
* src/filedef.h (struct file): Document the order prerequisite.
* test/scripts/features/patternrules: Test the behavior.
* src/function.c (func_shell_base): Use error() instead of recreating
the error output.
* src/job.c (exec_command): Show more standard error messages.
* src/load.c (unload_file): Fix whitespace in the error message.
* tests/scripts/features/errors: Add tests for starting non-
existent commands and new error message formats.
* tests/scripts/features/output-sync: New error message formats.
* tests/scripts/functions/shell: Ditto.
If we failed to fork() we were essentially exiting make immediately
without respect to ignore flags, etc. On one hand that makes sense
because if you can't fork you're in real trouble, but it doesn't
work so well on systems where we don't fork at all. Instead, treat
a fork error like any other error by delaying the handling until
the next call to reap_children(). Any child with a PID of -1 is
considered to have died before starting so check these first without
waiting for them.
* src/commands.c (fatal_error_signal): Don't kill children that
never started.
* src/function.c (func_shell_base): Handle cleanup properly if the
child doesn't start.
* src/job.c (reap_children): Check for children that died before
starting and handle them without waiting for the PID.
(start_job_command): Free memory when the child doesn't start.
(start_waiting_job): Don't manage children who never started.
(child_execute_job): If the fork fails return PID -1.
* src/vmsjobs.c: Check for children that never started.
* tests/run_make_tests.pl: Parse config.status to get all options.
* tests/scripts/features/jobserver: Windows doesn't use pipes
* tests/scripts/functions/shell: Don't test kill -2 on Windows
* tests/scripts/misc/bs-nl: Windows doesn't handle single quotes
* tests/scripts/misc/general3: Ditto.
Move the source code (other than glob) into the "src" subdirectory.
Update all scripting and recommendations to support this change.
* *.c, *.h, w32/*: Move to src/
* configure.ac, Makefile.am, maintMakefile: Locate new source files.
* Basic.mk.template, mk/*: Update for new source file locations.
* NEWS, README.DOS.template: Update for new locations.
* build.template, build_w32.bat, builddos.bat: Ditto.
* po/POTFILES.in: Ditto
* tests/run_make_tests.pl, tests/scripts/features/load*: Ditto.
* make.1: Move to doc.
* mk/VMS.mk: Add support for building on VMS (hopefully).
* makefile.vms, prepare_w32.bat: Remove.
* SCOPTIONS: Update to define HAVE_CONFIG_H
Over time the non-standard build and install systems (nmake files,
smake files, Visual Studio project files, etc.) have atrophied and
maintaining them is not worth the effort, for such a simple utility
as make. Remove all the non-standard build tool support and unify
OS-specific build rules under a basic set of (GNU make) makefiles.
Preserve the existing bootstrapping scripts (for POSIX, Windows,
and MS-DOS). Also the existing VMS build scripts are left unchanged:
I don't have enough experience with VMS to venture into this area.
Perhaps one of the VMS maintainers might like to determine whether
conversion would be appropriate.
Rather than create libraries for w32 and glob (non-POSIX), simply
link the object files directly to remove the complexity.
* NEWS: Update with user-facing notes.
* Makefile.am: Clean up to use the latest automake best practices.
Build Windows code directly from the root makefile to avoid recursion.
* README.Amiga, README.DOS.template, README.W32.template: Updated.
* INSTALL: Point readers at the README.git file.
* maintMakefile: Remove obsolete files. Create Basic.mk file.
* Basic.mk.template, mk/*.mk: Create basic GNU make-based makefiles.
* build_w32.bat: Copy Basic.mk to Makefile
* configure.ac: We no longer need AM_PROG_AR.
* dosbuild.bat: Rename to builddos.bat. Incorporate configure.bat.
* Makefile.DOS.template: Remove.
* NMakefile.template, w32/subproc/NMakefile: Remove.
* SMakefile.template, glob/SMakefile, glob/SCOPTIONS, make.lnk: Remove.
* configure.bat, glob/configure.bat: Remove.
* w32/Makefile.am: Remove.
* make_msvc_net2003.sln, make_msvc_net2003.vcproj: Remove.
This is about twice as fast as the current hash, and removes the
need for double hashing (improving locality of reference). The
hash function is based on Bob Jenkins' design, slightly adapted
wherever Make needs to hash NUL-terminated strings. The old hash
function is kept for case-insensitive hashing.
This saves 8.5% on QEMU's no-op build (from 12.87s to 11.78s).
* configure.ac: Check endianness.
* hash.c (rol32, jhash_mix, jhash_final, JHASH_INITVAL,
sum_get_unaligned_32, jhash): New.
* hash.h (STRING_HASH_1, STRING_N_HASH_1): Use jhash.
(STRING_HASH_2, STRING_N_HASH_2): Return a dummy value.
(STRING_N_COMPARE, return_STRING_N_COMPARE): Prefer memcmp to strncmp.
* variable.h (enum variable_flavor: Add a new flavor for appended
values that shouldn't be expanded.
* variable.c (do_variable_definition): If given this new flavor,
do not expand the value before appending it.
* read.c (eval_makefile): Use this new flavor for MAKEFILE_LIST
* tests/scripts/variables/MFILE_LIST: Test filenames containing '$'.
* doc/make.texi (Appending): Document this behavior.
* variable.c (do_variable_definition): Only add a space if the variable
value is not empty.
* tests/scripts/variables/flavors: Test this behavior.