]> git.ipfire.org Git - thirdparty/make.git/log
thirdparty/make.git
3 years agobootstrap: Remove strtoll()
Paul Smith [Sun, 26 Jun 2022 20:33:30 +0000 (16:33 -0400)] 
bootstrap: Remove strtoll()

This pulls in entirely too much stuff we don't need.  Instead grab
just the gnulib source file, then include it in src/misc.c.

* bootstrap.conf: Add just the lib/strtol.c source file.
* configure.ac: Check for strtoll.
* src/misc.c: Include strtol.c, with QUAD set, if needed.

3 years agobootstrap: Remove gnulib version of mempcpy()
Paul Smith [Sun, 26 Jun 2022 19:55:25 +0000 (15:55 -0400)] 
bootstrap: Remove gnulib version of mempcpy()

This pulls in a metric ton of stuff that we otherwise don't need, just
for a one-liner that we already have a replacement for in src/misc.c.

* bootstrap.conf: Remove mempcpy
* configure.ac: Add mempcpy to AC_CHECK_FUNCS

3 years agoRun autoupdate and clean up autoconf usage
Paul Smith [Mon, 4 Jul 2022 13:47:24 +0000 (09:47 -0400)] 
Run autoupdate and clean up autoconf usage

We can assume that the return type of a signal handler is void.
We can assume that, if sys/time.h exists, it can be included
with time.h.

* bootstrap: Get the latest version
* configure.ac: Require a newer version of autoconf.
Remove unnecessary AC_PROG_CC_C99 (already have AC_PROC_CC).
Remove unnecessary AC_AIX, AC_ISC_POSIX, AC_MINIX.
Remove unnecessary AC_HEADER_STDC, AC_HEADER_TIME, AC_TYPE_SIGNAL.
Use strerror to search for the cposix library.
* src/commands.c (fatal_error_signal): Assume return type is void.
* src/commands.h: Ditto.
* src/job.c: Ditto.
* src/job.h: Ditto.
* src/main.c: Ditto.
* src/makeint.h: Ditto.
Don't bother with TIME_WITH_SYS_TIME.
* src/remote-cstms.c: Check HAVE_SYS_TIME_H.
* src/config.ami.template: Remove RETSIGTYPE.
* src/config.h-vms.template: Ditto.
* src/config.h.W32.template: Ditto.
Remove TIME_WITH_SYS_TIME.

3 years ago[SV 10593] Export variables to $(shell ...) commands
Paul Smith [Sun, 19 Jun 2022 00:25:30 +0000 (20:25 -0400)] 
[SV 10593] Export variables to $(shell ...) commands

Export all variables, including exported makefile variables, when
invoking a shell for the $(shell ...) function.  If we detect a
recursive variable expansion, silently ignore that variable and do
not export it.  We do print a debug message.

* NEWS: Announce the potential backward-incompatibility.
* doc/make.texi (Shell Function): Document the export behavior.
* src/main.c (main): Add "shell-export" to .FEATURES.
* src/job.h: New function to free struct childbase.
* src/job.c (free_childbase): Implement it; call from free_child.
* src/function.c (func_shell_base): Use target_environment() to
obtain the proper environment for the shell function.
Use free_childbase() to free memory.
(windows32_openpipe): Don't reset the environment: the caller
already provided a proper PATH variable in envp.
* src/variable.c (target_environment): If we detect a recursive
expansion and we're called from func_shell, ignore the variable.
(sync_Path_environment): Simplify and reduce memory allocation.
* tests/scripts/functions/shell: Add tests for this.

3 years ago[SV 62650] Show correct warning when combining targets
Dmitry Goncharov [Sun, 19 Jun 2022 17:44:09 +0000 (13:44 -0400)] 
[SV 62650] Show correct warning when combining targets

* src/file.c (rehash_file): Fix warning message.
(rehash_file): Fix comment to match the behavior.
* tests/scripts/features/se_explicit: Fix test.
* tests/scripts/features/mult_rules: Add a new test.

3 years ago[SV 62514] Honor command line interface flags
Dmitry Goncharov [Sat, 18 Jun 2022 21:14:46 +0000 (17:14 -0400)] 
[SV 62514] Honor command line interface flags

Commit f2771aa614 introduced a bug where some switches were left out
of MAKEFLAGS.  Instead of resetting switches, get the same results by
filtering out duplicates.

* src/makeint.h: Remove reset_switches.
* src/main.c: (reset_switches): Remove reset_switches.
* (main): Remove call to reset_switches.
* (decode_switches): Filter out duplicate flags.
* src/variable.c: (set_special_var):  Remove call to reset_switches.
* tests/scripts/variables/MAKEFLAGS: Verify that duplicate flags are
properly filtered out.

3 years agoDon't add GNUMAKEFLAGS to the environment
Paul Smith [Sun, 19 Jun 2022 18:33:57 +0000 (14:33 -0400)] 
Don't add GNUMAKEFLAGS to the environment

If GNUMAKEFLAGS was not present in the environment when we started,
don't add it.

* src/main.c (main): Don't mess with GNUMAKEFLAGS unless it exists.
* tests/scripts/variables/GNUMAKEFLAGS: Test this behavior.

3 years ago* tests/test_driver.pl: Don't freak if diff can't be found
Paul Smith [Sat, 18 Jun 2022 20:42:37 +0000 (16:42 -0400)] 
* tests/test_driver.pl: Don't freak if diff can't be found

3 years ago* build_w32.bat [WIN]: Use call for all invocations
Paul Smith [Sat, 18 Jun 2022 20:42:11 +0000 (16:42 -0400)] 
* build_w32.bat [WIN]: Use call for all invocations

3 years agoAvoid overwriting buffers with long pathnames
Paul Smith [Fri, 17 Jun 2022 23:55:11 +0000 (19:55 -0400)] 
Avoid overwriting buffers with long pathnames

Reported, with initial patch, by Gisle Vanem <gvanem@online.no>

* src/main.c (find_and_set_default_shell) [W32]: Pass search_token
directly to w32ify: no need to make a copy first.  When we need to
construct a path, use snprintf() to be sure we don't overwrite
the locally-allocated buffer.
* src/w32/pathstuff.c (w32ify) [W32]: Use the malloc version of
_fullpath(), followed by strncpy(), to avoid overwriting buffers.

3 years ago* tests/scripts/features/temp_stdin: Remove nested "my"
Paul Smith [Sat, 4 Jun 2022 22:54:22 +0000 (18:54 -0400)] 
* tests/scripts/features/temp_stdin: Remove nested "my"

* tests/scripts/features/statipattrules: Remove unset variable refs.

3 years ago* tests/scripts/features/archives: Fix typo
Dmitry Goncharov [Sat, 4 Jun 2022 22:34:33 +0000 (18:34 -0400)] 
* tests/scripts/features/archives: Fix typo

3 years ago[SV 62100] Add '--shuffle' option support
Sergei Trofimovich [Sat, 4 Jun 2022 19:48:01 +0000 (15:48 -0400)] 
[SV 62100] Add '--shuffle' option support

Introduce non-deterministic ordering into goal and prerequisite
traversal to help tease out inconsistent failures that may happen
when running in parallel build mode.

Introduce second order into each dependency chain:
1. Existing order is syntactic order reachable via 'dep->next'
2. New order is shuffled order stored as 'dep->shuf' in each 'dep'

When updating goals and prerequisites and '--shuffle' is provided,
use the shuffled order to walk the graph.  When automatic variable
are set always use the syntactic order of parameters.

* Makefile.am: Add new src/shuffle.c and src/shuffle.h file.
* build_w32.bat: Ditto.
* builddos.bat: Ditto.
* makefile.com: Ditto.
* po/POTFILES.in: Ditto.
* doc/make.texi: Add documentation for --shuffle.
* doc/make.1: Ditto.
* src/dep.h (DEP): Add the shuf pointer.
* src/filedef.h (struct file): Add was_shuffled flag.
* src/main.c: (shuffle_mode): Global flag for the shuffle mode.
(usage): Add the --shuffle option.
(switches): Ditto.
(main): Set shuffle_mode based on the command line parameter.
Reshuffle prerequisites if requested.
* src/remake.c (update_goal_chain): Walk the shuffled list if enabled.
(update_file_1): Ditto.
* src/shuffle.h: Provide an interface for shuffling prerequisites.
* src/shuffle.c: Implement option parsing and prerequisite shuffling.
* tests/scripts/options/shuffle: Test shuffle option and modes.

3 years ago* src/misc.c (make_toui): Parse a string into an unsigned int
Paul Smith [Sat, 4 Jun 2022 21:44:21 +0000 (17:44 -0400)] 
* src/misc.c (make_toui): Parse a string into an unsigned int

* src/makeint.h: Declare it.
* src/arscan.c (ar_scan): Replace atoi() calls with make_toui().
Modify some integral types to be more correct.
* src/job.c (load_too_high): Replace atoi() calls with make_toui().
* src/main.c (main): Ditto.
(decode_switches): Ditto.

3 years ago* src/misc.c (make_pid): A function to return the PID
Paul Smith [Sat, 4 Jun 2022 20:48:26 +0000 (16:48 -0400)] 
* src/misc.c (make_pid): A function to return the PID

* src/makeint.h: Declare it.
* src/commands.c (fatal_error_signal): Call it.

3 years ago* po/LINGUAS: Add a translation for Romanian
Paul Smith [Sat, 4 Jun 2022 21:04:13 +0000 (17:04 -0400)] 
* po/LINGUAS: Add a translation for Romanian

3 years agoReplace strcmp() with memcmp() where possible
Noah Goldstein [Sun, 24 Apr 2022 21:43:56 +0000 (17:43 -0400)] 
Replace strcmp() with memcmp() where possible

memcmp() is always faster than strcmp().  In places where we already
know that both buffers have sufficient size, replace strcmp() with
memcmp().

* src/main.c (main): Replace strncmp() with memcmp()==0.
* src/read.c (word1eq): Ditto.
* src/commands.c (set_file_variables): Ditto.
* src/function.c (func_filter_filterout): Ditto.
(a_word_hash_cmp): Use STRING_N_COMPARE since we know the length.
(func_sort): Replace strcmp() with memcmp().

3 years agohash: Remove unnecessary isupper() check before tolower()
Noah Goldstein [Sun, 24 Apr 2022 21:39:35 +0000 (17:39 -0400)] 
hash: Remove unnecessary isupper() check before tolower()

The standard requires that tolower() returns its argument if there's
no valid lowercase conversion: it's not necessary to check isupper()
before invoking tolower().

Comparing the performance of the old ISTRING_HASH to the new one
on all the files present in GLIBC.

  Data Type            Old Time   New Time
  Alternating case    24985.754  13883.422
  random case         35211.777  13569.051
  all lower           18818.974  13706.645
  all upper           38859.454  13506.315

* src/hash.h (ISTRING_HASH_1): Omit isupper() check.
(ISTRING_HASH_2): Ditto.

3 years ago[SV 62206] Fix %-substitution in second expansion of pattern rules
Dmitry Goncharov [Sun, 24 Apr 2022 21:10:46 +0000 (17:10 -0400)] 
[SV 62206] Fix %-substitution in second expansion of pattern rules

During second expansion of pattern rules only the first pattern in
each "group" was being substituted.  E.g. in this makefile:

  .SECONDEXPANSION:
  all: hello.x
  %.x: $$(wordlist 1, 99, %.1 %.%.2) ; $(info $@ from $^)
  hello.1 hello.\%.2 \%.1 \%.\%.2: ;

the output would build "hello.1" and "%.%.2" because each function
is considered a single "word" and only the first pattern is replaced.

Fix the expansion so each whitespace-separated string is considered a
word and the first pattern is replaced, giving "hello.1" and
"hello.%.2".

* src/rule.c (snap_implicit_rules): Keep enough space to replace %
with $(*F) if necessary.
* src/implicit.c (pattern_search): During second expansion break each
get_next_word result into individual words and replace the first % in
each with $* or $(*F) as needed.
* tests/scripts/features/patternrules: Add tests for variations.

3 years ago[SV 62175] Rework secondary expansion tests
Dmitry Goncharov [Sun, 24 Apr 2022 18:56:26 +0000 (14:56 -0400)] 
[SV 62175] Rework secondary expansion tests

The hash function we use can yield different results on big- and
little-endian systems which makes test output different.  Choose
names to avoid this.

* tests/scripts/features/patternrules: Choose portable target names.
* tests/scripts/features/se_explicit: Ditto.
* tests/scripts/features/se_implicit: Ditto.

3 years ago* Makefile.am (check-regression): Rename jhelp to thelp
Paul Smith [Sun, 24 Apr 2022 14:50:03 +0000 (10:50 -0400)] 
* Makefile.am (check-regression): Rename jhelp to thelp

3 years ago* tests/scripts/options/dash-f: [SV 62118] Close STDIN
Paul Smith [Sun, 24 Apr 2022 14:40:10 +0000 (10:40 -0400)] 
* tests/scripts/options/dash-f: [SV 62118] Close STDIN

On Windows we can't delete open files, so close STDIN before
removing the temporary input file.

3 years ago* tests/scripts/features/reinvoke: [SV 62088] Close STDIN
Paul Smith [Sun, 24 Apr 2022 14:38:12 +0000 (10:38 -0400)] 
* tests/scripts/features/reinvoke: [SV 62088] Close STDIN

On Windows we can't delete open files, so close STDIN before
removing the temporary input file.

3 years ago* tests/test_driver.pl (run_all_tests): Keep one copy of STDIN
Paul Smith [Sun, 24 Apr 2022 17:34:15 +0000 (13:34 -0400)] 
* tests/test_driver.pl (run_all_tests): Keep one copy of STDIN

3 years ago* Makefile.am: Add INSTALL to the EXTRA_DIST files
Paul Smith [Sun, 24 Apr 2022 13:48:41 +0000 (09:48 -0400)] 
* Makefile.am: Add INSTALL to the EXTRA_DIST files

3 years ago[SV 62356] If -R is set in the makefile, disable -r
Dmitry Goncharov [Sun, 24 Apr 2022 00:46:32 +0000 (20:46 -0400)] 
[SV 62356] If -R is set in the makefile, disable -r

If -R is given on the command line it implies -r as well; make this
same assumption if -R is provided in MAKEFLAGS set in the makefile.

* src/main.c (main): Check no_builtin_variables_flag after reading
makefiles.
* tests/scripts/options/dash-r: Add a test.

3 years ago[SV 62324] Simplify set_file_variables by passing in the stem
Dmitry Goncharov [Sun, 24 Apr 2022 00:34:18 +0000 (20:34 -0400)] 
[SV 62324] Simplify set_file_variables by passing in the stem

Previously we always used the file->stem value as our stem in
set_file_variables(); when that wasn't correct we had to temporarily
set that value while the function was called, then reset it afterward.
This led to issues (for example when we assumed the stem was a cached
string but it wasn't).

Avoid this by passing in the stem as an argument so that different
values can be provided.

Add tests to verify this.

* src/commands.c (set_file_variables): Take second parameter stem to
relieve the callers of set_file_variables() from setting/restoring
file->stem.
* src/commands.h (set_file_variables): Ditto.
(execute_file_commands): Pass file->stem to set_file_variables().
* src/file.c (expand_deps): Pass d->stem to set_file_variables() and
remove set and restore of file->stem.
* src/implicit.c (pattern_search): Pass stem to set_file_variables()
and remove set and restore of file->stem.
* tests/scripts/features/se_explicit: Add new tests.
* tests/scripts/features/se_implicit: Ditto.
* tests/scripts/features/se_statpat: Ditto.
* tests/scripts/variables/automatic: Ditto.

3 years ago[SV 62278] Only expand the first pattern during secondary expansion
Dmitry Goncharov [Sun, 24 Apr 2022 00:21:31 +0000 (20:21 -0400)] 
[SV 62278] Only expand the first pattern during secondary expansion

During normal pattern rule expansion only the first pattern (%) is
expanded; however during secondary expansion all patterns were
expanded.  Modify secondary expansion to match the behavior of normal
expansion.

Implementation tweaked by Paul Smith <psmith@gnu.org>

* src/file.c (expand_deps): Don't use subst_expand() which replaces
all % with $*: instead replace only the first one, by hand.
Fix a memory leak where the dep structure was not always freed.
* tests/scripts/features/statipattrules: Use .RECIPEPREFIX not TAB.
Add a series of tests verifying that static pattern rules with and
without secondary expansion both return the same results.

3 years ago* src/commands.h: [SV 62213] Forward-declare struct file / child
Paul Smith [Sat, 23 Apr 2022 21:13:26 +0000 (17:13 -0400)] 
* src/commands.h: [SV 62213] Forward-declare struct file / child

3 years ago* tests/test_driver.pl (toplevel): [SV 62174] Enforce the C locale
Paul Smith [Sat, 23 Apr 2022 20:45:15 +0000 (16:45 -0400)] 
* tests/test_driver.pl (toplevel): [SV 62174] Enforce the C locale

3 years ago[SV 62173] Fix archive tests for non-GNU systems
Paul Smith [Sat, 23 Apr 2022 20:30:02 +0000 (16:30 -0400)] 
[SV 62173] Fix archive tests for non-GNU systems

Original patch from Dmitry Goncharov <dgoncharov@users.sf.net>

Fix the ar flags to match the default values in make.  If the
U option is supported, add it to the end not the beginning,
since ARFLAGS now starts with a "-".

* tests/test_driver.pl: Add defaults for global variables.
(get_osname): Preserve $osname if it's set from $^O
* tests/scripts/features/archive: Set the default arflags.
If "U" is available add it to the end of the flags.

3 years ago* tests/scripts/options/dash-l: [SV 62172] Skip if not available
Dmitry Goncharov [Sat, 23 Apr 2022 19:53:36 +0000 (15:53 -0400)] 
* tests/scripts/options/dash-l: [SV 62172] Skip if not available

3 years ago* src/read.c (check_specials): [SV 62171] Reset ARFLAGS under .POSIX
Dmitry Goncharov [Sat, 23 Apr 2022 19:47:52 +0000 (15:47 -0400)] 
* src/read.c (check_specials): [SV 62171] Reset ARFLAGS under .POSIX

3 years ago[SV 62145] Remove a stdin temp file on re-exec failure.
Dmitry Goncharov [Sat, 23 Apr 2022 19:33:41 +0000 (15:33 -0400)] 
[SV 62145] Remove a stdin temp file on re-exec failure.

If the re-exec fails, be sure to remove a temp makefile that was
created to read from stdin.

* src/job.c (exec_command): Return on failure.
(child_execute_job): Call exit if exec_command returns.
* src/job.h (exec_command): Don't mark as NORETURN.
* src/main.c (main): Unlink stdin temporary file if re-exec fails.
* tests/run_make_tests.pl: Get value for ERR_nonexe_file/ERR_exe_dir.
* tests/scripts/features/temp_stdin: Test that temp file unlink works.

3 years ago* tests/scripts/features/errors: Fix Perl warnings
Paul Smith [Mon, 18 Apr 2022 20:57:06 +0000 (16:57 -0400)] 
* tests/scripts/features/errors: Fix Perl warnings

* tests/scripts/options/dash-f: Ditto.

3 years ago[SV 62118] Correctly handle -f- options on re-exec
Paul Smith [Sun, 27 Feb 2022 20:24:19 +0000 (15:24 -0500)] 
[SV 62118] Correctly handle -f- options on re-exec

The -f, -file, and --makefile options were not properly handled when
re-exec'ing due to makefile updates.  This problem, plus a patch and
tests, was reported by Dmitry Goncharov <dgoncharov@users.sf.net>.

While examining this I found another bug: after re-exec we forgot the
batch file was temporary and never deleted it.

I decided to fix all these problems at once using a different fix
than Dmitry's: I created a new internal-only command-line option,
--temp-stdin.  When reconstructing the make options for a re-exec,
replace the -f/--file/--makefile option that reads from stdin with
--temp-stdin=<filename> so that the re-exec'd version of make knows
it's a temporary batch file and will delete it.

We no longer need to add the -o options because the re-exec'd make
knows this is a temporary makefile and treats it as such.

To simplify, replace the --file and --makefile options taking a
filename, with just -f<filename> on re-exec.

Some examples of the rewrite:

  User command line               Re-exec command line
  -----------------               --------------------
  -f-                             --temp-stdin=<batch>
  --file -                        --temp-stdin=<batch>
  -f - --makefile a.mk            --temp-stdin=<batch> -fa.mk
  --file=a.mk                     -fa.mk
  -fa.mk                          -fa.mk
  -Rf a.mk                        -Rf a.mk
  -Rf-                            -R --temp-stdin=<batch>

* src/main.c (stdin_offset): Remember the offset into the makefiles
list of the batch file read from stdin.  Remove stdin_nm.
(struct command_switch): Create a new --temp-stdin option, which
also updates the makefiles list.
(main): Add the temporary filename to the string cache.
Move the tempfile handling after checking makefile arguments for "-"
so that files provided via --temp-stdin are also handled specially.
When rewriting re-exec options, we may need one more than we had
originally so create a new argv list.  Walk through the original
list and convert it to the new list, following the above process.
(decode_switches): Set the stdin_offset flag if we see --temp-stdin.
* tests/scripts/options/dash-f: Add many more tests, provided by
Dmitry Goncharov <dgoncharov@users.sf.net>.

3 years ago* tests/scripts/variables/MAKE_RESTARTS: Remove TAB chars
Paul Smith [Sun, 27 Feb 2022 20:14:40 +0000 (15:14 -0500)] 
* tests/scripts/variables/MAKE_RESTARTS: Remove TAB chars

3 years ago* README.git: Fix compiler options for ASAN
Paul Smith [Sun, 27 Feb 2022 20:14:12 +0000 (15:14 -0500)] 
* README.git: Fix compiler options for ASAN

3 years agoRemove extraneous characters from fatal() calls
Paul Smith [Sat, 26 Feb 2022 23:30:00 +0000 (18:30 -0500)] 
Remove extraneous characters from fatal() calls

The fatal() method adds ".  Stop.\n" to every message.

* src/amiga.c (MyExecute): Remove newline from fatal() message.
* src/job.c (<various>): Ditto.
* src/file.c (snap_deps): Remove "." from fatal() message.
* src/main.c (main): Ditto.
* src/load.c: Ditto.
* tests/scripts/targets/NOTINTERMEDIATE: Fix expected output.

3 years ago* src/main.c: Ensure the stdin temp file is deleted when dying.
Paul Smith [Sat, 26 Feb 2022 22:17:20 +0000 (17:17 -0500)] 
* src/main.c: Ensure the stdin temp file is deleted when dying.

3 years ago[SV 62088] Avoid re-exec due to stdin.
Dmitry Goncharov [Sat, 26 Feb 2022 22:12:03 +0000 (17:12 -0500)] 
[SV 62088] Avoid re-exec due to stdin.

The fix for SV 60595 causes make to re-execute when the makefile is
read from stdin.  E.g.
    $ printf 'all:; $(info hello)' | make -sf -

Reported by Sergei Trofimovich <siarheit@google.com>
Test added by Paul Smith <psmith@gnu.org>

* src/main.c (main): Set the mtime of the stdin temporary file.
* tests/scripts/features/reinvoke: Add a test.

3 years agotests: Allow run_make_test() to avoid passing -f
Paul Smith [Sat, 26 Feb 2022 22:19:42 +0000 (17:19 -0500)] 
tests: Allow run_make_test() to avoid passing -f

We already use undef makefile strings to mean "re-use the previous
makefile", so if the string is empty we'll assume it means "don't
use a makefile at all" (don't add -f).

* tests/run_make_tests.pl (run_make_test): If the makefile string
is empty, don't create a makefile or add -f.
* tests/scripts/features/include: Change empty makefile to "\n".
* tests/scripts/misc/close_stdout: Ditto.
* tests/scripts/options/dash-r: Ditto.

3 years agotests: Preserve Windows temp environment variables
Paul Smith [Sun, 27 Feb 2022 22:44:16 +0000 (17:44 -0500)] 
tests: Preserve Windows temp environment variables

* src/main.c (main): Show the temp filename on error.  Also on
Windows prefer TMP, then TEMP, and only lastly TMPDIR.
* tests/test_driver.pl: Add TMP, TEMP, and USERPROFILE to the list
of environment variables to preserve.

3 years ago* tests/test_driver.pl: Support STDIN redirection.
Paul Smith [Sat, 26 Feb 2022 22:19:26 +0000 (17:19 -0500)] 
* tests/test_driver.pl: Support STDIN redirection.

Before running tests, duplicate STDIN then reset it after the test
completes.  Also when -keep is provided, preserve the base and run
files.

3 years agoEnsure buffers are large enough for integer values
Paul Smith [Mon, 21 Feb 2022 14:29:41 +0000 (09:29 -0500)] 
Ensure buffers are large enough for integer values

Issue raised by Sergei Trofimovich <siarheit@google.com>

* src/makeint.h (INTSTR_LENGTH): Update for unsigned values.
* src/function.c (func_lastword): Use INTSTR_LENGTH as buffer size.
(shell_function_completed): Ditto.
(func_call): Ditto.
* src/remote-cstms.c (start_remote_job): Ditto.

3 years ago* <all>: Update copyright notices.
Paul Smith [Thu, 10 Feb 2022 19:48:26 +0000 (14:48 -0500)] 
* <all>: Update copyright notices.

3 years ago* doc/make.1: Use "target" from the SYNOPSIS.
Paul Smith [Sun, 6 Feb 2022 22:53:48 +0000 (17:53 -0500)] 
* doc/make.1: Use "target" from the SYNOPSIS.

Reported by Helge Kreutzmann <debian@helgefjell.de>

3 years agoDon't write $(shell ...) stdout to stderr on failure
Paul Smith [Sun, 6 Feb 2022 21:22:40 +0000 (16:22 -0500)] 
Don't write $(shell ...) stdout to stderr on failure

If a $(shell ...) invocation failed due to a command-not-found error,
make wrote the stdout of that shell to our stderr for some reason.
That seems very wrong.

If the command's stderr was not redirected then its output would have
already been written to its stderr, and if it was redirected then we
shouldn't take it upon ourselves to force it to go to stderr!

* src/function.c (func_shell_base): Append shell stdout even if the
shell command failed.
* tests/run_make_tests.pl: Determine the error generated for
command-not-found situations.
* tests/scripts/functions/shell: Verify that redirecting stderr to
stdout will behave properly if the command is not found.

3 years ago* Basic.mk.template: Allow arguments to the check target.
Paul Smith [Mon, 24 Jan 2022 06:16:58 +0000 (01:16 -0500)] 
* Basic.mk.template: Allow arguments to the check target.

3 years ago[SV 61805] Support quoted whitespace in .SHELLFLAGS with .ONESHELL
Dmitry Goncharov [Mon, 24 Jan 2022 05:57:28 +0000 (00:57 -0500)] 
[SV 61805] Support quoted whitespace in .SHELLFLAGS with .ONESHELL

* src/job.c (construct_command_argv_internal): Call recursively to
parse .SHELLFLAGS when .ONESHELL is active.
* tests/scripts/targets/ONESHELL: Add tests.

3 years ago* tests/scripts/features/double_colon: Update for modern tests.
Paul Smith [Sun, 23 Jan 2022 20:46:56 +0000 (15:46 -0500)] 
* tests/scripts/features/double_colon: Update for modern tests.

3 years ago* tests/scripts/features/implicit_search: Add -r for safety.
Paul Smith [Sun, 23 Jan 2022 16:41:46 +0000 (11:41 -0500)] 
* tests/scripts/features/implicit_search: Add -r for safety.

3 years ago[SV 48643] Add more tests of intermediates and unrelated targets
Dmitry Goncharov [Fri, 21 Jan 2022 23:37:44 +0000 (18:37 -0500)] 
[SV 48643] Add more tests of intermediates and unrelated targets

If a prereq of a pattern is explicitly mentioned as a prereq of an
unrelated rule, it should not be considered an intermediate file.

* tests/scripts/features/double_colon: Add tests mentioning unrelated
explicit targets.
* tests/scripts/features/grouped_targets: Ditto.
* tests/scripts/features/implicit_search: Ditto.
* tests/scripts/features/patternrules: Ditto.
* tests/scripts/features/se_implicit: Ditto.
* tests/scripts/features/statipattrules: Ditto.

3 years ago[SV 48643] Make prereqs mentioned in unrelated rules explicit
Dmitry Goncharov [Fri, 21 Jan 2022 23:29:23 +0000 (18:29 -0500)] 
[SV 48643] Make prereqs mentioned in unrelated rules explicit

* src/implicit.c (pattern_search): Set is_explicit when a prereq
is mentioned in an unrelated rule.

3 years ago* src/implicit.c (pattern_search): [SV 61864] Fix debug output.
Dmitry Goncharov [Thu, 20 Jan 2022 07:19:52 +0000 (02:19 -0500)] 
* src/implicit.c (pattern_search): [SV 61864] Fix debug output.

3 years agoAvoid interleaved $(info ) output
Paul Smith [Wed, 19 Jan 2022 23:49:19 +0000 (15:49 -0800)] 
Avoid interleaved $(info ) output

Since $(info ) function output is written using two system calls for
the message and the newline, it's possible for output from another
parallel make job to sneak in between them.

Reported by Paul Eggert <eggert@cs.ucla.edu>, who saw the report from
Lars Ingebrigtsen <https://bugs.gnu.org/53358>.

* src/function.c (func_error): Paul provided a fix but instead I
rewrote the entire function: it's not possible for it to be invoked
with anything other than exactly one argument so don't worry about
re-combining the arguments.

3 years ago* tests/scripts/features/implicit_search: [SV 48643] Cleanups.
Paul Smith [Thu, 20 Jan 2022 00:45:12 +0000 (19:45 -0500)] 
* tests/scripts/features/implicit_search: [SV 48643] Cleanups.

3 years ago* src/implicit.c (pattern_search): Use const ptrs when possible.
Paul Smith [Wed, 19 Jan 2022 22:43:57 +0000 (17:43 -0500)] 
* src/implicit.c (pattern_search): Use const ptrs when possible.

Change suggested by Joe Filion <joefilion4@gmail.com>

3 years ago* src/job.c (load_too_high): Re-enable Linux /proc/loadavg checks.
Paul Smith [Wed, 19 Jan 2022 18:44:22 +0000 (13:44 -0500)] 
* src/job.c (load_too_high): Re-enable Linux /proc/loadavg checks.

Further experimentation shows that my previous thinking that there
was a problem using this was woefully mistaken.  The value generated
by the kernel shows runn*ABLE* processes not runn*ING* processes.
* NEWS: Announce the change.

3 years ago* doc/make.texi (Using One Shell): Correct example to use $<.
Paul Smith [Tue, 18 Jan 2022 21:06:24 +0000 (16:06 -0500)] 
* doc/make.texi (Using One Shell): Correct example to use $<.

3 years ago* src/function.c (parse_textint): Handle ints without 0 properly.
Jouke Witteveen [Tue, 18 Jan 2022 00:11:59 +0000 (19:11 -0500)] 
* src/function.c (parse_textint): Handle ints without 0 properly.

* tests/scripts/functions/intcmp: Add tests for values without 0.

3 years ago[SV 61226] Revert changes to detect missing included files
Paul Smith [Mon, 17 Jan 2022 23:23:42 +0000 (18:23 -0500)] 
[SV 61226] Revert changes to detect missing included files

The fix for SV 60595 introduced a backward-incompatibility: rules that
purported to rebuild included files, but didn't actually do so, were
treated as errors whereas before they were ignored.  This breaks a
common idiom in makefiles where an empty recipe is created for an
included makefile so make doesn't complain if it doesn't exist.

Unfortunately this means make cannot diagnose some types of errors.

Extra tests supplied by Dmitry Goncharov <dgoncharov@users.sf.net>.

* doc/make.texi (Including Other Makefiles): Clarify this behavior.
* src/main.c (main): Don't run the new check-for-errors behavior.
* tests/scripts/features/reinvoke: Reset tests of the "old" behavior
and add new tests for this situation.

3 years agoEnsure that loaded functions increment the command count
Paul Smith [Mon, 17 Jan 2022 22:15:00 +0000 (17:15 -0500)] 
Ensure that loaded functions increment the command count

Since we don't know what a loaded function (via Guile or load) may
do, increment the command count just in case.

* src/function.c (struct file_table_entry): New adds_command bool.
(FT_ENTRY): Initialize it to 0 for built-in functions.
(expand_builtin_function): If adds_command, increment the count.
(define_new_function): Set adds_command for loaded functions.

3 years ago* src/read.c (tilde_expand): Put back '/' before returning.
Paul Smith [Sat, 8 Jan 2022 22:31:56 +0000 (17:31 -0500)] 
* src/read.c (tilde_expand): Put back '/' before returning.

Joe Filion <joefilion4@gmail.com> noted that the string is modified,
and Henrik Carlqvist <hc94@poolhem.se> noticed that it wasn't put
back in all cases.

3 years ago* tests/scripts/targets/INTERMEDIATE: Rewrite for new test method
Paul Smith [Wed, 29 Dec 2021 20:27:04 +0000 (15:27 -0500)] 
* tests/scripts/targets/INTERMEDIATE: Rewrite for new test method

3 years agoDo not force targets to be SECONDARY
Paul Smith [Wed, 29 Dec 2021 19:44:46 +0000 (14:44 -0500)] 
Do not force targets to be SECONDARY

In SV 43677 we forced targets to be secondary if we found an
intermediate file that was listed as a prerequisite of another
target.  This overrides .INTERMEDIATE settings, so doesn't work.
Now that we have an is_explicit flag in targets, use that instead.

* src/implicit.c (pattern_search): Remove setting of secondary.
Preserve the value of the is_explicit flag when creating a new
file target, and consider it when setting the intermediate flag.
* tests/scripts/features/patternrules: Add a test w/out INTERMEDIATE
* tests/scripts/targets/INTERMEDIATE: Add a test with INTERMEDIATE

3 years ago[SV 48643] Preserve target-specific variables on intermediate files
Dmitry Goncharov [Wed, 29 Dec 2021 19:26:40 +0000 (14:26 -0500)] 
[SV 48643] Preserve target-specific variables on intermediate files

Target-specific variables used to define the target as "ought to
exist" so they could never be intermediate.  Now they can be, so
merge the target-specific variables from the intermediate target
so they're not lost.

* src/implicit.c (pattern_search): Use merge_variable_set_lists
to merge target-specific variables.
* tests/scripts/features/implicit_search: Add tests of target-
specific variable assignments and implicit rules.

3 years ago* README.template: Clean up patch submission information
Paul Smith [Mon, 20 Dec 2021 05:31:05 +0000 (00:31 -0500)] 
* README.template: Clean up patch submission information

3 years ago* src/read.c (find_percent_cached): [SV 60798] Silence GCC11 warnings
Jouke Witteveen [Sun, 19 Dec 2021 21:19:02 +0000 (16:19 -0500)] 
* src/read.c (find_percent_cached): [SV 60798] Silence GCC11 warnings

3 years ago[SV 60798] Silence bogus GCC10 and GCC11 warnings
Jouke Witteveen [Sun, 19 Dec 2021 21:09:07 +0000 (16:09 -0500)] 
[SV 60798] Silence bogus GCC10 and GCC11 warnings

* src/main.c (main): Use a separate variable to track final character.
* src/read.c (eval): Track the semicolon position not one beyond it.
* src/variable.c (do_variable_definition): Include a default switch
case to ease the work of the exhaustiveness prover.

3 years agoUpdate documentation with instructions for patch submission
Paul Smith [Sat, 18 Dec 2021 23:25:38 +0000 (18:25 -0500)] 
Update documentation with instructions for patch submission

* README.template: Add notes on how to submit patches.
* README.git: Point to the README.
* doc/make.texi: Ditto.

3 years agoChange HTTP URLs to use HTTPS instead
Paul Smith [Sat, 18 Dec 2021 23:23:16 +0000 (18:23 -0500)] 
Change HTTP URLs to use HTTPS instead

Also remove unnecessary tests/COPYING file.

* README.template: Change http: to https:
* README.git: Ditto
* doc/make.texi: Ditto
* doc/make.1: Ditto
* src/main.c: Ditto
* maintMakefile: Remove invalid URL

3 years ago* src/makeint.h: Compute INTSTR_LENGTH based on size of intmax_t
Paul Smith [Sun, 19 Dec 2021 19:48:26 +0000 (14:48 -0500)] 
* src/makeint.h: Compute INTSTR_LENGTH based on size of intmax_t

Math suggested by Edward Welbourne <edward.welbourne@qt.io>

3 years agoRemove arbitrary limits on intcmp integers
Paul Eggert [Sun, 19 Dec 2021 19:48:14 +0000 (14:48 -0500)] 
Remove arbitrary limits on intcmp integers

We don't need to parse strings into C integer values to compare them.

* src/function.c (parse_textint): Find boundaries of a numeric string.
(func_intcmp): Use parse_textint() to compare integers textually.
* tests/scripts/functions/intcmp: Test with extra-large numbers.

3 years agoUse a well-known error string for out-of-bound function arguments
Paul Smith [Sat, 18 Dec 2021 23:11:30 +0000 (18:11 -0500)] 
Use a well-known error string for out-of-bound function arguments

* src/function.c (parse_numeric): Check for empty value and error.
If we find ERANGE just print our own error, not strerror.
(func_word): Use a generic "not good" error message.
(func_wordlist): Ditto
(func_intcmp): Ditto
* tests/run_make_tests.pl: Remove code to find strerror(ERANGE)
* tests/scrips/functions/intcmp: Update the error message.
* tests/scrips/functions/word: Ditto.

3 years ago* doc/make.text (Wildcards): Document that glob results are sorted.
Paul Smith [Sun, 5 Dec 2021 20:16:26 +0000 (15:16 -0500)] 
* doc/make.text (Wildcards): Document that glob results are sorted.

3 years ago[SV 61621] Don't use POSIX_SPAWN_RESETIDS with posix_spawn()
Paul Smith [Sun, 5 Dec 2021 19:22:43 +0000 (14:22 -0500)] 
[SV 61621] Don't use POSIX_SPAWN_RESETIDS with posix_spawn()

When make is invoked in a environment where the user namespace is
restricted, such as under unshare(1) (on GNU/Linux), it won't be able
to find its real UID so the effective UID can't be set to it and
posix_spawn() will fail with EINVAL.

It's not less safe to run recipe jobs using the same UID values that
make was invoked with, so don't worry about this flag.

* src/job.c (child_execute_job): Don't set POSIX_SPAWN_RESETIDS flag.

3 years ago* .gitignore: Ignore patch files.
Paul Smith [Sun, 5 Dec 2021 19:21:47 +0000 (14:21 -0500)] 
* .gitignore: Ignore patch files.

3 years ago* src/commands.c (fatal_error_signal) [W32]: Use %lu for DWORD.
U2FsdGVkX1 [Sun, 28 Nov 2021 20:25:45 +0000 (15:25 -0500)] 
* src/commands.c (fatal_error_signal) [W32]: Use %lu for DWORD.

* src/function.c (windows32_openpipe) [W32]: Ditto.

Copyright-paperwork-exempt: yes

3 years ago* NEWS: Update with author details
Paul Smith [Sun, 28 Nov 2021 19:34:05 +0000 (14:34 -0500)] 
* NEWS: Update with author details

3 years agoSpecial-case Windows error results
Paul Smith [Sun, 28 Nov 2021 19:17:55 +0000 (14:17 -0500)] 
Special-case Windows error results

* tests/scripts/features/errors: Match Windows-specific errors.
* tests/scripts/features/targetvars: Match Windows-specific errors.
* tests/scripts/misc/general4: Match Windows-specific errors.

3 years agoConvert word, wordlist, and intcmp functions to use long long
Paul Smith [Sun, 28 Nov 2021 14:50:10 +0000 (09:50 -0500)] 
Convert word, wordlist, and intcmp functions to use long long

Modify make functions that parse integer values to use long long
values instead of long: on Windows long is the same as int (4 bytes)
and we don't want behavior to differ between different platforms.

* bootstrap.conf: Change strtol module to strtoll module.
* src/function.c (parse_numeric): Use strtoll() and return long long.
(func_word): Use long long.
(func_wordlist): Use long long.  Verify second argument is >= 0.
(func_intcmp): Use long long.
* src/config.ami.template: Don't define HAVE_STRTOLL.
* src/config-vms.template: Define HAVE_STRTOLL.
* src/config.W32.template: Define HAVE_STRTOLL.
* tests/run_make_tests.pl: Set $ERR_out_of_range to the proper string.
* tests/scripts/functions/word: Rework to use the new style and avoid
TAB characters.  Verify trailing whitespace is ignored.  Add a test
for a negative second argument to wordlist.  Add tests for max signed
integer values.  Use $ERR_out_of_range for the error string.
* tests/scripts/functions/intcmp: Add tests for min and max signed
integer values.  Use $ERR_out_of_range for the error string.

3 years agoIntroduce $(intcmp ...) for numerical comparison
Jouke Witteveen [Fri, 16 Jul 2021 12:04:41 +0000 (14:04 +0200)] 
Introduce $(intcmp ...) for numerical comparison

Numbers can come from $(words ...), automatic variables such as
$(MAKELEVEL), from environment variables, or from shell output such as
through $(shell expr ...).  The $(intcmp ...) function allows
conditional evaluation controlled by numerical variables.

* NEWS: Announce this feature.
* doc/make.texi (Functions for Conditionals): Document 'intcmp'.
* src/function.c (func_intcmp): Create the 'intcmp' built-in function.
* tests/scripts/functions/intcmp: Test the 'intcmp' built-in function.

3 years agoUse strtol() instead of atoi()
Jouke Witteveen [Fri, 16 Jul 2021 12:04:33 +0000 (14:04 +0200)] 
Use strtol() instead of atoi()

strtol() is part of C89 and a fallback is provided by gnulib.

* src/function.c (func_word, func_wordlist): Change atoi to strtol.
* test/scripts/functions/word: Add out-of-range verification testing.

3 years ago* src/makeint.h: Removed unused atol declaration
Jouke Witteveen [Fri, 16 Jul 2021 12:04:22 +0000 (14:04 +0200)] 
* src/makeint.h: Removed unused atol declaration

3 years ago* src/implicit.c (pattern_search): Fix text for easier translation.
Paul Smith [Sat, 27 Nov 2021 20:08:56 +0000 (15:08 -0500)] 
* src/implicit.c (pattern_search): Fix text for easier translation.

3 years ago[SV 48643] Update the implicit rule search docs
Paul Smith [Sun, 28 Nov 2021 02:57:37 +0000 (21:57 -0500)] 
[SV 48643] Update the implicit rule search docs

* NEWS: Announce the change.
* doc/make.texi (Implicit Rule Search): Update the definition of
"ought to exist" and add the extra step for compatibility mode.

3 years ago[SV 48643] Enhance "ought to exist" definition
Dmitry Goncharov [Sun, 28 Nov 2021 03:00:05 +0000 (22:00 -0500)] 
[SV 48643] Enhance "ought to exist" definition

The traditional definition of "ought to exist" in the user's manual can
lead to make choosing a poor series of chained implicit rules.  Modify
that rule so that we first attempt to resolve implicit rules by
considering targets which are only (a) targets or (b) explicit
prerequisites of the current target.

For backward-compatibility, if we don't find a solution using that
algorithm use the previous definition where "ought to exist" means
"mentioned as a prerequisite of any target".

* src/implicit.c (pattern_search): An extra argument controls whether
to perform the backward-compatible rule search or not.  If a prereq is
a target, or if it's a prerequisite of THIS target, then choose it.
If we get to the end and haven't found a match, but we have found a
potential compatibility rule, then retry with compat rules enabled.
If we're searching with compat rules enabled and we find a file
mentioned as a prerequisite of ANY target, then use it.
* tests/features/implicit_search: Provide a large suite of tests for
different steps of implicit rule search.

3 years agotests: Enhance output to contain filename/line number info
Paul Smith [Sat, 27 Nov 2021 19:03:44 +0000 (14:03 -0500)] 
tests: Enhance output to contain filename/line number info

* tests/scripts/options/dash-I: Use string comparison operator.
* tests/test_driver.pl (cmd2str): New method to convert a
command line to a string with proper quoting.
* tests/run_make_tests.pl (create_command): Call cmd2str() to format
the command.  Add the filename/line number to the output.

3 years ago[SV 61042] Enhance logging of implicit rule search
Dmitry Goncharov [Sun, 17 Oct 2021 22:03:04 +0000 (18:03 -0400)] 
[SV 61042] Enhance logging of implicit rule search

Logging of implicit rule search gives limited information as to why a
given implicit rule was rejected, and if no implicit rule is found we
get the confusing "No rule to make target" result when the real issue
is that some prerequisite of some implicit rule could not be built.

Enhance logging around implicit rule search as follows:
1. The messages which refer to a rule print a description (the targets
   and prerequisites) of the rule.
2. A new message tells when a rule is rejected, along with the reason.
3. The 'Looking for an implicit rule...' message is printed for every
   prerequisite, not just the top-level target.
4. "Trying harder" message is printed, when intermediate prerequisites
   are going to be searched.
5. The 'No rule found...' and 'Found implicit rule...' messages are
   printed for every prerequisite, not just the top-level target.
6. "Ought to exist...", "Found..." or "Not found..." message is
   printed for each prerequisite.

* src/rule.h (struct rule): Remember the definition of the rule.
* src/rule.c (get_rule_defn): Compute the definition of a rule.
(install_pattern_rule): Initialize the definition to empty.
(create_pattern_rule): Ditto.
(freerule): Free the definition.
(print_rule): Use the definition when printing rules.
* src/remake.c (update_file_1): Push debug output down into
try_implicit_rule().
* src/implicit.c (try_implicit_rule): Add debugging
(pattern_search): Show the rule definition in various debug output.
Add new debug messages for implicit rule search.

Additional changes by Paul Smith <psmith@gnu.org>:

Since we usually don't need the rule definition, defer computing it
until we do.

* bootstrap.conf: Include the mempcpy Gnulib module.
* src/makeint.h (mempcpy): Declare mempcpy if not available.
* src/misc.c (mempcpy): Define mempcpy if not available.
* src/config.h-vms.template: Don't set HAVE_MEMPCPY.
* src/config.h.W32.template: Ditto.
* src/rule.h (get_rule_defn): Return the definition of a rule.
* src/rule.c (get_rule_defn): If we don't have a definition compute
it; either way return it.
* src/implicit.c (pattern_search): Rework the handling of explicit
prerequisites to pattern rules to be more clear.  There is no change
in behavior.

3 years ago* doc/make.texi (Special Targets): [SV 61122] Add .SECONDARY example
Dmitry Goncharov [Sat, 2 Oct 2021 19:19:15 +0000 (15:19 -0400)] 
* doc/make.texi (Special Targets): [SV 61122] Add .SECONDARY example

3 years ago* README.git: Update C version prerequisite
Paul Smith [Sun, 17 Oct 2021 23:07:36 +0000 (19:07 -0400)] 
* README.git: Update C version prerequisite

4 years agoAdd support for the POSIX :::= assignment operator.
Paul Smith [Sat, 18 Sep 2021 22:53:38 +0000 (18:53 -0400)] 
Add support for the POSIX :::= assignment operator.

POSIX Issue 8 will require a new assignment operator, :::=.
This operator behaves similarly to the BSD make := operator: the
right-hand side is expanded immediately, but then the value is
re-escaped (all '$' are converted to '$$') and the resulting variable
is considered a recursive variable: the value is re-expanded on use.

* src/variable.h (enum variable_flavor): Add f_expand flavor.
* src/variable.c (do_variable_definition): When defining f_expand,
post-process the result to re-escape '$' characters.
Remove default: to the compiler warns about un-handled enum values.
Set recursive values for both f_recursive and f_expand.
(parse_variable_definition): Rewrite this method.
The previous version was annoying to extend to ':::='.
(print_variable): Remove default: so the compiler warns us about
un-handled enum values.
* src/function.c (func_origin): Remove default: so the compiler warns
us about un-handled enum values.
* doc/make.texi: Add documentation for :::=.
* tests/scripts/variables/define: Add a test for define :::=.
* tests/scripts/variables/flavors: Add tests for :::=.
* tests/scripts/variables/negative: Add tests for :::=.

4 years agoClean up more Windows warnings.
Paul Smith [Tue, 7 Sep 2021 05:02:25 +0000 (01:02 -0400)] 
Clean up more Windows warnings.

* src/config.h.W32.template: Re-enable warnings that we don't violate.
Add a new disabled warning: 4130 (logical operation on address of
string constant).
* src/w32/compat/posixfcn.c: Make makeint.h the first included header.
* src/w32/subproc/sub_proc.c: Ditto.  It includes config.h already.

4 years ago[SV 60435] Ensure intermediate grouped files are removed
Dmitry Goncharov [Tue, 7 Sep 2021 04:08:27 +0000 (00:08 -0400)] 
[SV 60435] Ensure intermediate grouped files are removed

If multiple intermediate files are built together be sure all of them
are removed after make is finished.  Continue to ensure that targets
that exist before make starts are not removed even if they appear to be
intermediate.

Add a number of tests to pattern rules to verify this behavior.

* src/filedef.h (struct file): Add a new is_explicit bitfield.
* src/file.c (rehash_file): Merge the is_explicit bit.
(enter_prereqs): Set is_explicit if the file is explicitly mentioned.
* src/implicit.c (pattern_search): Set intermediate on the file if it's
not explicit.
(record_files): Set is_explicit if a file is mentioned as a target.
* src/remake.c (update_file_1): Set secondary on files that already
exist so they won't be removed.
* tests/scripts/features/double_colon: Add a test for double-colon
pattern rules.
* tests/scripts/features/patternrules: Update KGO for tests where more
files are removed.
Add new tests to verify handling removal of intermediate files in the
context of grouped pattern targets.

4 years ago* src/default.c (default_variables): Use CPP in PREPROCESS.S.
Paul Smith [Tue, 7 Sep 2021 00:42:34 +0000 (20:42 -0400)] 
* src/default.c (default_variables): Use CPP in PREPROCESS.S.

4 years ago* src/main.c (decode_debug_flags): [SV 607777] Preserve -d options
Dmitry Goncharov [Tue, 7 Sep 2021 00:36:15 +0000 (20:36 -0400)] 
* src/main.c (decode_debug_flags): [SV 607777] Preserve -d options

* tests/scripts/options/dash-d: Test that -d --trace keeps -d.

4 years ago[SV 57778] Don't ignore included makefiles that can't be read
Dmitry Goncharov [Tue, 7 Sep 2021 00:20:28 +0000 (20:20 -0400)] 
[SV 57778] Don't ignore included makefiles that can't be read

If we find an included makefile but it's not readable, stop
immediately with an error rather than continuing to look in other
directories.

* src/read.c (eval_makefile): Only keep searching if the fopen error
is ENOENT, else stop and fail.
* tests/scripts/features/include: Add tests to verify this behavior.

4 years ago[SV 60795] Don't remake phony included makefiles and show errors
Paul Smith [Mon, 6 Sep 2021 21:47:04 +0000 (17:47 -0400)] 
[SV 60795] Don't remake phony included makefiles and show errors

Change the handling of included makefiles which are phony targets to
be similar to double-colon rules with no prerequisites: simply don't
build them at all during the remake a makefile phase.

Ensure that any included makefile which is needed but not built
results in an error.

Update the documentation to make this clear.
Add tests to verify this behavior.

* doc/make.texi (Remaking Makefiles): Clarify double-colon exception.
Document that phony targets are handled the same way.
(Phony Targets): Ditto.
* src/main.c (main): Check for phony targets when skipping goals.
Rather than throwing out skipped but failed goals keep them
separately then report them as errors.
* src/read.c (eval): Set the file location on included makefiles even
when there's no error.
* tests/scripts/features/include: Add tests for handling included
makefiles with both phony and double-colon rules to rebuild them.

4 years ago* doc/make.texi (Environment): [SV 60841] Clarify variable exporting.
Paul Smith [Mon, 6 Sep 2021 14:57:43 +0000 (10:57 -0400)] 
* doc/make.texi (Environment): [SV 60841] Clarify variable exporting.