]> git.ipfire.org Git - thirdparty/make.git/log
thirdparty/make.git
5 years ago* README.git: Describe GCC and GNU make requirements
Paul Smith [Tue, 3 Sep 2019 16:24:54 +0000 (12:24 -0400)] 
* README.git: Describe GCC and GNU make requirements

* maintMakefile: Put custom C flags into a separate variable
so they can be overridden more easily on the command line.

5 years ago* tests/scripts/features/archives: Fix expected long ar name output.
Paul Smith [Tue, 3 Sep 2019 04:26:05 +0000 (00:26 -0400)] 
* tests/scripts/features/archives: Fix expected long ar name output.

5 years ago* tetss/run_make_test.pl: Avoid 'sh -c' for Windows portability.
Paul Smith [Tue, 3 Sep 2019 04:09:51 +0000 (00:09 -0400)] 
* tetss/run_make_test.pl: Avoid 'sh -c' for Windows portability.

5 years agoUpdate to GNU make release candidate 4.2.91
Paul Smith [Tue, 3 Sep 2019 03:27:53 +0000 (23:27 -0400)] 
Update to GNU make release candidate 4.2.91

5 years ago* tests/scripts/functions/wildcard: Skip dangling symlink test.
Paul Smith [Tue, 3 Sep 2019 03:51:10 +0000 (23:51 -0400)] 
* tests/scripts/functions/wildcard: Skip dangling symlink test.

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.

5 years ago* maintMakefile: Use check-local when testing build.sh.
Paul Smith [Tue, 3 Sep 2019 03:26:38 +0000 (23:26 -0400)] 
* maintMakefile: Use check-local when testing build.sh.

Running 'make check' will rebuild 'make' so we're not testing the
build.sh-generated make binary.

5 years agoDon't reset stack size when using posix_spawn()
Paul Smith [Tue, 3 Sep 2019 03:03:27 +0000 (23:03 -0400)] 
Don't reset stack size when using posix_spawn()

There's no way to run setrlimit() from posix_spawn() so we can't reset
the stack limit in children; thus, don't change it in the parent.

* src/makeint.h (SET_STACK_SIZE): Don't set this when HAVE_POSIX_SPAWN.
* src/job.c (child_execute_job): Remove useless comment.

5 years ago* configure.ac: Remove redundant getloadavg gnulib support
Paul Smith [Tue, 3 Sep 2019 02:21:59 +0000 (22:21 -0400)] 
* configure.ac: Remove redundant getloadavg gnulib support

5 years ago* src/dir.c (dir_setup_glob): Initialize unused gl_offs.
Paul Smith [Mon, 2 Sep 2019 15:10:56 +0000 (11:10 -0400)] 
* src/dir.c (dir_setup_glob): Initialize unused gl_offs.

* tests/scripts/functions/wildcard: Add trailing slash tests.
Initial changes by Dmitry Goncharov <dgoncharov@users.sf.net>

5 years agoPacify Oracle Studio c99
Paul Eggert [Tue, 27 Aug 2019 19:32:07 +0000 (12:32 -0700)] 
Pacify Oracle Studio c99

* src/dep.h (DEP):
* src/function.c (struct function_table_entry):
Use unsigned int, not unsigned short.  Without this patch, c99
complains ‘warning: nonportable bit-field type’.

5 years agoPort grouped_targets test to Solaris 10
Paul Eggert [Tue, 27 Aug 2019 08:08:47 +0000 (01:08 -0700)] 
Port grouped_targets test to Solaris 10

* tests/scripts/features/grouped_targets: Use ‘printf ''’
instead of ‘echo -n’, as POSIX says the latter is not portable.

5 years agoRemove useless code in eval
Paul Eggert [Tue, 27 Aug 2019 07:46:21 +0000 (00:46 -0700)] 
Remove useless code in eval

* src/read.c (eval): Remove useless code.  Without this patch,
Oracle Studio 12.6 complains ‘"src/read.c", line 1405: warning:
loop not entered at top’.

5 years agoPacify Oracle Studio 12.6 in init_switches
Paul Eggert [Tue, 27 Aug 2019 07:40:05 +0000 (00:40 -0700)] 
Pacify Oracle Studio 12.6 in init_switches

* src/main.c (init_switches): Use a cast to convert char const *
to char *.  Without this patch, the compiler complains
‘"src/main.c", line 2643: warning: assignment type mismatch:
pointer to char "=" pointer to const char’.

5 years agoPacify Oracle Studio 12.6
Paul Eggert [Tue, 27 Aug 2019 07:37:08 +0000 (00:37 -0700)] 
Pacify Oracle Studio 12.6

* src/arscan.c [VMS]: Use ‘#if !defined LBR$_HDRTRUNC’ instead
of ‘#ifndef LBR$_HDRTRUNC’ to pacify Oracle Studio 12.6, which
looks inside unused #if branches for preprocessor syntax errors.
Without this patch it complains ‘"src/arscan.c", line 43: warning:
tokens ignored at end of directive line’.

5 years ago* NEWS: Fix incorrect notes.
Paul Smith [Mon, 2 Sep 2019 15:08:15 +0000 (11:08 -0400)] 
* NEWS: Fix incorrect notes.

5 years ago* src/read.c (parse_file_seq): [SV 52076] Don't reverse glob() results.
Paul Smith [Mon, 2 Sep 2019 15:06:40 +0000 (11:06 -0400)] 
* src/read.c (parse_file_seq): [SV 52076] Don't reverse glob() results.

5 years agoFix MS-Windows MinGW build
Eli Zaretskii [Wed, 28 Aug 2019 14:45:49 +0000 (17:45 +0300)] 
Fix MS-Windows MinGW build

* src/w32/subproc/sub_proc.c (process_wait_for_multiple_objects):
Fix format specifier for GetLastError's value.

* src/job.c (reap_children): Define the 'remote_status_lose' label
only for Posix platforms, to avoid compiler warning.

* build_w32.bat (LNKOUT): New variable, using forward slashes.
Use forward slashes in calls to :Compile, so that linking with GNU
ld works.

* src/makeint.h [!HAVE_UMASK]: Prototype for 'umask'.
(UMASK, MODE_T): Don't define.

* src/misc.c (get_tmpfile): Don't call UMASK, call umask, to
avoid compilation warning on !HAVE_UMASK platforms.
* src/output.c (output_tmpfd): Likewise.

* src/misc.c (umask) [!HAVE_UMASK]: New no-op function.

* src/config.h.W32.template (__USE_MINGW_ANSI_STDIO)
[__MINGW32__]: Define to 1, to force Make use ANSI-compatible
stdio functions, which also support the non-standard 'Id' and 'Ix'
specifiers.
(HAVE_UMASK) [__MINGW32__]: Define to 1.

* src/arscan.c (ar_member_touch): Type-cast argument of strlen to
avoid compiler warnings.

5 years ago* NEWS: Update for pre-release 4.2.90
Paul Smith [Mon, 26 Aug 2019 11:31:38 +0000 (07:31 -0400)] 
* NEWS: Update for pre-release

5 years agoUpdate maintainer mode to support debug wait points.
Paul Smith [Sun, 25 Aug 2019 21:11:10 +0000 (17:11 -0400)] 
Update maintainer mode to support debug wait points.

Make a spin() method available when compiled in maintainer mode.
If a file exists in the working directory with a specific name,
make will sleep until the file is deleted.

Ensure that maintainer mode is enabled on Windows, using the same
algorithm we use on POSIX / autoconf systems.

* build_w32.bat: If maintMakefile exists, enable maintainer mode.
* src/main.c (main): Replace Windows-only suspend flag with spin().
* src/makeint.h: A SPIN() macro calls spin() in maintainer mode.
* src/misc.c (spin): If a spin file exists sleep until it's deleted.

5 years ago* tests/scripts/features/archives: [SV 54395] Support non-GNU ar.
Paul Smith [Sun, 25 Aug 2019 17:47:13 +0000 (13:47 -0400)] 
* tests/scripts/features/archives: [SV 54395] Support non-GNU ar.

5 years ago* tests/scripts/misc/general3: Add more tests for SHELL/.SHELLFLAGS
Paul Smith [Sun, 25 Aug 2019 04:20:38 +0000 (00:20 -0400)] 
* tests/scripts/misc/general3: Add more tests for SHELL/.SHELLFLAGS

5 years ago* src/job.c (construct_command_argv): Remove unused VMS code
Paul Smith [Sat, 24 Aug 2019 21:41:45 +0000 (17:41 -0400)] 
* src/job.c (construct_command_argv): Remove unused VMS code

5 years ago* src/job.c (child_execute_job): Set pid to -1 on posix_spawn failure.
Paul Smith [Sat, 24 Aug 2019 21:40:41 +0000 (17:40 -0400)] 
* src/job.c (child_execute_job): Set pid to -1 on posix_spawn failure.

5 years ago* bootstrap: Update from latest gnulib version
Paul Smith [Sat, 24 Aug 2019 18:56:33 +0000 (14:56 -0400)] 
* bootstrap: Update from latest gnulib version

5 years ago* scripts/copyright-update: Use git ls-files for controlled files
Paul Smith [Sat, 24 Aug 2019 18:41:10 +0000 (14:41 -0400)] 
* scripts/copyright-update: Use git ls-files for controlled files

5 years ago* po/LINGUAS: Add a translation for Bulgarian.
Paul Smith [Sat, 24 Aug 2019 18:13:59 +0000 (14:13 -0400)] 
* po/LINGUAS: Add a translation for Bulgarian.

6 years ago[SV 56449] (Windows) Use slow path if '%' appears in the command
Christian Eggers [Thu, 6 Jun 2019 10:42:38 +0000 (12:42 +0200)] 
[SV 56449] (Windows) Use slow path if '%' appears in the command

* src/job.c (sh_chars_dos): Add '%' as a special character
* src/job.c (construct_command_argv_internal): Check for '%' in quotes

For the windows version of make, a recipe line cannot be executed
diretly by make (without a shell) if a '%' character is present. This
character starts a cmd.exe escape sequence.

Signed-off-by: Christian Eggers <ceggers@arri.de>
Copyright-paperwork-exempt: yes

6 years ago* src/read.c (parse_file_seq): Update comments.
Paul Smith [Sun, 14 Jul 2019 13:20:14 +0000 (09:20 -0400)] 
* src/read.c (parse_file_seq): Update comments.

6 years ago[SV 28456] Don't override $< when no default rule has been defined
Mike Haboustak [Fri, 12 Jul 2019 01:08:38 +0000 (21:08 -0400)] 
[SV 28456] Don't override $< when no default rule has been defined

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

6 years agoSwitch to the gnulib version of strerror()
Paul Smith [Sat, 13 Jul 2019 12:34:45 +0000 (08:34 -0400)] 
Switch to the gnulib version of strerror()

* bootstrap.conf: Add strerror module
* configure.ac: Remove strerror check
* src/misc.c: Remove local strerror() implementation
* src/config.ami.template: Remove HAVE_STRERROR
* src/config.h-vms.template: Ditto.
* src/config.h.W32.template: Ditto.

6 years ago* doc/make.texi: [SV 51974] Clarify makefile parsing operations.
Paul Smith [Sun, 19 May 2019 19:08:13 +0000 (15:08 -0400)] 
* doc/make.texi: [SV 51974] Clarify makefile parsing operations.

6 years ago* doc/make.texi: [SV 54116] Document whitespace removal trick.
Paul Smith [Sun, 19 May 2019 17:02:06 +0000 (13:02 -0400)] 
* doc/make.texi: [SV 54116] Document whitespace removal trick.

Discovered and explained by Michael Henry <gnu@drmikehenry.com>
* tests/scripts/variables/flavors: Add a test to preserve the behavior.

6 years ago[SV 46013] Allow recursive variable overrides from Makefiles
Paul Smith [Sun, 19 May 2019 16:16:14 +0000 (12:16 -0400)] 
[SV 46013] Allow recursive variable overrides from Makefiles

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.

6 years agoUpdate developer customizations
Paul Smith [Sun, 19 May 2019 15:25:06 +0000 (11:25 -0400)] 
Update developer customizations

* .ccls: Remove -std=c99: it disables __attribute__ causing warnings.
* .dir-locals.el: Force the C coding style to "gnu".
* make-gdb.py: Add GDB macros for pretty-printing GNU make structs.
* scripts/copyright-update: Use GNULIB_SRCDIR to find update-copyright.

6 years ago[SV 54549] Don't free used set_lists during merge
Paul Smith [Sun, 19 May 2019 14:59:06 +0000 (10:59 -0400)] 
[SV 54549] Don't free used set_lists during merge

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.

6 years ago* src/hash.c (jash_string): [SV 54980] Avoid ASAN error
Paul Smith [Mon, 13 May 2019 22:45:18 +0000 (18:45 -0400)] 
* src/hash.c (jash_string): [SV 54980] Avoid ASAN error

6 years ago[SV 54740] Ensure .SILENT settings do not leak into sub-makes
Paul Smith [Sun, 12 May 2019 21:01:55 +0000 (17:01 -0400)] 
[SV 54740] Ensure .SILENT settings do not leak into sub-makes

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.

6 years agoUpdate copyright statements for 2019
Paul Smith [Sun, 19 May 2019 15:57:14 +0000 (11:57 -0400)] 
Update copyright statements for 2019

6 years ago[SV 8297] Implement "grouped targets" for explicit rules.
Kaz Kylheku [Sat, 11 May 2019 22:35:03 +0000 (18:35 -0400)] 
[SV 8297] Implement "grouped targets" for explicit rules.

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

6 years ago* variable.c (define_variable_in_set): Clear new structs
Paul Smith [Sat, 11 May 2019 14:43:53 +0000 (10:43 -0400)] 
* variable.c (define_variable_in_set): Clear new structs

6 years ago* po/LINGUAS: Add Portuguese translation
Paul Smith [Sat, 11 May 2019 14:41:28 +0000 (10:41 -0400)] 
* po/LINGUAS: Add Portuguese translation

6 years agoAdd developer customizations
Paul Smith [Sat, 11 May 2019 14:30:26 +0000 (10:30 -0400)] 
Add developer customizations

* .ccls: Configure the ccls LSP server
* .dir-locals.el: Reset some parameters for ccls and lsp-mode
* .gitignore: Update for GTAGS and ccls
* maintMakefile: Don't search hidden directories for sources

6 years ago* src/arscan.c (ar_member_touch): [SV 54533] Stop \0 in archive headers
Paul Smith [Sun, 16 Sep 2018 05:09:10 +0000 (01:09 -0400)] 
* src/arscan.c (ar_member_touch): [SV 54533] Stop \0 in archive headers

6 years agoChange output_write() to writebuf(), add readbuf() helper.
Paul Smith [Sun, 16 Sep 2018 05:04:10 +0000 (01:04 -0400)] 
Change output_write() to writebuf(), add readbuf() helper.

* src/misc.c (writebuf, readbuf): Create helper functions that will
reliably write a buffer to a file descriptor in the face of EINTR
causing short writes, and read from a file descriptor into a buffer
in the face of EINTR causing short reads.
* src/makeint.h: Declare these functions.
* src/output.c: Remove output_write() and replace with writebuf().
(_outputs, out_of_memory): Call writebuf(), not output_write().
* src/arscan.c (ar_scan): Call readbuf() instead of read(2).
(ar_member_touch): Remove duplicate header write, call writebuf()
instead of output_write(), and readbuf() instead of read(2).

6 years ago* doc/make.texi (Remaking Makefiles): [SV 52273] Note MAKE_RESTARTS
Paul Smith [Sat, 15 Sep 2018 20:11:29 +0000 (16:11 -0400)] 
* doc/make.texi (Remaking Makefiles): [SV 52273] Note MAKE_RESTARTS

6 years ago* src/main.c (main): Set jobserver permissions before re-execing
Paul Smith [Sat, 15 Sep 2018 18:48:57 +0000 (14:48 -0400)] 
* src/main.c (main): Set jobserver permissions before re-execing

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.

6 years ago* doc/make.texi: [SV 48970] Clarify the value of $?
Paul Smith [Sun, 9 Sep 2018 20:13:16 +0000 (16:13 -0400)] 
* doc/make.texi: [SV 48970] Clarify the value of $?

6 years ago* doc/make.text: [SV 54360] Weaken "obsolete" language in the manual.
Paul Smith [Sun, 9 Sep 2018 19:58:13 +0000 (15:58 -0400)] 
* doc/make.text: [SV 54360] Weaken "obsolete" language in the manual.

There's no need to frighten users away from capabilities which are
perfectly reasonable and definitely not going away, by calling them
obsolete or discouraged in the manual.

6 years ago[SV 40657] Don't create pattern rules for suffix rules with deps.
Paul Smith [Sun, 9 Sep 2018 19:30:07 +0000 (15:30 -0400)] 
[SV 40657] Don't create pattern rules for suffix rules with deps.

* 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.

7 years ago* NEWS: Update for the latest changes.
Paul Smith [Sat, 4 Aug 2018 23:20:58 +0000 (19:20 -0400)] 
* NEWS: Update for the latest changes.

7 years ago[SV 54233] Preserve higher command_state values on also_make targets.
Paul Smith [Sat, 4 Aug 2018 23:07:59 +0000 (19:07 -0400)] 
[SV 54233] Preserve higher command_state values on also_make targets.

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.

7 years ago* src/job.c (reap_children): Fix inverted win/lose message.
Paul Smith [Sat, 4 Aug 2018 23:05:29 +0000 (19:05 -0400)] 
* src/job.c (reap_children): Fix inverted win/lose message.

7 years ago* tests/scripts/functions/wildcard: [SV 52018] Test dangling symlink.
Paul Smith [Sat, 4 Aug 2018 21:35:10 +0000 (17:35 -0400)] 
* tests/scripts/functions/wildcard: [SV 52018] Test dangling symlink.

7 years ago* src/read.c (parse_file_seq): [SV 52076] Sort wildcard results.
Bernhard M. Wiedemann [Sat, 4 Aug 2018 21:21:15 +0000 (17:21 -0400)] 
* src/read.c (parse_file_seq): [SV 52076] Sort wildcard results.

7 years ago* tests/scripts/features/archives: [SV 54395] Test long archive names.
Paul Smith [Sat, 4 Aug 2018 19:47:15 +0000 (15:47 -0400)] 
* tests/scripts/features/archives: [SV 54395] Test long archive names.

7 years ago* src/arscan.c (ar_scan): [SV 54395] Allow long names in archives.
Ben Hutchings [Sat, 28 Jul 2018 02:31:11 +0000 (10:31 +0800)] 
* src/arscan.c (ar_scan): [SV 54395] Allow long names in archives.

Commit bc9d72beb0cb "Resolve issues discovered by static code
analysis." added range checks on archive member name length.  However,
on non-AIX systems it also checked BSD-style long names against the
short name limits and and checked the *offset* for GNU-style long
names against the short name limits.  This caused valid long names to
be rejected.

* Record the size of the GNU name map and validate offsets against it
* Ensure that the last entry in the name map is null-terminated
* Apply a maximum length of INT_MAX for element sizes

Reported-by: Philipp Wolski <philipp.wolski@kisters.de>
7 years ago* lib/glob.c (glob_in_dir): [SV 53465] Allow symlinks to directories.
Paul Smith [Sat, 4 Aug 2018 18:04:44 +0000 (14:04 -0400)] 
* lib/glob.c (glob_in_dir): [SV 53465] Allow symlinks to directories.

Fix from Rich Felker <bugdal@aerifal.cx> on the musl mailing list.
* tests/scripts/functions/wildcard: Create a regression test for this.

7 years ago* configure.ac: Add --disable-posix-spawn option
Paul Smith [Sat, 4 Aug 2018 15:13:57 +0000 (11:13 -0400)] 
* configure.ac: Add --disable-posix-spawn option

* maintMakefile: Add a test for the option
* src/job.c: Change HAVE_* preprocessor checks to USE_POSIX_SPAWN

7 years ago* src/job.c (child_execute_job): Clean up posix_spawn invocation
Paul Smith [Sat, 4 Aug 2018 14:34:40 +0000 (10:34 -0400)] 
* src/job.c (child_execute_job): Clean up posix_spawn invocation

7 years ago* job.c (child_execute_job): Prefer posix_spawn() over fork()/exec()
Aron Barath [Mon, 9 Jul 2018 07:05:31 +0000 (09:05 +0200)] 
* job.c (child_execute_job): Prefer posix_spawn() over fork()/exec()

7 years agoClean up errors for invalid commands and add regression tests.
Paul Smith [Sat, 4 Aug 2018 16:20:11 +0000 (12:20 -0400)] 
Clean up errors for invalid commands and add regression tests.

* 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.

7 years agoQueue failed fork() (etc.) to be handled like any other failed job.
Paul Smith [Sat, 4 Aug 2018 16:18:39 +0000 (12:18 -0400)] 
Queue failed fork() (etc.) to be handled like any other failed job.

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.

7 years ago* configure.ac: Check for posix_spawnattr_setsigmask
Aron Barath [Mon, 9 Jul 2018 07:05:30 +0000 (09:05 +0200)] 
* configure.ac: Check for posix_spawnattr_setsigmask

7 years ago* configure.ac: Check for spawn.h and posix_spawn()
Aron Barath [Thu, 5 Jul 2018 12:53:23 +0000 (14:53 +0200)] 
* configure.ac: Check for spawn.h and posix_spawn()

7 years ago* src/makeint.h: Use pid_t to store PIDs, of int.
Aron Barath [Mon, 9 Jul 2018 05:31:25 +0000 (07:31 +0200)] 
* src/makeint.h: Use pid_t to store PIDs, of int.

* src/commands.c (getpid): Ditto.
* src/job.h (*): Ditto.
* src/job.c (*): Ditto.
* src/main.c (main): Ditto.
* src/remote-cstms.c (start_remote_job): Ditto.
* src/remote-stub.c (start_remote_job): Ditto.

7 years ago* src/dir.c: Preserve glob d_type field
spagoveanu@gmail.com [Tue, 19 Jun 2018 23:03:48 +0000 (02:03 +0300)] 
* src/dir.c: Preserve glob d_type field

When using GNU make on a system with glibc glob a pattern ending in
a slash is also matching regular files, but only in subdirectories:

$ mkdir -p dir/subdir
$ cd dir
$ touch file1 subdir/file2
$ echo 'test:; @echo $(wildcard */ */*/)' | make -f -
subdir/ subdir/file2
$ echo 'test: */ */*/; @echo "$?" != */ */*/' | make -f -
subdir/ subdir/file2 != subdir/ */*/

It happens because in the gl->gl_readdir callback supplied to glob(),
dirent->d_type is set to DT_UNKNOWN, and the glob() implementation
in glibc assumes that such a directory entry *cannot* possibly be a
regular file.

Pass the actual d_type down to glob(); this is the right thing to do
even if glibc is fixed, because it saves an extra stat() syscall for
each dirent.

Copyright-paperwork-exempt: yes

7 years ago* src/read.c(unescape_char): Use C comments not C++ comments.
Paul Smith [Sun, 22 Jul 2018 13:43:45 +0000 (09:43 -0400)] 
* src/read.c(unescape_char): Use C comments not C++ comments.

* src/posixos.c(set_blocking): Ditto.
* src/w32/subproc/sub_proc.c(process_init): Ditto

7 years agoEnhance the Basic.mk environment to work with Gnulib
Paul Smith [Fri, 3 Aug 2018 00:51:11 +0000 (20:51 -0400)] 
Enhance the Basic.mk environment to work with Gnulib

* maintMakefile: Omit generated headers from Basic.mk prerequisites.
* Basic.mk.template: Rework commands to use with $(call ...) macros.
* mk/Amiga.mk: Ditto.
* mk/VMS.mk: Ditto.
* mk/Windows32.mk: Ditto, plus P2W to convert POSIX to Windows paths.
* mk/msdosdjgpp.mk: Ditto.

7 years agoResolve most of the Windows Visual Studio warnings.
Paul Smith [Mon, 2 Jul 2018 00:00:53 +0000 (20:00 -0400)] 
Resolve most of the Windows Visual Studio warnings.

* Convert integer types to size_t where necessary.
* Align other integral types to avoid casts and type warnings.

7 years agoUpdate regression tests for Windows.
Paul Smith [Sun, 1 Jul 2018 20:13:13 +0000 (16:13 -0400)] 
Update regression tests for Windows.

* 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.

7 years ago* maintMakefile: Preserve comments during compilation
Paul Smith [Sun, 1 Jul 2018 19:45:46 +0000 (15:45 -0400)] 
* maintMakefile: Preserve comments during compilation

7 years ago* function.c(abspath): Use memcpy() to avoid GCC 8.1 warnings
Paul Smith [Sun, 1 Jul 2018 19:32:49 +0000 (15:32 -0400)] 
* function.c(abspath): Use memcpy() to avoid GCC 8.1 warnings

7 years agoConvert GNU make to use the gnulib portability library
Paul Smith [Sun, 1 Jul 2018 16:28:25 +0000 (12:28 -0400)] 
Convert GNU make to use the gnulib portability library

Move content from glob/* and config/* into standard GNU directory
locations lib/* and m4/*.

Install the gnulib bootstrap script and its configuration file, and
create a bootstrap.bat file for Windows.  Update the README.git file
with new requirements and instructions for building from Git.

At this point we only install the alloca, getloadavg, and FDL modules
from gnulib.  We keep our old glob/fnmatch implementation since the
gnulib versions require significant amounts of infrastructure which
doesn't exist on Windows yet.  Further work is required here.

Due to a problem with gnulib's version of getloadavg, we need to bump
the minimum required version of automake to 1.16.1 unfortunately.

* README.git: Update instructions
* NEWS: Move developer news to a separate section
* configure.ac: Update for use with gnulib modules

* bootstrap: Bootstrap from Git workspace (import from gnulib)
* bootstrap.conf: Bootstrap configuration for GNU make
* bootstrap.bat: Bootstrap from Git workspace for Windows
* gl/modules/make-glob: Support our local fnmatch/glob implementation

* config/acinclude.m4: Move to m4/
* config/dospaths.m4: Move to m4/
* glob/fnmatch.c: Move to lib/
* glob/fnmatch.h.in: Move to lib/
* glob/glob.c: Move to lib/
* glob/glob.h.in: Move to lib/

* Makefile.am: Update for new directories
* build.template: Update for new directories
* build_w32.bat: Update for new directories
* builddos.bat: Update for new directories
* maintMakefile: Update for new directories
* makefile.com: Update for new directories
* mk/Amiga.mk: Update for new directories
* mk/Posix.mk.in: Update for new directories
* mk/VMS.mk: Update for new directories
* mk/Windows32.mk: Update for new directories
* mk/msdosdjgpp.mk: Update for new directories

* po/LINGUAS: One language per line (needed by gnulib)

* INSTALL: Remove (obtained from gnulib)
* src/alloca.c: Remove (obtained from gnulib)
* src/getloadavg.c: Remove (obtained from gnulib)
* po/Makevars: Remove (created by bootstrap)
* config/*: Remove leftover files
* glob/*: Remove leftover files

7 years ago* Makefile.ami, glob/Makefile.ami: Remove obsolete files
Paul Smith [Sun, 1 Jul 2018 16:27:53 +0000 (12:27 -0400)] 
* Makefile.ami, glob/Makefile.ami: Remove obsolete files

7 years ago* doc/make.texi: Updated language
Ola Olsson [Tue, 19 Dec 2017 19:24:55 +0000 (20:24 +0100)] 
* doc/make.texi: Updated language

7 years ago* all: Update Copyright statements for 2018
Paul Smith [Sun, 8 Apr 2018 12:40:39 +0000 (08:40 -0400)] 
* all: Update Copyright statements for 2018

7 years ago* scripts/copyright-update: Maintainer's script for copyright mgmt
Paul Smith [Sun, 8 Apr 2018 12:32:29 +0000 (08:32 -0400)] 
* scripts/copyright-update: Maintainer's script for copyright mgmt

7 years ago* build_w32.bat: Support Visual Studio 17.
Paul Smith [Sat, 10 Feb 2018 20:34:53 +0000 (15:34 -0500)] 
* build_w32.bat: Support Visual Studio 17.

7 years ago* configure.ac: Support GLIBC glob interface version 2
Paul Smith [Sun, 19 Nov 2017 20:09:16 +0000 (15:09 -0500)] 
* configure.ac: Support GLIBC glob interface version 2

7 years agoRework directory structure to use GNU-recommended "src" directory.
Paul Smith [Sun, 19 Nov 2017 18:49:26 +0000 (13:49 -0500)] 
Rework directory structure to use GNU-recommended "src" directory.

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

7 years ago* job.c: Add "command" as a known shell built-in.
Paul Smith [Sun, 12 Nov 2017 23:10:28 +0000 (18:10 -0500)] 
* job.c: Add "command" as a known shell built-in.

This is not a POSIX shell built-in but it's common in UNIX shells.
Reported by Nick Bowler <nbowler@draconx.ca>.

7 years ago* tests/scripts/features/output-sync: Revert bad change in 0c5a9f9b92a
Paul Smith [Sun, 12 Nov 2017 23:03:22 +0000 (18:03 -0500)] 
* tests/scripts/features/output-sync: Revert bad change in 0c5a9f9b92a

7 years agoRemove unsupported build facilities.
Paul Smith [Sun, 12 Nov 2017 22:44:38 +0000 (17:44 -0500)] 
Remove unsupported build facilities.

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.

7 years ago* Makefile.am: Add jhelp.pl to remote test setup.
Paul Smith [Sat, 11 Nov 2017 18:12:28 +0000 (13:12 -0500)] 
* Makefile.am: Add jhelp.pl to remote test setup.

7 years agoDo not use STOP_SET for singleton compares.
Paolo Bonzini [Fri, 11 Aug 2017 11:44:33 +0000 (13:44 +0200)] 
Do not use STOP_SET for singleton compares.

Compare against '$' directly rather than using MAP_VARIABLE.
This saves ~10% for find_map_function, which is the top hotspot in
QEMU's no-op build.  The build is sped up overall by about 1.5%
more (from 11.1s to 10.95s).

* read.c (find_map_function): Do not compare against singleton sets.

7 years agoSpeedup parsing of functions.
Paolo Bonzini [Fri, 11 Aug 2017 11:44:32 +0000 (13:44 +0200)] 
Speedup parsing of functions.

Use the stopchar map to quickly jump over everything that is
not an open/close brace, an open/close parenthesis or a comma.

This saves 1% on QEMU's noop build (from 11.23s to 11.1s).

* function.c (find_next_argument, handle_function): Check
with STOP_SET before comparing against individual characters.
* main.c (initialize_stopchar_map): Initialize MAP_VARSEP
mappings in stopchar_map.
* makeint.h (MAP_VARSEP): New.

7 years agoRemove MAP_PERCENT as strchr is faster.
Paolo Bonzini [Fri, 11 Aug 2017 11:44:31 +0000 (13:44 +0200)] 
Remove MAP_PERCENT as strchr is faster.

* read.c (find_percent_cached): Use strchr instead of STOP_SET
to find % or nul.
* makeint.h (MAP_PERCENT): Remove.
* main.c (initialize_stopchar_map): Remove.

7 years agoUse Jenkins hash.
Paolo Bonzini [Fri, 11 Aug 2017 11:44:28 +0000 (13:44 +0200)] 
Use Jenkins hash.

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.

7 years agoUse strchr for simple case of find_char_unquote.
Paolo Bonzini [Fri, 11 Aug 2017 11:44:29 +0000 (13:44 +0200)] 
Use strchr for simple case of find_char_unquote.

In most cases, find_char_unquote has a single stopchar.  In that
case we can look for it using strchr's optimized implementation.

This saves 3.5% on QEMU's noop build (from 11.78s to 11.37s).

* read.c (find_char_unquote): Rename to find_map_unquote.  Replace
with an implementation optimized for the case where the stopchar
is a singleton.  Adjust all callers.

7 years agoUse strchr/memmove in collapse_continuations.
Paolo Bonzini [Fri, 11 Aug 2017 11:44:30 +0000 (13:44 +0200)] 
Use strchr/memmove in collapse_continuations.

collapse_continuations is already using strchr to speed up the
common case of no backslash-newline sequence, but on modern
processors it is faster to scan the string twice with
strchr+memmove (or strlen+memmove) than to move bytes manually.

Saves about 1.5% on QEMU's no-op build (from 11.37s to 11.23s).

* misc.c (collapse_continuations): Rewrite the scanning of LINE.

7 years ago* main.c (main): [SV 48274] Allow -j in makefile MAKEFLAGS variable.
Paul Smith [Mon, 30 Oct 2017 16:53:49 +0000 (12:53 -0400)] 
* main.c (main): [SV 48274] Allow -j in makefile MAKEFLAGS variable.

* tests/jhelp.pl: New file to allow testing parallelism without sleep.
* tests/scripts/features/parallelism: Test this.
* tests/scripts/features/jobserver: Update tests.
* tests/scripts/features/output-sync: Remove useless rm command.

7 years ago* job.c (child_error): Modify error message string.
Paul Smith [Sat, 28 Oct 2017 22:45:30 +0000 (18:45 -0400)] 
* job.c (child_error): Modify error message string.

Ensure Emacs compile-mode's next-error doesn't match target failure
messages.  Syntax errors in makefiles are still matched.

7 years ago* function.c (func_if): Check the first character of condition.
Paul Smith [Sat, 28 Oct 2017 19:28:32 +0000 (15:28 -0400)] 
* function.c (func_if): Check the first character of condition.

Reported by Rob W <robw9739@gmail.com>

7 years agoglob: Do not assume glibc glob internals.
Paul Eggert [Sun, 24 Sep 2017 13:12:58 +0000 (09:12 -0400)] 
glob: Do not assume glibc glob internals.

It has been proposed that glibc glob start using gl_lstat,
which the API allows it to do.  GNU 'make' should not get in
the way of this.  See:
https://sourceware.org/ml/libc-alpha/2017-09/msg00409.html

* dir.c (local_lstat): New function, like local_stat.
(dir_setup_glob): Use it to initialize gl_lstat too, as the API
requires.

7 years agoCompute load from number of running processes.
Paul Smith [Sat, 23 Sep 2017 19:55:37 +0000 (15:55 -0400)] 
Compute load from number of running processes.

* job.c (load_too_high): If /proc/loadavg is available, compare the
maximum load against the number of processes currently running.  If
we can't parse /proc/loadavg, use the previous algorithm.

Concept and initial patch from Sven C. Dack <sven.c.dack@sky.com>

7 years agoFix checking existence of directories on MS-Windows
Eli Zaretskii [Sat, 30 Sep 2017 07:56:39 +0000 (10:56 +0300)] 
Fix checking existence of directories on MS-Windows

* remake.c (name_mtime) [WINDOWS32]: Emulate Posix behavior of
'stat' with the likes of "foo/" and "foo/.".

8 years agoUpdate copyright statements for 2017.
Paul Smith [Mon, 10 Jul 2017 01:52:28 +0000 (21:52 -0400)] 
Update copyright statements for 2017.

8 years agoRemove uses of unnecessary "register" keyword.
Paul Smith [Mon, 10 Jul 2017 01:24:41 +0000 (21:24 -0400)] 
Remove uses of unnecessary "register" keyword.

8 years ago* variable.c (create_pattern_var): [SV 51266] Create with xcalloc().
Paul Smith [Sun, 9 Jul 2017 22:56:36 +0000 (18:56 -0400)] 
* variable.c (create_pattern_var): [SV 51266] Create with xcalloc().

Reported by Chris Metcalf <cmetcalf@mellanox.com>

8 years ago[SV 51400] Only unblock fatal signals after child invocation
Paul Smith [Sun, 9 Jul 2017 22:44:17 +0000 (18:44 -0400)] 
[SV 51400] Only unblock fatal signals after child invocation

* job.c (unblock_sigs): Only unblock fatal signals not all signals.
(unblock_all_sigs): Unblock all signals not just fatal signals.
(child_execute_job): Call unblock_all_sigs() in child process.
* job.h: Remove unused function definitions.
* remote-cstms.c (start_remote_job): Call unblock_all_sigs() in
child process.
Reported by Koen Van Hoof <koen.van_hoof@nokia.com>