Compare commits

..

91 Commits
4.2.90 ... 4.3

Author SHA1 Message Date
Paul Smith
f430a65ccb GNU Make release 4.3
* NEWS: Update for the release
* configure.ac: New release number
* doc/make.texi: New edition number
2020-01-19 17:04:52 -05:00
Paul Smith
c30da63fd2 * configure.ac (guile): Check for Guile 3.0 installations 2020-01-19 17:04:52 -05:00
Paul Smith
3fb7312e9f * src/job.c (sh_cmds): [SV 57625] Update builtin shell command list 2020-01-19 17:04:52 -05:00
Paul Smith
dd6adfa454 Resolve some documentation issues
* doc/make.texi (Interrupts): [SV 46193] Recommend defensive recipes
* doc/make.texi: [SV 49262] Clarify interaction of prerequisites and
non-terminal match-anything rules.
2020-01-19 17:04:52 -05:00
Paul Smith
3b5e47b2e2 [SV 40657] Reinstate old behavior for suffix rules with prereqs
POSIX says that suffix rules cannot have prerequisites, but after
making this change we observed a number of makefiles "in the wild"
that were relying on this behavior and failed.

For .POSIX: makefiles, obey POSIX.  Otherwise preserve the old
behavior.  However, generate a warning so users know this is a
problem.  In a future version we will change all behavior to be
POSIX-conforming.

* NEWS: describe the change
* src/rule.c (convert_to_pattern): If posix_pedantic don't make a
pattern rule if prereqs exist.  Otherwise show a warning.
* tests/scripts/features/suffixrules: Add tests for the new behavior
including .POSIX vs. non-.POSIX.
2020-01-19 17:04:52 -05:00
Dmitry Goncharov
4e277f6fbd * tests/test_driver.pl: Enhance error messages 2020-01-05 10:46:58 -05:00
Paul Smith
ec946d7e21 * doc/make.texi: Change the GFDL to an Appendix 2020-01-04 13:24:39 -05:00
Paul Smith
16d06006a4 * NEWS: Clarify authorship of new features. 2020-01-04 13:24:39 -05:00
Paul Smith
b774aebffa Enable compilation with C90 compilers
* configure.ac: Try compiling Guile headers: they don't work with C90.
* maintMakefile: Simplify config checks via target-specific variables.
* src/makeint.h: Use ATTRIBUTE rather than defining __attribute__,
as that causes compile issues with system headers.
(ENUM_BITFIELD): Don't use enum bitfields in ANSI mode.
* src/main.c: Use ATTRIBUTE instead of __attribute__.
* src/job.h: Ditto.
* src/file.c: Don't define variables inside for loops.
* src/rule.c: Ditto.
* src/dep.h (SI): Only use static inline in non-ANSI mode.
2020-01-04 13:23:23 -05:00
Paul Smith
06de697268 * bootstrap: Update to the latest gnulib version 2020-01-03 15:44:13 -05:00
Paul Smith
fdfe0446b6 Release GNU make 4.2.93
* NEWS: Update the release and date
* configure.ac: Update the release number
2020-01-03 02:08:59 -05:00
Paul Smith
12b14f0484 Update copyright statements for 2020 2020-01-03 02:08:59 -05:00
Paul Smith
4e12a5fa45 Support the .EXTRA_PREREQS special variable
Initial implementation by Christof Warlich <cwarlich@gmx.de>

* NEWS: Announce the new feature.
* doc/make.texi (Other Special Variables): Document .EXTRA_PREREQS.
* src/dep.h (struct dep): New flag to note extra prereq deps.
* src/filedef.h (expand_extra_prereqs): Declare a function to expand
the value of .EXTRA_PREREQS.
* src/file.c (expand_extra_prereqs): Given a struct variable lookup
of .EXTRA_PREREQS, convert it into a list of deps and for each one
make sure it has a struct file and has the new flag set.
(snap_file): A new function invoked by hash_map that will perform
per-file operations: set up second expansion, intermediate, and also
.EXTRA_PREREQS.  Manage circular dependencies by ignoring them.
(snap_deps): Defer per-file operations until the end.  Look up the
global .EXTRA_PREREQS and pass it along to snap_file for each file.
* src/implicit.c (struct patdeps): Remember the extra prereqs flag.
(pattern_search): Transfer extra prereqs flag settings into the
matched pattern rule.
* src/rule.h (snap_implicit_rules): Rename count_implicit_rules to
snap_implicit_rules since we now do more than count.
* src/rule.c (snap_implicit_rules): As we walk through all the pattern
rules, add in any global .EXTRA_PREREQS to the dep list.  Ensure we
take them into account for the max number of prereqs and name length.
* src/main.c (main): Add extra-prereqs to .FEATURES.
Call the renamed snap_implicit_rules.
* tests/scripts/variables/EXTRA_PREREQS: Add tests.
2020-01-03 02:08:59 -05:00
Paul Smith
e56243fe57 * tests/scripts/features/patternrules: Use Windows-compatible quoting 2020-01-03 02:08:59 -05:00
Paul Smith
7449abfe1b * tests/test_driver.pl: Compute full path to Perl interpreter 2020-01-03 02:08:59 -05:00
Paul Smith
53b9770b40 * tests/scripts/features/exec: Don't use $ENV in the description 2020-01-03 02:08:59 -05:00
Paul Smith
766baeef0a * src/makeint.h: Add a declaration for memrchr() 2020-01-03 02:08:59 -05:00
Paul Smith
ee204c78f2 * NEWS: Remove info about disabled /proc/loadavg usage. 2019-12-27 01:42:25 -05:00
Paul Smith
e64674b718 [SV 57022] Avoid posix_spawn which fails asynchronously
Avoid using posix_spawn implementations that fail asynchronously when
the spawned program can't be invoked: this means instead of getting
an error such as "No such file or directory" we get just "Exit 127".

Original implementation of the configure.ac macro provided by
Martin Dorey <martin.dorey@hds.com>

Original implementation of the regression tests provided by
Dmitry Goncharov <dgoncharov@users.sf.net>

* configure.ac: Test whether posix_spawn fails asynchronously.  In a
cross-compilation environment, assume that it does not.  If we detect
that it does, fall back to fork/exec.
* tests/scripts/features/exec: Add regression tests for different
shebang invocation methods.
2019-12-27 01:37:17 -05:00
Paul Smith
564fb212a7 [SV 56655] Allow pattern expansion to contain spaces
* src/dep.h: Add a new flag PARSEFS_ONEWORD
* src/read.c (parse_file_seq): If PARSEFS_ONEWORD is given, treat the
entire incoming string as a single pattern.
* src/implicit.c (pattern_search): Pass PARSEFS_ONEWORD when parsing
patterns for wildcards.
* tests/scripts/features/patternrules: Add a new test.
2019-12-26 18:39:56 -05:00
Ben Wijen
30cc10093b * src/misc.c (spin): On WINDOWS32 use Sleep() instead of sleep() 2019-12-18 09:05:40 -05:00
Ben Wijen
69c5a2128b * bootstrap.bat: Fix typo in batch file name 2019-12-18 09:05:40 -05:00
Paul Smith
577dd1ff6d * src/config.h.W32.template: [SV 57152] MinGW32 doesn't support d_type 2019-12-18 09:05:40 -05:00
Jouke Witteveen
86f2f8bcb5 [SV 54161] Fix second expansion of $* for paths
If the stem matches a path containing a directory not just a
filename, make sure the second expansion of $* in the
prerequisites matches $* in the recipe.  This requires using
$(*F) when replacing % in the first expansion to preserve the
simple filename.

* src/implicit.c (pattern_search): If lastslash is set prepend
the directory onto the stem.  Then use $(*F) when expanding %.
* tests/scripts/features/se_implicit: Add a test case
2019-12-18 09:05:17 -05:00
Jouke Witteveen
c72205b28b * src/implicit.c (pattern_search): Set lastslash correctly
If filename contained multiple slashes lastslash is wrongly set to 0.
* configure.ac: Check for the GNU memrchr() extension function.
* src/misc.c (memrchr): Supply memrchr() if not available.
2019-12-17 15:06:28 -05:00
Jouke Witteveen
057e33d6b5 * src/implicit.c (pattern-search): Remove unneeded 'dir' variable 2019-12-17 15:06:28 -05:00
Paul Smith
e4499a1fb5 * Makefile.am: Build lzip package instead of bzip2
* README.git: Mention changed requirements.
2019-12-17 15:06:28 -05:00
Paul Smith
57b043c7fb * src/job.c (load_too_high): Disable Linux /proc/loadavg for now
This new feature has a problem: if you provide a load which is
larger than the number of cores then it will always run every job.
Before we can enable it we need to at the least learn how to clamp
this value to the number of cores.  To experiment with it, set
PROC_FD_INIT to -2 in job.c to re-enable the feature.
2019-12-17 15:06:28 -05:00
Paul Smith
f389aabde6 * tests/run_make_tests.pl (set_more_defaults): Fix typo 2019-12-17 15:06:28 -05:00
Paul Smith
acbef3f612 * tests/run_make_tests.pl (subst_make_string): Force use of /
On Windows the path to the helper tool will contain '\': this will
fail if recipes are run with a POSIX shell.  Convert '\' to '/'
on Windows.  While here, escape any spaces in the path as well.
2019-12-16 16:18:58 -05:00
Paul Smith
3822f77c1d Rename jhelp.pl to thelp.pl and make it a generic test helper.
* tests/thelp.pl: Rename from tests/jhelp.pl.
(op): Use names instead of options for the operations.
(op): Add new operations for sleep, mkdir, and rm.
(op): Enhance wait to time out
* tests/run_make_tests.pl: Add a new #HELPER# replacement
(subst_make_string): Use fully-qualified path to thelp.pl
* tests/scripts/features/parallelism: Update to use thelp.pl
and the new named operations.  Use thelp.pl sleep instead of
system-specific sleep commands.
* tests/scripts/features/output-sync: Update to use thelp.pl
instead of complex shell scripts.
* Makefile.am: Distribute tests/thelp.pl instead of tests/jhelp.pl
2019-12-16 09:31:31 -05:00
Paul Eggert
1cf3932a39 Port functions/shell test to Solaris 10
* tests/scripts/functions/shell: Port exit-status calculation
to Solaris 10 with Perl 5.8.4.
2019-10-10 18:31:50 -04:00
Paul Smith
33bda40086 Release GNU make 4.2.92
* NEWS: Update the release and date
* configure.ac: Update the release number
2019-10-08 08:35:39 -04:00
Paul Smith
e666a6a021 * doc/make.text (Reading Makefiles): Rewrite to be more clear. 2019-10-06 15:48:53 -04:00
Paul Smith
5920d6d2b3 * Makefile.am (check-regression): Use PERLFLAGS when running Perl
* maintMakefile: Set PERLFLAGS to enable warnings.
* tests/run_make_tests.pl: Clean up issues pointed out by perl -w.
2019-10-05 17:48:19 -04:00
Paul Smith
2e6468c811 * tests/scripts/functions/wildcard: Skip slash tests for local glob. 2019-10-05 17:48:19 -04:00
Paul Smith
393d2a2d4a tests: Convert %CONFIG_FLAGS to get_config()
* tests/config-flags.pm.W32: Create a predefined Windows file.
* Makefile.am (test_FILES): Add it to the distribution.
* build_w32.bat: Install tests/config-flags.pm if not existing.
* tests/run_make_tests.pl (get_config): Create new function.
* tests/scripts/features/archives: Call get_config() rather than
using %CONFIG_FLAGS directly.
* tests/scripts/features/load: Ditto.
* tests/scripts/features/loadapi: Ditto.
* tests/scripts/functions/wildcard: Ditto.
2019-10-05 17:47:52 -04:00
Paul Smith
bd7d03f8cd * src/hash.c (jhash_string): Don't read past end of string.
Original patch from Dmitry Goncharov <dgoncharov@users.sf.net>.
2019-10-05 11:23:31 -04:00
Paul Smith
a4a173928f * tests/run_make_tests.pl (valid_option): Add missing File::Spec 2019-10-05 07:43:52 -04:00
Paul Smith
0e113897f7 * src/function.c (func_realpath) [AIX]: Remove trailing slashes. 2019-09-23 00:34:12 -04:00
Paul Smith
b0eab8ecb9 * tests/scripts/features/vpathplus: Fix output for big-endian systems.
Our hashing algorithm gives different ordering on LE vs BE systems.
Patch from Dmitry Goncharov <dgoncharov@users.sf.net>.
2019-09-22 17:35:51 -04:00
Florian Weimer
f84821b249 * configure.ac (HAVE_GETTIMEOFDAY): Avoid undeclared exit function.
Copyright-paperwork-exempt: yes
2019-09-22 17:32:29 -04:00
Paul Smith
99d1423059 * test/test_driver.el (_run_with_timeout): Show error message. 2019-09-22 17:03:05 -04:00
Paul Smith
7fbd58cd6b * job.c (child_error): Modify error message string.
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.
2019-09-22 17:02:57 -04:00
Paul Smith
3ede0b96ac * tests: Convert from File::Spec::Functions to File::Spec.
Users report the Functions version doesn't work correctly for some
older versions of Perl.
2019-09-21 16:37:56 -04:00
Paul Smith
1d289b424a * tests/scripts/function/guile: Valgrind doesn't work with Guile. 2019-09-21 15:38:52 -04:00
Paul Smith
96285f875b * src/job.c (child_execute_job): Allocate space for argv NULL. 2019-09-21 15:38:52 -04:00
Paul Smith
bd4ce86785 [SV 56918] Compute job slots properly on failing command
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.
2019-09-21 15:38:48 -04:00
Paul Smith
e1c072aa7e * src/arscan.c (ar_scan): Restrict length for sscanf of ar_mode. 2019-09-21 15:13:32 -04:00
Paul Smith
af0074547d * tests/scripts/functions/shell: Detect correct SHELLSTATUS code. 2019-09-21 15:13:32 -04:00
Paul Smith
4a7a8278e8 * tests/run_make_test.pl: Fix support for valgrind.
Change the variable holding the make command to be a list that can
hold extra commands and options, not just a string.
2019-09-21 15:13:24 -04:00
Paul Smith
00fa3ca3a5 * tests/run_make_tests.pl (find_prog): Fix syntax error. 2019-09-21 12:39:07 -04:00
Paul Smith
00e590fdef * NEWS: Update date and clarify -l change. 2019-09-16 08:25:34 -04:00
Paul Smith
4c64a5f986 * tests/run_make_tests.pl: Create $scriptsuffix for Windows/VMS.
* tests/scripts/features/targetvars: Add a suffix to scripts.
* tests/scripts/misc/general4: Ditto.
2019-09-16 08:25:33 -04:00
Paul Smith
414af96a50 Refresh the test suite framework implementation.
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 "\".
2019-09-16 08:25:33 -04:00
Paul Smith
1b976397e5 * tests/config-flags.pm.in: Add USE_SYSTEM_GLOB.
* tests/config_flags_pm.com [VMS]: Ditto.
2019-09-16 08:25:33 -04:00
Paul Smith
9bc5491712 * README.git: [SV 56895] Provide more info about "maintainer mode".
* src/read.c (get_next_mword) [HAVE_DOS_PATHS]: Don't fall through to
parsing variable references if we find a drivespec in a word!
2019-09-16 08:25:33 -04:00
Paul Smith
57b13c8020 * tests/test_driver.pl: Remember error for "running" a directory.
* tests/scripts/features/errors: Check errors "running" a directory.
2019-09-16 08:25:33 -04:00
Paul Smith
02a4c2913a * src/job.c (child_execute_job): Use errno from find_in_given_path().
* tests/test_driver.pl: Determine non-executable error message.
* tests/scripts/features/errors: Use the local non-executable error.
2019-09-16 08:25:33 -04:00
Paul Smith
8acb89c8c4 * src/job.c (child_execute_job): Use newer gnulib findprog version. 2019-09-16 08:25:33 -04:00
Eli Zaretskii
271e572ba2 Revert "[SV 56449] (Windows) Use slow path if '%' appears in the command"
This reverts commit 38e96eadea.
Per discussion on Savannah, the modified behavior matches
the way % is handled in batch files, but not in cmd command
lines.  And since Make mostly tries to emulate the command
line, the new behavior is unexpected and backward-incompatible.
2019-09-10 19:09:39 +03:00
Paul Smith
bde990bfea Rework the creation of build.sh so it's not a template.
* build.sh: Rename from build.template.  Get the list of objects
from the Makefile.  Move configure-replaced variables ...
* build.cfg.in: to this new .in file.
* configure.ac: Remove special handling of build.sh.in and add
build.cfg as a generated file.
* Makefile.am (EXTRA_DIST): Remove build.sh.in and add build.sh
and build.cfg.in for build.sh.in.
* maintMakefile: Remove handling for build.template.  Treat
build.sh as a source file, not a generated file.
* .gitignore: Ignore generated build.cfg file.
2019-09-09 18:38:31 -04:00
Paul Smith
60e54608bd * gl/modules/make-glob: Move local glob configure.ac to here
* configure.ac: from here.
2019-09-08 15:17:06 -04:00
Paul Smith
60905a8afb [SV 56834] Support local PATH search with posix_spawnp
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.
2019-09-08 15:12:40 -04:00
Paul Smith
ebe1d37104 * doc/make.texi (Recipe Execution): Correct example to use $(<[DF]) 2019-09-07 20:12:44 -04:00
Paul Smith
c0cb9c8b3d * configure.ac: Check whether struct dirent has a d_type field
* src/dir.c (dir_contents_file_exists_p): Use the autoconf macro
HAVE_STRUCT_DIRENT_D_TYPE rather than relying on the GNU libc-
specific _DIRENT_HAVE_D_TYPE.
* lib/glob.c: Set HAVE_D_TYPE if HAVE_STRUCT_DIRENT_D_TYPE.
2019-09-07 20:12:44 -04:00
Paul Smith
34ee9adaed * src/config.h.W32.template [W32]: Add support for dirent.d_type
* src/w32/include/dirent.h: Add DT_* values for dirent.d_type
(struct dirent): Add d_type
* src/w32/compat/durent.c (readdir): Set dirent.d_type based on
Windows file attributes.
2019-09-07 20:12:44 -04:00
Paul Smith
64f5375fe0 * src/makeint.h: Add typedef for mode_t if !HAVE_UMASK 2019-09-07 20:12:44 -04:00
Paul Smith
da81e0815f * build.template: Rewrite to allow gnulib support. 2019-09-07 20:12:44 -04:00
Paul Smith
9be3c0e2b2 * doc/make.texi: Clarify that the jobserver pipe is "blocking" 2019-09-07 18:27:26 -04:00
Paul Smith
9da708772c Align child_execute_job among different ports
Create a struct childbase which is the basics of struct child needed
to invoke child_execute_job(), and can be cast back and forth to a
struct child.  Ensure all implementations of child_execute_job() take
the same arguments.

* src/job.h (CHILDBASE): Create a macro to hold the base parts.
(struct childbase): A structure containing CHILDBASE.
(struct child): Use CHILDBASE as the initial part of child.
[VMS]: Remove declaration of VMS version of child_execute_job.
* src/job.c (start_job_command): Use new child_execute_job() call.
(child_execute_job) [__EMX__]: Implement new calling signature.
(child_execute_job): Implement new calling signature.
* src/main.c (main) [__EMX__]: Use new child_execute_job() call.
* src/function.c (func_shell_base): Use new child_execute_job() call.
* src/vmsjobs.c (vmsHandleChildTerm): Accept struct childbase.
* src/vmsjobs.c (child_execute_job): Implement new calling signature.
Modify the return value to be pid_t, not a boolean, and return the
PID rather than setting it in the child.  This is OK because our only
caller immediately reset PID to -1 anyway if we return 0.
2019-09-07 18:27:26 -04:00
Paul Smith
0967624050 * doc/make.tex (Substitution Refs): Clarify patsubst relationship. 2019-09-07 18:27:26 -04:00
Paul Smith
ba950a796a * src/job.c (start_job_command) [VMS]: Correct VMS comment. 2019-09-07 18:27:26 -04:00
Paul Smith
005a251689 Show useful errors when posix_spawn() doesn't do so
The posix_spawn() function may not detect that the command to run is
invalid when it's invoked.  Instead, it will run then exit with
error code 127.  If that happens do our best to present the user
with a useful error message.

* src/job.h (struct child): Add cmd_name to hold the command we ran.
* src/job.c (start_job_command): On success, remember the cmd_name.
(reap_children): On exit 127, stat cmd_name and show a useful error.
(free_child): Free cmd_name.
2019-09-07 18:27:26 -04:00
Paul Smith
76b6e668a6 * 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.
2019-09-07 18:27:26 -04:00
Paul Smith
5ff6ae6177 * tests/scripts/features/archives: Fix expected long ar name output. 2019-09-07 18:27:26 -04:00
Paul Smith
7c202b50fa * tetss/run_make_test.pl: Avoid 'sh -c' for Windows portability. 2019-09-07 18:27:26 -04:00
Paul Smith
f0182df865 Update to GNU make release candidate 4.2.91 2019-09-07 18:27:26 -04:00
Paul Smith
0a6c38eff8 * 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.
2019-09-07 18:27:26 -04:00
Paul Smith
4b45e2828d * 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.
2019-09-07 18:27:26 -04:00
Paul Smith
4f3a41c60a 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.
2019-09-07 18:27:26 -04:00
Paul Smith
757a9d06e3 * configure.ac: Remove redundant getloadavg gnulib support 2019-09-07 18:27:26 -04:00
Paul Smith
31394f7f53 * 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>
2019-09-07 18:27:26 -04:00
Paul Eggert
b6884c73b7 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’.
2019-09-02 11:11:26 -04:00
Paul Eggert
8bffc8d53c 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.
2019-09-02 11:11:26 -04:00
Paul Eggert
a9609084f4 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’.
2019-09-02 11:11:26 -04:00
Paul Eggert
8d820d57f6 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’.
2019-09-02 11:11:26 -04:00
Paul Eggert
73e11a5024 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’.
2019-09-02 11:11:26 -04:00
Paul Smith
85cdc9e9ae * NEWS: Fix incorrect notes. 2019-09-02 11:11:26 -04:00
Paul Smith
7e60ffe83e * src/read.c (parse_file_seq): [SV 52076] Don't reverse glob() results. 2019-09-02 11:11:26 -04:00
Eli Zaretskii
715c787dc6 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.
2019-08-28 17:45:49 +03:00
156 changed files with 2989 additions and 1955 deletions

4
.gitignore vendored
View File

@@ -30,6 +30,7 @@ configure
/mk/Posix.mk
stamp-h1
.dirstamp
gnulib
# Build artifacts
.deps/
@@ -60,8 +61,7 @@ README
README.DOS
README.OS2
README.W32
build.sh
build.sh.in
build.cfg
config.ami
config.h-vms
config.h.W32

View File

@@ -68,12 +68,13 @@ Other contributors:
David Boyce <dsb@boyski.com>
Frank Heckenbach <f.heckenbach@fh-soft.de>
Kaz Kylheku <kaz@kylheku.com>
Christof Warlich <cwarlich@gmx.de>
With suggestions/comments/bug reports from a cast of ... well ...
hundreds, anyway :)
-------------------------------------------------------------------------------
Copyright (C) 1997-2019 Free Software Foundation, Inc.
Copyright (C) 1997-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -10,7 +10,7 @@
#
# make.exe -f Basic.mk
#
# Copyright (C) 2017-2019 Free Software Foundation, Inc.
# Copyright (C) 2017-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -1,6 +1,6 @@
# This is a -*-Makefile-*-, or close enough
#
# Copyright (C) 1997-2019 Free Software Foundation, Inc.
# Copyright (C) 1997-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = dist-bzip2 silent-rules std-options subdir-objects nostdinc
AUTOMAKE_OPTIONS = dist-lzip silent-rules std-options subdir-objects nostdinc
ACLOCAL_AMFLAGS = -I m4
MAKE_HOST = @MAKE_HOST@
@@ -94,10 +94,11 @@ m4_FILES = m4/gnulib-cache.m4
test_FILES = tests/run_make_tests tests/run_make_tests.bat \
tests/run_make_tests.pl tests/test_driver.pl \
tests/config-flags.pm.in tests/config_flags_pm.com \
tests/mkshadow tests/jhelp.pl tests/guile.supp tests/README
tests/config-flags.pm.W32 \
tests/mkshadow tests/thelp.pl tests/guile.supp tests/README
# test/scripts are added via dist-hook below.
EXTRA_DIST = ChangeLog README build.sh.in $(man_MANS) \
EXTRA_DIST = ChangeLog README build.sh build.cfg.in $(man_MANS) \
README.customs README.OS2 \
README.Amiga SCOPTIONS src/config.ami \
README.DOS builddos.bat src/configh.dos \
@@ -107,11 +108,6 @@ EXTRA_DIST = ChangeLog README build.sh.in $(man_MANS) \
src/gmk-default.scm src/gmk-default.h \
$(mk_FILES) $(m4_FILES) $(test_FILES)
# This is built during configure, but behind configure's back
DISTCLEANFILES = build.sh
# --------------- Generate the Guile default module content
src/guile.$(OBJEXT): src/gmk-default.h
@@ -165,8 +161,8 @@ check-regression: tests/config-flags.pm
rm -f tests/$$f; ln -s ../srctests/$$f tests; \
done; fi ;; \
esac; \
echo "cd tests && $(PERL) ./run_make_tests.pl -srcdir $(abs_top_srcdir) -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
cd tests && $(PERL) ./run_make_tests.pl -srcdir '$(abs_top_srcdir)' -make '../make$(EXEEXT)' $(MAKETESTFLAGS); \
echo "cd tests && $(PERL) $(PERLFLAGS) ./run_make_tests.pl -srcdir $(abs_top_srcdir) -make ../make$(EXEEXT) $(MAKETESTFLAGS)"; \
cd tests && $(PERL) $(PERLFLAGS) ./run_make_tests.pl -srcdir '$(abs_top_srcdir)' -make '../make$(EXEEXT)' $(MAKETESTFLAGS); \
else \
echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
fi; \

65
NEWS
View File

@@ -1,6 +1,6 @@
GNU make NEWS -*-indented-text-*-
History of user-visible changes.
26 August 2019
19 January 2020
See the end of this file for copyrights and conditions.
@@ -9,11 +9,11 @@ which is contained in this distribution as the file doc/make.texi.
See the README file and the GNU make manual for instructions for
reporting bugs.
Version 4.2.90 (26 Aug 2019)
Version 4.3 (19 Jan 2020)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set=custom
* WARNING: Backward-incompatibility!
Number signs (#) appearing inside a macro reference or function invocation
@@ -35,18 +35,18 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set
already contains some value. Similarly, appending an empty string does not
add a trailing space.
* WARNING: Backward-incompatibility!
On Linux, and any other systems that provide a /proc/loadavg with similar
syntax, the -l/--load-average option will use the contents of that file to
determine how many jobs are running at any given instant, and compare that
value to the load value requested. This allows usage such as "-j -lN" for
N-processor systems without fear of overload.
Patch provided by Sven C. Dack <sven.c.dack@sky.com>
* WARNING: Backward-incompatibility!
Contrary to the documentation, suffix rules with prerequisites were being
treated BOTH as simple targets AND as pattern rules. Behavior now matches
the documentation, and pattern rules are no longer created in this case.
* NOTE: Deprecated behavior.
Contrary to the documentation, suffix rules with prerequisites are being
treated BOTH as simple targets AND as pattern rules. Further, the
prerequisites are ignored by the pattern rules. POSIX specifies that in
order to be a suffix rule there can be no prerequisites defined. In this
release if POSIX mode is enabled then rules with prerequisites cannot be
suffix rules. If POSIX mode is not enabled then the previous behavior is
preserved (a pattern rule with no extra prerequisites is created) AND a
warning about this behavior is generated:
warning: ignoring prerequisites on suffix rule definition
The POSIX behavior will be adopted as the only behavior in a future release
of GNU make so please resolve any warnings.
* New feature: Grouped explicit targets
Pattern rules have always had the ability to generate multiple targets with
@@ -56,14 +56,21 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set
search for 'grouped-target' in the .FEATURES special variable.
Implementation contributed by Kaz Kylheku <kaz@kylheku.com>
* New feature: .EXTRA_PREREQS variable
Words in this variable are considered prerequisites of targets but they are
not added to any of the automatic variable values when expanding the
recipe. This variable can either be global (applies to all targets) or
a target-specific variable. To detect this feature search for 'extra-prereqs'
in the .FEATURES special variable.
Implementation contributed by Christof Warlich <cwarlich@gmx.de>
* Makefiles can now specify the '-j' option in their MAKEFLAGS variable and
this will cause make to enable that parallelism mode.
* GNU make will now use pthread_spawn() on systems where it is available.
It will select POSIX_SPAWN_USEVFORK where that is available. If you prefer
to use fork/exec even on systems where pthread_spawn() is present, you can
use the --disable-pthread-spawn option to configure.
Aron Barath <baratharon@caesar.elte.hu> provided the basic implementation.
* GNU make will now use posix_spawn() on systems where it is available.
If you prefer to use fork/exec even on systems where posix_spawn() is
present, you can use the --disable-posix-spawn option to configure.
Implementation contributed by Aron Barath <baratharon@caesar.elte.hu>
* Error messages printed when invoking non-existent commands have been cleaned
up and made consistent.
@@ -101,7 +108,7 @@ Version 4.2.1 (10 Jun 2016)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=107&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=107&set=custom
This release is a bug-fix release.
@@ -110,7 +117,7 @@ Version 4.2 (22 May 2016)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=106&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=106&set=custom
* New variable: $(.SHELLSTATUS) is set to the exit status of the last != or
$(shell ...) function invoked in this instance of make. This will be "0" if
@@ -149,7 +156,7 @@ Version 4.1 (05 Oct 2014)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=105&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=105&set=custom
* New variables: $(MAKE_TERMOUT) and $(MAKE_TERMERR) are set to non-empty
values if stdout or stderr, respectively, are believed to be writing to a
@@ -197,7 +204,7 @@ Version 4.0 (09 Oct 2013)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set=custom
* WARNING: Backward-incompatibility!
If .POSIX is specified, then make adheres to the POSIX backslash/newline
@@ -301,7 +308,7 @@ Version 3.82 (28 Jul 2010)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&set=custom
* Compiling GNU make now requires a conforming ISO C 1989 compiler and
standard runtime library.
@@ -466,7 +473,7 @@ Version 3.81 (01 Apr 2006)
might have caused the target to rebuild. Starting with the _next_
release of GNU make, '$?' will contain all prerequisites that caused
the target to be considered out of date.
See http://savannah.gnu.org/bugs/?16051
See https://savannah.gnu.org/bugs/?16051
* WARNING: Backward-incompatibility!
GNU make now implements a generic "second expansion" feature on the
@@ -590,7 +597,7 @@ Version 3.81 (01 Apr 2006)
A complete list of bugs fixed in this version is available here:
http://savannah.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=103
https://savannah.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=103
Version 3.80 (03 Oct 2002)
@@ -708,7 +715,7 @@ Version 3.80 (03 Oct 2002)
A complete list of bugs fixed in this version is available here:
http://savannah.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=102
https://savannah.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=102
Version 3.79.1 (23 Jun 2000)
@@ -1612,7 +1619,7 @@ Version 3.05
(Changes from versions 1 through 3.05 were never recorded. Sorry.)
-------------------------------------------------------------------------------
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -64,7 +64,7 @@ If you plan to use recursive makes, install make resident:
-------------------------------------------------------------------------------
Copyright (C) 1995-2019 Free Software Foundation, Inc.
Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -280,7 +280,7 @@ Bug reports:
-------------------------------------------------------------------------------
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -160,7 +160,7 @@ from the make source tree.
-------------------------------------------------------------------------------
Copyright (C) 2003-2019 Free Software Foundation, Inc.
Copyright (C) 2003-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -345,7 +345,7 @@ Bug reports:
is described in the GNU make manual and the base README.
-------------------------------------------------------------------------------
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -96,7 +96,7 @@ SunOS 4.1.x:
-------------------------------------------------------------------------------
Copyright (C) 1998-2019 Free Software Foundation, Inc.
Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,7 +1,7 @@
-*-text-*-
-------------------------------------------------------------------------------
Copyright (C) 2002-2019 Free Software Foundation, Inc.
Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -85,18 +85,27 @@ need to install the following extra software:
* autopoint
* pkg-config
* texinfo (for makeinfo)
* GCC (Clang's GCC emulation is not sufficient)
* GNU make (POSIX make is not sufficient)
And any tools that those utilities require (GNU m4, Perl, etc.)
And any tools that those utilities require (GNU m4, etc.)
To run the tests you must install Perl.
To build a release you'll need to install lzip.
GNU make requires gnulib to provide some facilities. If you want to maintain
a local installation of gnulib you can set GNULIB_SRCDIR to point to it.
Otherwise, ./bootstrap will obtain a clone for you.
Unfortunately due to issues with gnulib's getloadavg, you must have automake
1.16.1 or above. This version is not yet widely available in GNU/Linux
1.16.1 or above. This version may not yet be available through GNU/Linux
package managers. If you need to install from source be sure to set
ACLOCAL_PATH to point to the pkg-config location (e.g., /usr/share/aclocal).
If you want to build from Git with a non-GCC compiler, add "MAKE_CFLAGS=" to
your make command line (or at least remove any flags your compiler does not
support).
When building from Git you must build in the source directory: "VPATH
builds" from remote directories are not supported. Once you've created
@@ -114,9 +123,24 @@ That is, you can just run:
$ ./configure
$ make check
$ make install
to build and install GNU make.
to build and test GNU make.
NOTE! This method builds GNU make in "maintainer mode". Make programs built
in this mode it will be slower, possibly MUCH slower: there are various
sanity checks enabled. Further this mode assumes a modern GCC, GNU
libc, and well-formed system headers and enables a high level of
warnings AND enables -Werror to turn warnings into failures.
If you want to build from Git with "maintainer mode" disabled, add
"MAKE_MAINTAINER_MODE=" to the make command line. If you want to turn
off the extra warning flags, add "MAKE_CFLAGS=" to the make command
line.
For example:
$ ./configure
$ make check MAKE_MAINTAINER_MODE= MAKE_CFLAGS=
$ make install
Building From Git for Windows
@@ -146,18 +170,19 @@ run:
and, if you like:
$ make dist-bzip2
$ make dist-lzip
Even better, you should run this:
$ make distcheck
Which will build both .gz and .bz2 package files, then unpack them into
a temporary location, try to build them, and repack them, verifying that
everything works, you get the same results, _and_ no extraneous files
are left over after the "distclean" rule--whew!! Now, _that_ is why
converting to Automake is worth the trouble! A big "huzzah!" to Tom
T. and the AutoToolers!
Which will build both .gz and .lz package files, then unpack one into a
temporary location, try to build it and repack it, then verifying that
everything works, you get the same results, _and_ no extraneous files are
left over after the "distclean" rule.
This package can be unpacked and built to give a "normal" (non-maintainer
mode) result.
Steps to Release

View File

@@ -172,7 +172,7 @@ at the right README!
-------------------------------------------------------------------------------
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -101,7 +101,7 @@ The Rest of the List
-------------------------------------------------------------------------------
Copyright (C) 1997-2019 Free Software Foundation, Inc.
Copyright (C) 1997-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -4,7 +4,7 @@ scriptversion=2019-01-04.17; # UTC
# Bootstrap this package from checked-out sources.
# Copyright (C) 2003-2019 Free Software Foundation, Inc.
# Copyright (C) 2003-2020 Free Software Foundation, Inc.
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -162,18 +162,11 @@ bootstrap_post_import_hook() { :; }
# Override it via your own definition in bootstrap.conf.
bootstrap_epilogue() { :; }
# The command to download all .po files for a specified domain into
# a specified directory. Fill in the first %s is the domain name, and
# the second with the destination directory. Use rsync's -L and -r
# options because the latest/%s directory and the .po files within are
# all symlinks.
# The command to download all .po files for a specified domain into a
# specified directory. Fill in the first %s with the destination
# directory and the second with the domain name.
po_download_command_format=\
"rsync --delete --exclude '*.s1' -Lrtvz \
'translationproject.org::tp/latest/%s/' '%s'"
# Fallback for downloading .po files (if rsync fails).
po_download_command_format2=\
"wget --mirror -nd -q -np -A.po -P '%s' \
"wget --mirror --level=1 -nd -nv -A.po -P '%s' \
https://translationproject.org/latest/%s/"
# Prefer a non-empty tarname (4th argument of AC_INIT if given), else
@@ -741,10 +734,7 @@ download_po_files() {
subdir=$1
domain=$2
echo "$me: getting translations into $subdir for $domain..."
cmd=$(printf "$po_download_command_format" "$domain" "$subdir")
eval "$cmd" && return
# Fallback to HTTPS.
cmd=$(printf "$po_download_command_format2" "$subdir" "$domain")
cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
eval "$cmd"
}

View File

@@ -1,5 +1,5 @@
@echo off
:: Copyright (C) 2018-2019 Free Software Foundation, Inc.
:: Copyright (C) 2018-2020 Free Software Foundation, Inc.
:: This file is part of GNU Make.
::
:: GNU Make is free software; you can redistribute it and/or modify it under
@@ -30,5 +30,5 @@ if ERRORLEVEL 1 exit /b 1
goto :EOF
:Done
echo Done. Run buld_w32.bat to build GNU make.
echo Done. Run build_w32.bat to build GNU make.
goto :EOF

View File

@@ -1,6 +1,6 @@
# Bootstrap configuration. -*-shell-script-*-
# Copyright (C) 2018-2019 Free Software Foundation, Inc.
# Copyright (C) 2018-2020 Free Software Foundation, Inc.
# GNU Make is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
@@ -46,6 +46,7 @@ gnulib_files=doc/make-stds.texi
gnulib_modules="\
alloca
fdl
findprog-in
getloadavg
host-cpu-c-abi
strerror

38
build.cfg.in Normal file
View File

@@ -0,0 +1,38 @@
# Configuration for building GNU Make in the absence of any 'make' program.
# @configure_input@
# Copyright (C) 1993-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
# See Makefile.in for comments describing these variables.
top_srcdir='@top_srcdir@'
prefix='@prefix@'
exec_prefix=`eval echo @exec_prefix@`
CC='@CC@'
AR='@AR@'
CFLAGS='@CFLAGS@ @GUILE_CFLAGS@'
CPPFLAGS='@CPPFLAGS@'
DEFS='@DEFS@'
ARFLAGS='@ARFLAGS@'
LDFLAGS='@AM_LDFLAGS@ @LDFLAGS@'
ALLOCA='@ALLOCA@'
LOADLIBES='@LIBS@ @GUILE_LIBS@ @LIBINTL@'
REMOTE='@REMOTE@'
OBJEXT='@OBJEXT@'
EXEEXT='@EXEEXT@'

149
build.sh Executable file
View File

@@ -0,0 +1,149 @@
#!/bin/sh
# Shell script to build GNU Make in the absence of any 'make' program.
# Copyright (C) 1993-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
# Get configure-generated values
. ./build.cfg
: ${OUTDIR:=.}
OUTLIB="$OUTDIR/lib"
# Directory to find libraries in for '-lXXX'.
libdir=$exec_prefix/lib
# Directory to search by default for included makefiles.
includedir=$prefix/include
localedir=$prefix/share/locale
defines="-DLOCALEDIR=\"$localedir\" -DLIBDIR=\"$libdir\" -DINCLUDEDIR=\"$includedir\""
# Look up a make variable value.
# It can handle simple recursion where variables are separate words.
# Print the value to stdout.
get_mk_var ()
{
file=$1
var=$2
val=
v=$(sed -e :a -e '/\\$/N; s/\\\n//; ta' "$file" | sed -n "s=^ *$var *\= *==p")
for w in $v; do
case $w in
(\$[\(\{]*[\)\}]) w=${w#\$[\(\{]}; w=$(get_mk_var "$file" "${w%[\)\}]}") ;;
esac
val="${val:+$val }$w"
done
printf '%s\n' "$val"
}
# Compile source files. Object files are put into $objs.
compile ()
{
objs=
for ofile in "$@"; do
file="${ofile%.$OBJEXT}.c"
echo "compiling $file..."
of="$OUTDIR/$ofile"
mkdir -p "${of%/*}"
$CC $cflags $CPPFLAGS $CFLAGS -c -o "$of" "$top_srcdir/$file"
objs="${objs:+$objs }$of"
done
}
# Use config.status to convert a .in file. Output file is put into $out.
# $out will be empty if no conversion was needed.
convert ()
{
out=
base=$1
var="GENERATE_$(echo $base | tr 'a-z./+' A-Z__X)"
# Is this file disabled?
grep "${var}_FALSE\"]=\"\"" config.status >/dev/null && return
# Not disabled, so create it
in="$top_srcdir/lib/$(echo ${base%.*}.in.${base##*.} | tr / _)"
out="$OUTLIB/$base"
mkdir -p "${out%/*}"
# First perform the normal replacements, using config.status
sed -e 's|@GUARD_PREFIX@|GL|g' \
-e 's/@GNULIB_UNISTD_H_GETOPT@/0/g' \
"$in" > "${out}_"
./config.status --file "${out}__:${out}_"
int="${out}__"
# Then see if there any files we need to include. Unfortunately there's no
# algorithmic conversion so we just have to hard-code it.
incls=$(sed -n 's/.*definitions* of \(_[^ $]*\).*/\1/p' "$in")
for inc in $incls; do
case $inc in
(_GL_FUNCDECL_RPL) fn=$(get_mk_var lib/Makefile CXXDEFS_H) ;;
(_GL_ARG_NONNULL) fn=$(get_mk_var lib/Makefile ARG_NONNULL_H) ;;
(_GL_WARN_ON_USE) fn=$(get_mk_var lib/Makefile WARN_ON_USE_H) ;;
(_Noreturn) fn=$(get_mk_var lib/Makefile _NORETURN_H) ;;
(*) echo "Unknown file replacement: $inc"; exit 1 ;;
esac
fn="$top_srcdir/lib/${fn##*/}"
[ -f "$fn" ] || { echo "Missing file: $fn"; exit 1; }
sed "/definitions* of $inc/r $fn" "$int" > "${int}_"
int=${int}_
done
# Done!
mv "$int" "$out"
}
# Get source files provided from gnulib and convert to object files
LIBOBJS=
for lo in $( (get_mk_var lib/Makefile libgnu_a_OBJECTS; get_mk_var lib/Makefile libgnu_a_LIBADD) | sed "s=\$[\(\{]OBJEXT[\)\}]=$OBJEXT=g"); do
LIBOBJS="${LIBOBJS:+$LIBOBJS }lib/$lo"
done
# Get object files from the Makefile
OBJS=$(get_mk_var Makefile make_OBJECTS | sed "s=\$[\(\{]OBJEXT[\)\}]=$OBJEXT=g")
# Exit as soon as any command fails.
set -e
# Generate gnulib header files that would normally be created by make
for b in $(get_mk_var lib/Makefile BUILT_SOURCES); do
convert $b
done
# Build the gnulib library
cflags="$DEFS -I$OUTLIB -Ilib -I$top_srcdir/lib -I$OUTDIR/src -Isrc -I$top_srcdir/src"
compile $LIBOBJS
echo "creating libgnu.a..."
$AR $ARFLAGS "$OUTLIB"/libgnu.a $objs
# Compile the source files into those objects.
cflags="$DEFS $defines -I$OUTDIR/src -Isrc -I$top_srcdir/src -I$OUTLIB -Ilib -I$top_srcdir/lib"
compile $OBJS
# Link all the objects together.
echo "linking make..."
$CC $CFLAGS $LDFLAGS -L"$OUTLIB" $objs -lgnu $LOADLIBES -o "$OUTDIR/makenew$EXEEXT"
mv -f "$OUTDIR/makenew$EXEEXT" "$OUTDIR/make$EXEEXT"
echo done.

View File

@@ -1,89 +0,0 @@
#!/bin/sh
# Shell script to build GNU Make in the absence of any 'make' program.
# @configure_input@
# Copyright (C) 1993-2019 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
# See Makefile.in for comments describing these variables.
LIBOBJDIR=lib/
U=
top_srcdir="@top_srcdir@"
CC="@CC@"
CFLAGS="@CFLAGS@ @GUILE_CFLAGS@"
CPPFLAGS="@CPPFLAGS@"
LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@"
ALLOCA="@ALLOCA@"
LOADLIBES="@LIBS@ @GUILE_LIBS@ @LIBINTL@"
LIBOBJS="@LIBOBJS@"
REMOTE="@REMOTE@"
OBJEXT="@OBJEXT@"
EXEEXT="@EXEEXT@"
# Use our old-style glob implementation
test x"@USE_SYSTEM_GLOB@" = xno && LIBOBJS="${LIBOBJS} ${LIBOBJDIR}fnmatch.$OBJEXT ${LIBOBJDIR}glob.$OBJEXT"
# Common prefix for machine-independent installed files.
prefix="@prefix@"
# Common prefix for machine-dependent installed files.
exec_prefix=`eval echo @exec_prefix@`
# Directory to find libraries in for '-lXXX'.
libdir=${exec_prefix}/lib
# Directory to search by default for included makefiles.
includedir=${prefix}/include
localedir=${prefix}/share/locale
defines="-DLOCALEDIR=\"${localedir}\" -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\" @DEFS@"
# Exit as soon as any command fails.
set -e
# These are all the objects we need to link together.
objs="%objs% src/remote-${REMOTE}.${OBJEXT} ${LIBOBJS}"
case $LIBOBJS in
(*alloca*) cp "$top_srcdir"/lib/alloca.in.h lib/alloca.h ;;
esac
case $LIBOBJS in
(*fnmatch*) cp "$top_srcdir"/lib/fnmatch.in.h lib/fnmatch.h ;;
esac
case $LIBOBJS in
(*glob*) cp "$top_srcdir"/lib/glob.in.h lib/glob.h ;;
esac
# Compile the source files into those objects.
for file in `echo ${objs} | sed 's/\.'${OBJEXT}'/.c/g'`; do
echo compiling ${file}...
$CC $defines $CPPFLAGS $CFLAGS \
-c -Isrc -I"$top_srcdir"/src -Ilib -I"$top_srcdir"/lib "$top_srcdir"/$file
done
# The object files were actually all put in the current directory.
# Remove the source directory names from the list.
srcobjs="$objs"
objs=
for obj in $srcobjs; do
objs="$objs `basename $obj`"
done
# Link all the objects together.
echo linking make...
$CC $CFLAGS $LDFLAGS $objs $LOADLIBES -o makenew${EXEEXT}
echo done
mv -f makenew${EXEEXT} make${EXEEXT}

View File

@@ -1,5 +1,5 @@
@echo off
:: Copyright (C) 1996-2019 Free Software Foundation, Inc.
:: Copyright (C) 1996-2020 Free Software Foundation, Inc.
:: This file is part of GNU Make.
::
:: GNU Make is free software; you can redistribute it and/or modify it under
@@ -154,9 +154,11 @@ exit 1
:FoundMSVC
set OUTDIR=.\WinRel
set LNKOUT=./WinRel
set "OPTS=/O2 /D NDEBUG"
set LINKOPTS=
if "%DEBUG%" == "Y" set OUTDIR=.\WinDebug
if "%DEBUG%" == "Y" set LNKOUT=./WinDebug
if "%DEBUG%" == "Y" set "OPTS=/Zi /Od /D _DEBUG"
if "%DEBUG%" == "Y" set LINKOPTS=/DEBUG
if "%MAINT%" == "Y" set "OPTS=%OPTS% /D MAKE_MAINTAINER_MODE"
@@ -168,9 +170,11 @@ goto Build
:FindGcc
set OUTDIR=.\GccRel
set LNKOUT=./GccRel
set OPTS=-O2
if "%DEBUG%" == "Y" set OPTS=-O0
if "%DEBUG%" == "Y" set OUTDIR=.\GccDebug
if "%DEBUG%" == "Y" set LNKOUT=./GccDebug
if "%MAINT%" == "Y" set "OPTS=%OPTS% -DMAKE_MAINTAINER_MODE"
:: Show the compiler version that we found
echo.
@@ -204,43 +208,43 @@ copy lib\fnmatch.in.h %OUTDIR%\lib\fnmatch.h
if exist %OUTDIR%\link.sc del %OUTDIR%\link.sc
call :Compile src\ar
call :Compile src\arscan
call :Compile src\commands
call :Compile src\default
call :Compile src\dir
call :Compile src\expand
call :Compile src\file
call :Compile src\function
call :Compile src\getopt
call :Compile src\getopt1
call :Compile src\guile GUILE
call :Compile src\hash
call :Compile src\implicit
call :Compile src\job
call :Compile src\load
call :Compile src\loadapi
call :Compile src\main GUILE
call :Compile src\misc
call :Compile src\output
call :Compile src\read
call :Compile src\remake
call :Compile src\remote-stub
call :Compile src\rule
call :Compile src\signame
call :Compile src\strcache
call :Compile src\variable
call :Compile src\version
call :Compile src\vpath
call :Compile src\w32\pathstuff
call :Compile src\w32\w32os
call :Compile src\w32\compat\posixfcn
call :Compile src\w32\subproc\misc
call :Compile src\w32\subproc\sub_proc
call :Compile src\w32\subproc\w32err
call :Compile lib\fnmatch
call :Compile lib\glob
call :Compile lib\getloadavg
call :Compile src/ar
call :Compile src/arscan
call :Compile src/commands
call :Compile src/default
call :Compile src/dir
call :Compile src/expand
call :Compile src/file
call :Compile src/function
call :Compile src/getopt
call :Compile src/getopt1
call :Compile src/guile GUILE
call :Compile src/hash
call :Compile src/implicit
call :Compile src/job
call :Compile src/load
call :Compile src/loadapi
call :Compile src/main GUILE
call :Compile src/misc
call :Compile src/output
call :Compile src/read
call :Compile src/remake
call :Compile src/remote-stub
call :Compile src/rule
call :Compile src/signame
call :Compile src/strcache
call :Compile src/variable
call :Compile src/version
call :Compile src/vpath
call :Compile src/w32/pathstuff
call :Compile src/w32/w32os
call :Compile src/w32/compat/posixfcn
call :Compile src/w32/subproc/misc
call :Compile src/w32/subproc/sub_proc
call :Compile src/w32/subproc/w32err
call :Compile lib/fnmatch
call :Compile lib/glob
call :Compile lib/getloadavg
if not "%COMPILER%" == "gcc" call :Compile src\w32\compat\dirent
@@ -254,6 +258,7 @@ exit 1
:Success
echo %OUTDIR% build succeeded.
if exist Basic.mk copy /Y Basic.mk Makefile
if not exist tests\config-flags.pm copy /Y tests\config-flags.pm.W32 tests\config-flags.pm
call :Reset
goto :EOF
@@ -262,7 +267,7 @@ goto :EOF
::
:Compile
echo %OUTDIR%\%1.%O% >>%OUTDIR%\link.sc
echo %LNKOUT%/%1.%O% >>%OUTDIR%\link.sc
set EXTRAS=
if "%2" == "GUILE" set "EXTRAS=%GUILECFLAGS%"
if exist "%OUTDIR%\%1.%O%" del "%OUTDIR%\%1.%O%"
@@ -277,7 +282,7 @@ goto CompileDone
:GccCompile
:: GCC Compile
echo on
%COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%\%1.%O% -c %1.c
%COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
@echo off
:CompileDone
@@ -285,13 +290,14 @@ if not exist "%OUTDIR%\%1.%O%" exit 1
goto :EOF
:Link
echo Linking %OUTDIR%/%MAKE%.exe
echo.
echo Linking %LNKOUT%/%MAKE%.exe
if "%COMPILER%" == "gcc" goto GccLink
:: MSVC Link
echo %GUILELIBS% kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib >>%OUTDIR%\link.sc
echo on
link.exe /NOLOGO /SUBSYSTEM:console /PDB:%OUTDIR%\%MAKE%.pdb %LINKOPTS% /OUT:%OUTDIR%\%MAKE%.exe @%OUTDIR%\link.sc
link.exe /NOLOGO /SUBSYSTEM:console /PDB:%LNKOUT%\%MAKE%.pdb %LINKOPTS% /OUT:%LNKOUT%\%MAKE%.exe @%LNKOUT%\link.sc
@echo off
goto :EOF
@@ -299,7 +305,7 @@ goto :EOF
:: GCC Link
echo on
echo %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 >>%OUTDIR%\link.sc
%COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %OUTDIR%\%MAKE%.exe @%OUTDIR%\link.sc -Wl,--out-implib=%OUTDIR%\libgnumake-1.dll.a
%COMPILER% -mthreads -gdwarf-2 -g3 %OPTS% -o %LNKOUT%/%MAKE%.exe @%LNKOUT%/link.sc -Wl,--out-implib=%LNKOUT%/libgnumake-1.dll.a
@echo off
goto :EOF
@@ -390,6 +396,7 @@ set NOGUILE=
set O=
set OPTS=
set OUTDIR=
set LNKOUT=
set PKGMSC=
set VSVARS=
goto :EOF

View File

@@ -1,5 +1,5 @@
@echo off
rem Copyright (C) 1998-2019 Free Software Foundation, Inc.
rem Copyright (C) 1998-2020 Free Software Foundation, Inc.
rem This file is part of GNU Make.
rem
rem GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
#
# Copyright (C) 1993-2019 Free Software Foundation, Inc.
# Copyright (C) 1993-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
AC_INIT([GNU make],[4.2.90],[bug-make@gnu.org])
AC_INIT([GNU make],[4.3],[bug-make@gnu.org])
AC_PREREQ([2.69])
@@ -127,8 +127,8 @@ AC_CACHE_CHECK([for standard gettimeofday], [ac_cv_func_gettimeofday],
int main ()
{
struct timeval t; t.tv_sec = -1; t.tv_usec = -1;
exit (gettimeofday (&t, 0) != 0
|| t.tv_sec < 0 || t.tv_usec < 0);
return gettimeofday (&t, 0) != 0
|| t.tv_sec < 0 || t.tv_usec < 0;
}]])],
[ac_cv_func_gettimeofday=yes],
[ac_cv_func_gettimeofday=no],
@@ -138,7 +138,7 @@ AS_IF([test "$ac_cv_func_gettimeofday" = yes],
[Define to 1 if you have a standard gettimeofday function])
])
AC_CHECK_FUNCS([strdup strndup umask mkstemp mktemp fdopen \
AC_CHECK_FUNCS([strdup strndup memrchr umask mkstemp mktemp fdopen \
dup dup2 getcwd realpath sigsetmask sigaction \
getgroups seteuid setegid setlinebuf setreuid setregid \
getrlimit setrlimit setvbuf pipe strsignal \
@@ -164,6 +164,9 @@ AC_CHECK_FUNCS([strcasecmp strncasecmp strcmpi strncmpi stricmp strnicmp])
AC_FUNC_STRCOLL
AC_FUNC_CLOSEDIR_VOID
# dir.c and our glob.c use dirent.d_type if available
AC_STRUCT_DIRENT_D_TYPE
# See if the user wants to add (or not) GNU Guile support
AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile],
[Support GNU Guile for embedded scripting])])
@@ -173,7 +176,7 @@ AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile],
PKG_PROG_PKG_CONFIG
AS_IF([test "x$with_guile" != xno],
[ guile_versions="2.2 2.0 1.8"
[ guile_versions="3.0 2.2 2.0 1.8"
guile_version=no
have_guile=no
AC_MSG_CHECKING([for GNU Guile])
@@ -181,13 +184,21 @@ AS_IF([test "x$with_guile" != xno],
PKG_CHECK_EXISTS([guile-$v], [guile_version=$v; have_guile=yes; break], [])
done
AC_MSG_RESULT([$guile_version])
if test "$have_guile" = yes; then
PKG_CHECK_MODULES(GUILE, [guile-$guile_version])
AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])
fi
AS_IF([test "$have_guile" = yes],
[ PKG_CHECK_MODULES(GUILE, [guile-$guile_version])
# Unfortunately Guile requires a C99 compiler but GNU make doesn't, so
# verify we can actually compile the header.
keep_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $pkg_cv_GUILE_CFLAGS"
AC_CHECK_HEADER([libguile.h],
[AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])],
[have_guile=no],
[/* Avoid configuration error warnings. */])
CPPFLAGS="$keep_CPPFLAGS"
])
])
AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = yes])
AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = "yes"])
AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
[AC_INCLUDES_DEFAULT
@@ -368,7 +379,28 @@ AC_ARG_ENABLE([posix-spawn],
AS_CASE([/$ac_cv_header_spawn/$ac_cv_func_posix_spawn/],
[*/no/*], [make_cv_posix_spawn=no])
AS_CASE([/$make_cv_posix_spawn/$user_posix_spawn/],
AS_IF([test "$make_cv_posix_spawn" = yes],
AC_CACHE_CHECK([for posix_spawn that fails synchronously],
[make_cv_synchronous_posix_spawn],
[make_cv_synchronous_posix_spawn=no
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <spawn.h>
#include <string.h>
extern char **environ;
int main() {
char* path = strdup("./non-existent");
char *argv[[2]];
argv[[0]] = path;
argv[[1]] = 0;
return posix_spawn(0, path, 0, 0, argv, environ);
}]])],
[make_cv_synchronous_posix_spawn=no],
[make_cv_synchronous_posix_spawn=yes],
[make_cv_synchronous_posix_spawn="no (cross-compiling)"])]))
AS_CASE([/$user_posix_spawn/$make_cv_posix_spawn/$make_cv_synchronous_posix_spawn/],
[*/no/*], [make_cv_posix_spawn=no],
[AC_DEFINE(USE_POSIX_SPAWN, 1, [Define to 1 to use posix_spawn().])
])
@@ -400,38 +432,6 @@ AS_IF([(/usr/sccs/admin -n s.conftest || admin -n s.conftest) >/dev/null 2>&1 &&
])
rm -f s.conftest conftoast
# Check the system to see if it provides GNU glob. If not, use our
# local version.
AC_CACHE_CHECK([if system libc has GNU glob], [make_cv_sys_gnu_glob],
[ AC_EGREP_CPP([gnu glob],[
#include <features.h>
#include <glob.h>
#include <fnmatch.h>
#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
# include <gnu-versions.h>
# if _GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2
gnu glob
# endif
#endif],
[make_cv_sys_gnu_glob=yes],
[make_cv_sys_gnu_glob=no])])
# Tell automake about this, so it can build the right .c files.
AM_CONDITIONAL([USE_SYSTEM_GLOB], [test "$make_cv_sys_gnu_glob" = yes])
# Tell build.sh which to use
USE_SYSTEM_GLOB="$make_cv_sys_gnu_glob"
AC_SUBST([USE_SYSTEM_GLOB])
# See if we need a replacement for getloadavg()
gl_GETLOADAVG
if test $HAVE_GETLOADAVG = 0; then
AC_LIBOBJ([getloadavg])
gl_PREREQ_GETLOADAVG
fi
gl_STDLIB_MODULE_INDICATOR([getloadavg])
# Let the makefile know what our build host is
AC_DEFINE_UNQUOTED([MAKE_HOST],["$host"],[Build host information.])
@@ -521,7 +521,7 @@ AS_IF([test "x$make_cv_posix_spawn" = xno && test "x$user_posix_spawn" = xyes],
])
# Specify what files are to be created.
AC_CONFIG_FILES([Makefile lib/Makefile po/Makefile.in doc/Makefile \
AC_CONFIG_FILES([Makefile build.cfg lib/Makefile po/Makefile.in doc/Makefile \
tests/config-flags.pm])
# We don't need this: the standard automake output suffices for POSIX systems.
#mk/Posix.mk
@@ -530,13 +530,6 @@ AC_CONFIG_FILES([Makefile lib/Makefile po/Makefile.in doc/Makefile \
AC_OUTPUT
# We only generate the build.sh if we have a build.sh.in; we won't have
# one before we've created a distribution.
AS_IF([test -f "$srcdir/build.sh.in"],
[ ./config.status --file build.sh
chmod +x build.sh
])
dnl Local Variables:
dnl comment-start: "dnl "
dnl comment-end: ""

View File

@@ -1,5 +1,5 @@
# -*-Makefile-*-, or close enough
# Copyright (C) 2000-2019 Free Software Foundation, Inc.
# Copyright (C) 2000-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -361,7 +361,7 @@ This manual page contributed by Dennis Morse of Stanford University.
Further updates contributed by Mike Frysinger. It has been reworked by Roland
McGrath. Maintained by Paul Smith.
.SH "COPYRIGHT"
Copyright \(co 1992-1993, 1996-2019 Free Software Foundation, Inc.
Copyright \(co 1992-1993, 1996-2020 Free Software Foundation, Inc.
This file is part of
.IR "GNU make" .
.LP

View File

@@ -3,7 +3,7 @@
@setfilename make.info
@include version.texi
@set EDITION 0.74
@set EDITION 0.75
@settitle GNU @code{make}
@setchapternewpage odd
@@ -26,8 +26,8 @@ of @cite{The GNU Make Manual}, for GNU @code{make} version @value{VERSION}.
Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019
Free Software Foundation, Inc.
2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019,
2020 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -1469,25 +1469,27 @@ build it---otherwise it would apply the same match-anything rule to
@cindex reading makefiles
@cindex makefile, reading
GNU @code{make} does its work in two distinct phases. During the first
phase it reads all the makefiles, included makefiles, etc. and
internalizes all the variables and their values, implicit and explicit
rules, and constructs a dependency graph of all the targets and their
prerequisites. During the second phase, @code{make} uses these internal
structures to determine what targets will need to be rebuilt and to
invoke the rules necessary to do so.
GNU @code{make} does its work in two distinct phases. During the
first phase it reads all the makefiles, included makefiles, etc. and
internalizes all the variables and their values and implicit and
explicit rules, and builds a dependency graph of all the targets and
their prerequisites. During the second phase, @code{make} uses this
internalized data to determine which targets need to be updated and
run the recipes necessary to update them.
It's important to understand this two-phase approach because it has a
direct impact on how variable and function expansion happens; this is
often a source of some confusion when writing makefiles. Here we will
present a summary of the phases in which expansion happens for different
constructs within the makefile. We say that expansion is
@dfn{immediate} if it happens during the first phase: in this case
@code{make} will expand any variables or functions in that section of a
construct as the makefile is parsed. We say that expansion is
@dfn{deferred} if expansion is not performed immediately. Expansion of
a deferred construct is not performed until either the construct appears
later in an immediate context, or until the second phase.
often a source of some confusion when writing makefiles. Below is a
summary of the different constructs that can be found in a makefile,
and the phase in which expansion happens for each part of the
construct.
We say that expansion is @dfn{immediate} if it happens during the
first phase: @code{make} will expand that part of the construct as the
makefile is parsed. We say that expansion is @dfn{deferred} if it is
not immediate. Expansion of a deferred construct part is delayed
until the expansion is used: either when it is referenced in an
immediate context, or when it is needed during the second phase.
You may not be familiar with some of these constructs yet. You can
reference this section as you become familiar with them, in later
@@ -1540,14 +1542,14 @@ define @var{immediate} !=
endef
@end example
For the append operator, @samp{+=}, the right-hand side is considered
For the append operator @samp{+=}, the right-hand side is considered
immediate if the variable was previously set as a simple variable
(@samp{:=} or @samp{::=}), and deferred otherwise.
For the shell assignment operator, @samp{!=}, the right-hand side is
evaluated immediately and handed to the shell. The result is stored in the
variable named on the left, and that variable becomes a simple variable
(and will thus be re-evaluated on each reference).
For the shell assignment operator @samp{!=}, the right-hand side is
evaluated immediately and handed to the shell. The result is stored
in the variable named on the left, and that variable becomes a simple
variable (and will thus be re-evaluated on each reference).
@subheading Conditional Directives
@cindex ifdef, expansion
@@ -1576,10 +1578,10 @@ A rule is always expanded the same way, regardless of the form:
@var{deferred}
@end example
That is, the target and prerequisite sections are expanded immediately,
and the recipe used to construct the target is always deferred. This
general rule is true for explicit rules, pattern rules, suffix rules,
static pattern rules, and simple prerequisite definitions.
That is, the target and prerequisite sections are expanded
immediately, and the recipe used to build the target is always
deferred. This is true for explicit rules, pattern rules, suffix
rules, static pattern rules, and simple prerequisite definitions.
@node Parsing Makefiles, Secondary Expansion, Reading Makefiles, Makefiles
@section How Makefiles Are Parsed
@@ -1930,8 +1932,8 @@ more recent than it.
@item
How to update the file @file{foo.o}: by running @code{cc} as stated.
The recipe does not explicitly mention @file{defs.h}, but we presume
that @file{foo.c} includes it, and that that is why @file{defs.h} was
added to the prerequisites.
that @file{foo.c} includes it, and that is why @file{defs.h} was added
to the prerequisites.
@end itemize
@end ifnottex
@@ -3980,7 +3982,7 @@ the statements in sequence. For example:
@example
foo : bar/lose
cd $(@@D) && gobble $(@@F) > ../$@@
cd $(<D) && gobble $(<F) > ../$@@
@end example
@noindent
@@ -4531,6 +4533,19 @@ target is updated in some atomic fashion, or exists only to record a
modification-time (its contents do not matter), or must exist at all
times to prevent other sorts of trouble.
Although @code{make} does its best to clean up there are certain situations
in which cleanup is impossible. For example, @code{make} may be killed by
an uncatchable signal. Or, one of the programs make invokes may be killed
or crash, leaving behind an up-to-date but corrupt target file: @code{make}
will not realize that this failure requires the target to be cleaned. Or
@code{make} itself may encounter a bug and crash.
For these reasons it's best to write @emph{defensive recipes}, which won't
leave behind corrupted targets even if they fail. Most commonly these
recipes create temporary files rather than updating the target directly,
then rename the temporary file to the final target name. Some compilers
already behave this way, so that you don't need to write a defensive recipe.
@node Recursion, Canned Recipes, Interrupts, Recipes
@section Recursive Use of @code{make}
@cindex recursion
@@ -5523,17 +5538,19 @@ replaced; other occurrences of @var{a} in the value are unaltered. For
example:@refill
@example
foo := a.o b.o c.o
foo := a.o b.o l.a c.o
bar := $(foo:.o=.c)
@end example
@noindent
sets @samp{bar} to @samp{a.c b.c c.c}. @xref{Setting, ,Setting Variables}.
sets @samp{bar} to @samp{a.c b.c l.a c.c}. @xref{Setting, ,Setting Variables}.
A substitution reference is actually an abbreviation for use of the
@code{patsubst} expansion function (@pxref{Text Functions, ,Functions for String Substitution and Analysis}). We provide
substitution references as well as @code{patsubst} for compatibility with
other implementations of @code{make}.
A substitution reference is shorthand for the @code{patsubst}
expansion function (@pxref{Text Functions, ,Functions for String Substitution and Analysis}):
@samp{$(@var{var}:@var{a}=@var{b})} is equivalent to
@samp{$(patsubst %@var{a},%@var{b},@var{var})}. We provide
substitution references as well as @code{patsubst} for compatibility
with other implementations of @code{make}.
@findex patsubst
Another type of substitution reference lets you use the full power of
@@ -5548,13 +5565,13 @@ for a description of the @code{patsubst} function.@refill
@group
@exdent For example:
foo := a.o b.o c.o
foo := a.o b.o l.a c.o
bar := $(foo:%.o=%.c)
@end group
@end example
@noindent
sets @samp{bar} to @samp{a.c b.c c.c}.
sets @samp{bar} to @samp{a.c b.c l.a c.c}.
@node Computed Names, , Substitution Refs, Advanced
@subsection Computed Variable Names
@@ -6627,6 +6644,57 @@ Supports dynamically loadable objects for creating custom extensions.
Expands to a list of directories that @code{make} searches for
included makefiles (@pxref{Include, , Including Other Makefiles}).
@vindex .EXTRA_PREREQS @r{(prerequisites not added to automatic variables)}
@item .EXTRA_PREREQS
Each word in this variable is a new prerequisite which is added to
targets for which it is set. These prerequisites differ from normal
prerequisites in that they do not appear in any of the automatic
variables (@pxref{Automatic Variables}). This allows prerequisites to
be defined which do not impact the recipe.
Consider a rule to link a program:
@example
myprog: myprog.o file1.o file2.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@@ $^ $(LDLIBS)
@end example
Now suppose you want to enhance this makefile to ensure that updates
to the compiler cause the program to be re-linked. You can add the
compiler as a prerequisite, but you must ensure that it's not passed
as an argument to link command. You'll need something like this:
@example
myprog: myprog.o file1.o file2.o $(CC)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@@ $(filter-out $(CC),$^) $(LDLIBS)
@end example
Then consider having multiple extra prerequisites: they would all have
to be filtered out. Using @code{.EXTRA_PREREQS} and target-specific
variables provides a simpler solution:
@example
myprog: myprog.o file1.o file2.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@@ $^ $(LDLIBS)
myprog: .EXTRA_PREREQS = $(CC)
@end example
This feature can also be useful if you want to add prerequisites to a
makefile you cannot easily modify: you can create a new file such as
@file{extra.mk}:
@example
myprog: .EXTRA_PREREQS = $(CC)
@end example
then invoke @code{make -f extra.mk -f Makefile}.
Setting @code{.EXTRA_PREREQS} globally will cause those prerequisites
to be added to all targets (which did not themselves override it with
a target-specific value). Note @code{make} is smart enough not to add
a prerequisite listed in @code{.EXTRA_PREREQS} as a prerequisite to
itself.
@end table
@node Conditionals, Functions, Using Variables, Top
@@ -9863,6 +9931,10 @@ and linking with a single @code{cc} command. The optimized rule is used in
preference to the step-by-step chain because it comes earlier in the
ordering of rules.
Finally, for performance reasons @code{make} will not consider non-terminal
match-anything rules (i.e., @samp{%:}) when searching for a rule to
build a prerequisite of an implicit rule (@pxref{Match-Anything Rules}).
@node Pattern Rules, Last Resort, Chained Rules, Implicit Rules
@section Defining and Redefining Pattern Rules
@@ -10352,9 +10424,10 @@ remade from any other files; therefore, @code{make} can save time by not
looking for ways to remake them.@refill
If you do not mark the match-anything rule as terminal, then it is
non-terminal. A non-terminal match-anything rule cannot apply to a file name
that indicates a specific type of data. A file name indicates a specific
type of data if some non-match-anything implicit rule target matches it.
non-terminal. A non-terminal match-anything rule cannot apply to a
prerequisite of an implicit rule, or to a file name that indicates a
specific type of data. A file name indicates a specific type of data
if some non-match-anything implicit rule target matches it.
For example, the file name @file{foo.c} matches the target for the pattern
rule @samp{%.c : %.y} (the rule to run Yacc). Regardless of whether this
@@ -10591,8 +10664,9 @@ Make a list of all the pattern rules one of whose targets matches
matched against @var{t}; otherwise, against @var{n}.
@item
If any rule in that list is @emph{not} a match-anything rule, then
remove all non-terminal match-anything rules from the list.
If any rule in that list is @emph{not} a match-anything rule, or if
@var{t} is a prerequisite of an implicit rule, then remove all
non-terminal match-anything rules from the list.
@item
Remove from the list all rules with no recipe.
@@ -11623,7 +11697,8 @@ On POSIX systems the jobserver is implemented as a simple UNIX pipe.
The pipe will be pre-loaded with one single-character token for each
available job. To obtain an extra slot you must read a single
character from the jobserver pipe; to release a slot you must write a
single character back into the jobserver pipe.
single character back into the jobserver pipe. Note that the read
side of the jobserver pipe is set to ``blocking'' mode.
To access the pipe you must parse the @code{MAKEFLAGS} variable and
look for the argument string @code{--jobserver-auth=R,W} where
@@ -12675,6 +12750,18 @@ receive only part of the information necessary. In this case, the child
will generate this warning message and proceed with its build in a
sequential manner.
@item warning: ignoring prerequisites on suffix rule definition
According to POSIX, a suffix rule cannot contain prerequisites. If a rule
that could be a suffix rule has prerequisites it is interpreted as a simple
explicit rule, with an odd target name. This requirement is obeyed when
POSIX-conforming mode is enabled (the @code{.POSIX} target is defined). In
versions of GNU @code{make} prior to 4.3, no warning was emitted and a
suffix rule was created, however all prerequisites were ignored and were not
part of the suffix rule. Starting with GNU @code{make} 4.3 the behavior is
the same, and in addition this warning is generated. In a future version
the POSIX-conforming behavior will be the only behavior: no rule with a
prerequisite can be suffix rule and this warning will be removed.
@end table
@node Complex Makefile, GNU Free Documentation License, Error Messages, Top
@@ -12957,7 +13044,7 @@ tar.zoo: $(SRCS) $(AUX)
@end example
@node GNU Free Documentation License, Concept Index, Complex Makefile, Top
@appendixsec GNU Free Documentation License
@appendix GNU Free Documentation License
@cindex FDL, GNU Free Documentation License
@include fdl.texi

View File

@@ -2,6 +2,33 @@ Description:
GNU make version of fnmatch()/glob() functions. This is a holdover from
a very old version of the globbing library.
configure.ac:
# Check the system to see if it provides GNU glob. If not, use our
# local version.
AC_CACHE_CHECK([if system libc has GNU glob], [make_cv_sys_gnu_glob],
[ AC_EGREP_CPP([gnu glob],[
#include <features.h>
#include <glob.h>
#include <fnmatch.h>
#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
# include <gnu-versions.h>
# if _GNU_GLOB_INTERFACE_VERSION == 1 || _GNU_GLOB_INTERFACE_VERSION == 2
gnu glob
# endif
#endif],
[make_cv_sys_gnu_glob=yes],
[make_cv_sys_gnu_glob=no])])
# Tell automake about this, so it can build the right .c files.
AM_CONDITIONAL([USE_SYSTEM_GLOB], [test "$make_cv_sys_gnu_glob" = yes])
# Tell build.sh which to use
USE_SYSTEM_GLOB="$make_cv_sys_gnu_glob"
AC_SUBST([USE_SYSTEM_GLOB])
Makefile.am:
if !USE_SYSTEM_GLOB
libgnu_a_SOURCES += fnmatch.c

View File

@@ -117,7 +117,7 @@ extern int errno;
/* When used in the GNU libc the symbol _DIRENT_HAVE_D_TYPE is available
if the `d_type' member for `struct dirent' is available. */
#ifdef _DIRENT_HAVE_D_TYPE
#if defined(_DIRENT_HAVE_D_TYPE) || defined(HAVE_STRUCT_DIRENT_D_TYPE)
# define HAVE_D_TYPE 1
#endif

View File

@@ -1,7 +1,7 @@
dnl acinclude.m4 -- Extra macros needed for GNU make.
dnl
dnl Automake will incorporate this into its generated aclocal.m4.
dnl Copyright (C) 1998-2019 Free Software Foundation, Inc.
dnl Copyright (C) 1998-2020 Free Software Foundation, Inc.
dnl This file is part of GNU Make.
dnl
dnl GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -1,7 +1,7 @@
# Test if the system uses DOS-style pathnames (drive specs and backslashes)
# By Paul Smith <psmith@gnu.org>. Based on dos.m4 by Jim Meyering.
#
# Copyright (C) 1993-2019 Free Software Foundation, Inc.
# Copyright (C) 1993-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -26,14 +26,19 @@ GNUWEBDIR ?= $(SRCROOTDIR)/gnu-www
# Where to put the CVS checkout of the GNU make web repository
MAKEWEBDIR ?= $(SRCROOTDIR)/make/make-web
# Enable Perl warnings for the test suite
PERLFLAGS := -w
# We like mondo-warnings!
# Also force comments to be preserved. This helps when using ccache, in
# combination with GCC 7's implicit-fallthrough warning.
AM_CFLAGS += -C -Wall -Wextra -Werror -Wwrite-strings -Wshadow \
MAKE_CFLAGS := -C -Wall -Wextra -Werror -Wwrite-strings -Wshadow \
-Wdeclaration-after-statement -Wbad-function-cast -Wformat-security \
-Wtype-limits -Wunused-but-set-parameter -Wlogical-op -Wpointer-arith \
-Wignored-qualifiers -Wformat-signedness -Wduplicated-cond
AM_CFLAGS += $(MAKE_CFLAGS)
# Unfortunately the Guile headers are sometimes broken. Convince GCC
# to treat them as system headers so warnings are ignored.
GUILE_CFLAGS := $(patsubst -I%,-isystem %,$(GUILE_CFLAGS))
@@ -83,16 +88,6 @@ Basic.mk: Basic.mk.template .dep_segment Makefile
$(word 2,$^) >>$@
chmod a-w $@
# Construct build.sh.in
#
build.sh.in: build.template Makefile
rm -f $@
sed -e 's@%objs%@$(patsubst %.o,%.$${OBJEXT},$(filter-out src/remote-%,$(make_OBJECTS)))@g' \
$< > $@
chmod a-w+x $@
all: build.sh.in
# Use automake to build a dependency list file, for Makebase.mk.
#
@@ -236,15 +231,36 @@ get-doc/make-stds.texi get-doc/fdl.texi:
# Alternative configuration checks. #
# ---------------------------------- #
CFGCHECK_CONFIGFLAGS =
CFGCHECK_BUILDFLAGS =
CFGCHECK_MAKEFLAGS = CFLAGS='$(AM_CFLAGS)'
checkcfg.strict-c90: CFGCHECK_CONFIGFLAGS = CFLAGS='-std=c90 -pedantic'
checkcfg.strict-c90: CFGCHECK_MAKEFLAGS =
checkcfg.no-jobserver:CFGCHECK_CONFIGFLAGS = --disable-job-server
checkcfg.no-load: CFGCHECK_CONFIGFLAGS = --disable-load
checkcfg.no-guile: CFGCHECK_CONFIGFLAGS = --without-guile
checkcfg.no-spawn: CFGCHECK_CONFIGFLAGS = --disable-posix-spawn
checkcfg.no-sysglob: CFGCHECK_CONFIGFLAGS = make_cv_sys_gnu_glob=no
checkcfg.no-loadavg: CFGCHECK_CONFIGFLAGS = ac_cv_func_getloadavg=no \
ac_cv_have_decl_getloadavg=no \
gl_cv_have_raw_decl_getloadavg=no \
ac_cv_lib_util_getloadavg=no \
ac_cv_lib_getloadavg_getloadavg=no
checkcfg.no-sync: CFGCHECK_CONFIGFLAGS = CPPFLAGS=-DNO_OUTPUT_SYNC
checkcfg.no-archives: CFGCHECK_CONFIGFLAGS = CPPFLAGS=-DNO_ARCHIVES
CONFIG_CHECKS := \
checkcfg.--disable-job-server \
checkcfg.--disable-load \
checkcfg.--without-guile \
checkcfg.--disable-posix-spawn \
checkcfg.make_cv_sys_gnu_glob^no \
checkcfg.ac_cv_func_getloadavg^no+ac_cv_have_decl_getloadavg^no+gl_cv_have_raw_decl_getloadavg^no+ac_cv_lib_util_getloadavg^no+ac_cv_lib_getloadavg_getloadavg^no \
checkcfg.CPPFLAGS^-DNO_OUTPUT_SYNC \
checkcfg.CPPFLAGS^-DNO_ARCHIVES
checkcfg.strict-c90 \
checkcfg.no-jobserver \
checkcfg.no-load \
checkcfg.no-guile \
checkcfg.no-spawn \
checkcfg.no-sysglob \
checkcfg.no-loadavg \
checkcfg.no-sync \
checkcfg.no-archives
.PHONY: check-alt-config
check-alt-config: $(CONFIG_CHECKS)
@@ -256,20 +272,20 @@ NR_MAKE = $(MAKE)
$(CONFIG_CHECKS): checkcfg.%: distdir
@echo "Building $@ (output in checkcfg.$*.log)"
exec >'checkcfg.$*.log' 2>&1; \
echo "Testing configure with $(subst ^,=,$(subst +, ,$*))"; set -x; \
echo "Testing configure with $(CFGCHECK_CONFIGFLAGS)"; set -x; \
rm -rf $(distdir)/_build \
&& mkdir $(distdir)/_build \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. $(subst ^,=,$(subst +, ,$*)) \
&& ../configure --srcdir=.. $(CFGCHECK_CONFIGFLAGS) \
$(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS)
exec >>'checkcfg.$*.log' 2>&1; set -x; \
cd $(distdir)/_build \
&& ./build.sh \
&& ./make $(AM_MAKEFLAGS) check \
&& ./make $(AM_MAKEFLAGS) clean
&& OUTDIR=_bld ../build.sh $(CFGCHECK_BUILD_FLAGS) \
&& _bld/make $(AM_MAKEFLAGS) check-local \
&& _bld/make $(AM_MAKEFLAGS) clean
exec >>'checkcfg.$*.log' 2>&1; set -x; \
cd $(distdir)/_build \
&& $(NR_MAKE) $(AM_MAKEFLAGS) CFLAGS='$(AM_CFLAGS)' \
&& $(NR_MAKE) $(AM_MAKEFLAGS) $(CFGCHECK_MAKEFLAGS) \
&& ./make $(AM_MAKEFLAGS) check \
&& ./make $(AM_MAKEFLAGS) clean
@@ -403,7 +419,7 @@ $(COV_BUILD_FILE): $(filter %.c %.h,$(DISTFILES))
CFLAGS='$(AM_CFLAGS)'
PATH="$${COVERITY_PATH:+$$COVERITY_PATH/bin:}$$PATH"; \
cd '$(distdir)'/_build \
&& cov-build --dir cov-int ./build.sh
&& cov-build --dir cov-int ../build.sh
rm -f '$@'
(cd '$(distdir)'/_build && tar czf - cov-int) > '$@'
@@ -488,7 +504,7 @@ $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
# Rebuild Makefile.in if this file is modifed.
Makefile.in: maintMakefile
# Copyright (C) 1997-2019 Free Software Foundation, Inc.
# Copyright (C) 1997-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -154,7 +154,7 @@ $ exit
$ endsubroutine : compileit
$!
$!-----------------------------------------------------------------------------
$!Copyright (C) 1996-2019 Free Software Foundation, Inc.
$!Copyright (C) 1996-2020 Free Software Foundation, Inc.
$!This file is part of GNU Make.
$!
$!GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -2,7 +2,7 @@
#
# Amiga overrides for use with Basic.mk.
#
# Copyright (C) 2017-2019 Free Software Foundation, Inc.
# Copyright (C) 2017-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -2,7 +2,7 @@
#
# POSIX overrides for use with Basic.mk.
#
# Copyright (C) 2017-2019 Free Software Foundation, Inc.
# Copyright (C) 2017-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -2,7 +2,7 @@
#
# VMS overrides for use with Basic.mk.
#
# Copyright (C) 2017-2019 Free Software Foundation, Inc.
# Copyright (C) 2017-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -2,7 +2,7 @@
#
# Windows overrides for use with Basic.mk.
#
# Copyright (C) 2017-2019 Free Software Foundation, Inc.
# Copyright (C) 2017-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -2,7 +2,7 @@
#
# MS-DOS overrides for use with Basic.mk.
#
# Copyright (C) 2017-2019 Free Software Foundation, Inc.
# Copyright (C) 2017-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -1,5 +1,5 @@
# List of source files containing translatable strings.
# Copyright (C) 2000-2019 Free Software Foundation, Inc.
# Copyright (C) 2000-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (C) 2014-2019 Free Software Foundation, Inc.
# Copyright (C) 2014-2020 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# Update GNU make copyrights using gnulib update-copyright

View File

@@ -1,5 +1,5 @@
/* Running commands on Amiga
Copyright (C) 1995-2019 Free Software Foundation, Inc.
Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Definitions for amiga specific things
Copyright (C) 1995-2019 Free Software Foundation, Inc.
Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Interface to 'ar' archives for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.

View File

@@ -1,5 +1,5 @@
/* Library function for scanning an archive file.
Copyright (C) 1987-2019 Free Software Foundation, Inc.
Copyright (C) 1987-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -40,7 +40,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include <rmsdef.h>
/* This symbol should be present in lbrdef.h. */
#ifndef LBR$_HDRTRUNC
#if !defined LBR$_HDRTRUNC
#pragma extern_model save
#pragma extern_model globalvalue
extern unsigned int LBR$_HDRTRUNC;
@@ -703,7 +703,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
}
#ifndef M_XENIX
sscanf (TOCHAR (member_header.ar_mode), "%o", &eltmode);
sscanf (TOCHAR (member_header.ar_mode), "%8o", &eltmode);
eltsize = atol (TOCHAR (member_header.ar_size));
#else /* Xenix. */
eltmode = (unsigned short int) member_header.ar_mode;
@@ -909,7 +909,7 @@ ar_member_touch (const char *arname, const char *memname)
for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++)
ar_hdr.ar_date[ui] = ' ';
sprintf (TOCHAR (ar_hdr.ar_date), "%lu", (long unsigned) statbuf.st_mtime);
ar_hdr.ar_date[strlen (ar_hdr.ar_date)] = ' ';
ar_hdr.ar_date[strlen ((char *) ar_hdr.ar_date)] = ' ';
#else
ar_hdr.ar_date = statbuf.st_mtime;
#endif

View File

@@ -1,5 +1,5 @@
/* Command processing for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -133,7 +133,7 @@ set_file_variables (struct file *file)
/* $< is the first not order-only dependency. */
less = "";
for (d = file->deps; d != 0; d = d->next)
if (!d->ignore_mtime)
if (!d->ignore_mtime && !d->ignore_automatic_vars)
{
if (!d->need_2nd_expansion)
less = dep_name (d);
@@ -178,7 +178,7 @@ set_file_variables (struct file *file)
bar_len = 0;
for (d = file->deps; d != 0; d = d->next)
{
if (!d->need_2nd_expansion)
if (!d->need_2nd_expansion && !d->ignore_automatic_vars)
{
if (d->ignore_mtime)
bar_len += strlen (dep_name (d)) + 1;
@@ -200,7 +200,7 @@ set_file_variables (struct file *file)
qmark_len = plus_len + 1; /* Will be this or less. */
for (d = file->deps; d != 0; d = d->next)
if (! d->ignore_mtime && ! d->need_2nd_expansion)
if (! d->ignore_mtime && ! d->need_2nd_expansion && ! d->ignore_automatic_vars)
{
const char *c = dep_name (d);
@@ -247,7 +247,7 @@ set_file_variables (struct file *file)
for (d = file->deps; d != 0; d = d->next)
{
if (d->need_2nd_expansion)
if (d->need_2nd_expansion || d->ignore_automatic_vars)
continue;
slot = hash_find_slot (&dep_hash, d);
@@ -269,7 +269,7 @@ set_file_variables (struct file *file)
{
const char *c;
if (d->need_2nd_expansion || hash_find_item (&dep_hash, d) != d)
if (d->need_2nd_expansion || d->ignore_automatic_vars || hash_find_item (&dep_hash, d) != d)
continue;
c = dep_name (d);

View File

@@ -1,5 +1,5 @@
/* Definition of data structures describing shell commands for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* config.h -- hand-massaged for Amiga -*-C-*-
Copyright (C) 1995-2019 Free Software Foundation, Inc.
Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,6 +1,6 @@
/* config.h-vms. Generated by hand by Klaus Kämpf <kkaempf@rmi.de> -*-C-*-
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,6 +1,6 @@
/* config.h.W32 -- hand-massaged config.h file for Windows builds -*-C-*-
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -291,6 +291,12 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'strsignal' function. */
/* #undef HAVE_STRSIGNAL */
/* Define to 1 if `d_type' is a member of `struct dirent'. */
/* SV 57152: MinGW64 version of dirent doesn't support d_type. */
#ifndef __MINGW64__
# define HAVE_STRUCT_DIRENT_D_TYPE 1
#endif
/* Define to 1 if you have the `isatty' function. */
#define HAVE_ISATTY 1
@@ -298,6 +304,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#define HAVE_TTYNAME 1
char *ttyname (int);
/* Define to 1 if you have the `umask' function. */
#ifdef __MINGW32__
# define HAVE_UMASK 1
#endif
/* Define to 1 if 'n_un.n_name' is a member of 'struct nlist'. */
/* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */
@@ -470,6 +481,11 @@ char *ttyname (int);
/* Define to empty if 'const' does not conform to ANSI C. */
/* #undef const */
#ifdef __MINGW32__
# undef __USE_MINGW_ANSI_STDIO
# define __USE_MINGW_ANSI_STDIO 1
#endif
#include <sys/types.h>
/* Define to 'int' if <sys/types.h> doesn't define. */

View File

@@ -1,6 +1,6 @@
/* configh.dos -- hand-massaged config.h file for MS-DOS builds -*-C-*-
Copyright (C) 1994-2019 Free Software Foundation, Inc.
Copyright (C) 1994-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Debugging macros and interface.
Copyright (C) 1999-2019 Free Software Foundation, Inc.
Copyright (C) 1999-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Data base of default implicit rules for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Definitions of dependency data structures for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -44,11 +44,12 @@ struct nameseq
NAMESEQ (_t); \
struct file *file; \
const char *stem; \
unsigned short flags : 8; \
unsigned short changed : 1; \
unsigned short ignore_mtime : 1; \
unsigned short staticpattern : 1; \
unsigned short need_2nd_expansion : 1
unsigned int flags : 8; \
unsigned int changed : 1; \
unsigned int ignore_mtime : 1; \
unsigned int staticpattern : 1; \
unsigned int need_2nd_expansion : 1; \
unsigned int ignore_automatic_vars : 1
struct dep
{
@@ -74,6 +75,7 @@ struct goaldep
#define PARSEFS_NOGLOB 0x0004
#define PARSEFS_EXISTS 0x0008
#define PARSEFS_NOCACHE 0x0010
#define PARSEFS_ONEWORD 0x0020
#define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \
(_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f))
@@ -98,7 +100,7 @@ struct nameseq *ar_glob (const char *arname, const char *member_pattern, size_t
#define alloc_seq_elt(_t) xcalloc (sizeof (_t))
void free_ns_chain (struct nameseq *n);
#if defined(MAKE_MAINTAINER_MODE) && defined(__GNUC__)
#if defined(MAKE_MAINTAINER_MODE) && defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Use inline to get real type-checking. */
#define SI static inline
SI struct nameseq *alloc_ns() { return alloc_seq_elt (struct nameseq); }

View File

@@ -1,5 +1,5 @@
/* Directory hashing for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -732,7 +732,7 @@ dir_contents_file_exists_p (struct directory_contents *dir,
#else
df->name = strcache_add_len (d->d_name, len);
#endif
#ifdef _DIRENT_HAVE_D_TYPE
#ifdef HAVE_STRUCT_DIRENT_D_TYPE
df->type = d->d_type;
#endif
df->length = len;
@@ -1245,7 +1245,7 @@ read_dirstream (__ptr_t stream)
#ifdef _DIRENT_HAVE_D_NAMLEN
d->d_namlen = len - 1;
#endif
#ifdef _DIRENT_HAVE_D_TYPE
#ifdef HAVE_STRUCT_DIRENT_D_TYPE
d->d_type = df->type;
#endif
memcpy (d->d_name, df->name, len);
@@ -1332,6 +1332,7 @@ local_lstat (const char *path, struct stat *buf)
void
dir_setup_glob (glob_t *gl)
{
gl->gl_offs = 0;
gl->gl_opendir = open_dirstream;
gl->gl_readdir = read_dirstream;
gl->gl_closedir = free;

View File

@@ -1,5 +1,5 @@
/* Variable expansion functions for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Target file management for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -550,15 +550,6 @@ enter_prereqs (struct dep *deps, const char *stem)
return deps;
}
/* Set the intermediate flag. */
static void
set_intermediate (const void *item)
{
struct file *f = (struct file *) item;
f->intermediate = 1;
}
/* Expand and parse each dependency line. */
static void
expand_deps (struct file *f)
@@ -644,13 +635,70 @@ expand_deps (struct file *f)
}
}
/* Reset the updating flag. */
/* Add extra prereqs to the file in question. */
struct dep *
expand_extra_prereqs (const struct variable *extra)
{
struct dep *d;
struct dep *prereqs = extra ? split_prereqs (variable_expand (extra->value)) : NULL;
for (d = prereqs; d; d = d->next)
{
d->file = lookup_file (d->name);
if (!d->file)
d->file = enter_file (d->name);
d->name = NULL;
d->ignore_automatic_vars = 1;
}
return prereqs;
}
/* Perform per-file snap operations. */
static void
reset_updating (const void *item)
snap_file (const void *item, void *arg)
{
struct file *f = (struct file *) item;
f->updating = 0;
struct file *f = (struct file*)item;
struct dep *prereqs = NULL;
/* If we're not doing second expansion then reset updating. */
if (!second_expansion)
f->updating = 0;
/* If .SECONDARY is set with no deps, mark all targets as intermediate. */
if (all_secondary)
f->intermediate = 1;
/* If .EXTRA_PREREQS is set, add them as ignored by automatic variables. */
if (f->variables)
prereqs = expand_extra_prereqs (lookup_variable_in_set (STRING_SIZE_TUPLE(".EXTRA_PREREQS"), f->variables->set));
else if (f->is_target)
prereqs = copy_dep_chain (arg);
if (prereqs)
{
struct dep *d;
for (d = prereqs; d; d = d->next)
if (streq (f->name, dep_name (d)))
/* Skip circular dependencies. */
break;
if (d)
/* We broke early: must have found a circular dependency. */
free_dep_chain (prereqs);
else if (!f->deps)
f->deps = prereqs;
else
{
d = f->deps;
while (d->next)
d = d->next;
d->next = prereqs;
}
}
}
/* For each dependency of each file, make the 'struct dep' point
@@ -700,9 +748,6 @@ snap_deps (void)
expand_deps (f);
free (file_slot_0);
}
else
/* We're not doing second expansion, so reset updating. */
hash_map (&files, reset_updating);
/* Now manage all the special targets. */
@@ -744,10 +789,7 @@ snap_deps (void)
f2->intermediate = f2->secondary = 1;
/* .SECONDARY with no deps listed marks *all* files that way. */
else
{
all_secondary = 1;
hash_map (&files, set_intermediate);
}
all_secondary = 1;
f = lookup_file (".EXPORT_ALL_VARIABLES");
if (f != 0 && f->is_target)
@@ -779,6 +821,15 @@ snap_deps (void)
if (f != 0 && f->is_target)
not_parallel = 1;
{
struct dep *prereqs = expand_extra_prereqs (lookup_variable (STRING_SIZE_TUPLE(".EXTRA_PREREQS")));
/* Perform per-file snap operations. */
hash_map_arg(&files, snap_file, prereqs);
free_dep_chain (prereqs);
}
#ifndef NO_MINUS_C_MINUS_O
/* If .POSIX was defined, remove OUTPUT_OPTION to comply. */
/* This needs more work: what if the user sets this in the makefile?

View File

@@ -1,5 +1,5 @@
/* Definition of target file data structures for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -21,6 +21,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "hash.h"
struct commands;
struct dep;
struct variable;
struct variable_set_list;
struct file
{
const char *name;
@@ -110,6 +115,7 @@ struct file *lookup_file (const char *name);
struct file *enter_file (const char *name);
struct dep *split_prereqs (char *prereqstr);
struct dep *enter_prereqs (struct dep *prereqs, const char *stem);
struct dep *expand_extra_prereqs (const struct variable *extra);
void remove_intermediates (int sig);
void snap_deps (void);
void rename_file (struct file *file, const char *name);

View File

@@ -1,5 +1,5 @@
/* Builtin function expansion for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -38,8 +38,8 @@ struct function_table_entry
unsigned char len;
unsigned char minimum_args;
unsigned char maximum_args;
unsigned char expand_args:1;
unsigned char alloc_fn:1;
unsigned int expand_args:1;
unsigned int alloc_fn:1;
};
static unsigned long
@@ -1780,12 +1780,16 @@ func_shell_base (char *o, char **argv, int trim_newlines)
fd_noinherit (pipedes[0]);
{
struct output out;
out.syncout = 1;
out.out = pipedes[1];
out.err = errfd;
struct childbase child;
child.cmd_name = NULL;
child.output.syncout = 1;
child.output.out = pipedes[1];
child.output.err = errfd;
child.environment = envp;
pid = child_execute_job (&out, 1, command_argv, envp);
pid = child_execute_job (&child, 1, command_argv);
free (child.cmd_name);
}
if (pid < 0)
@@ -2169,6 +2173,15 @@ func_realpath (char *o, char **argv, const char *funcname UNUSED)
#ifdef HAVE_REALPATH
ENULLLOOP (rp, realpath (in, out));
# if defined _AIX
/* AIX realpath() doesn't remove trailing slashes correctly. */
if (rp)
{
char *ep = rp + strlen (rp) - 1;
while (ep > rp && ep[0] == '/')
*(ep--) = '\0';
}
# endif
#else
rp = abspath (in, out);
#endif

View File

@@ -3,7 +3,7 @@ NOTE: getopt is now part of the C library, so if you don't know what
"Keep this file name-space clean" means, talk to drepper@gnu.org
before changing it!
Copyright (C) 1987-2019 Free Software Foundation, Inc.
Copyright (C) 1987-2020 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.

View File

@@ -1,5 +1,5 @@
/* Declarations for getopt.
Copyright (C) 1989-2019 Free Software Foundation, Inc.
Copyright (C) 1989-2020 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.

View File

@@ -1,5 +1,5 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987-1994, 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1987-1994, 1996-2020 Free Software Foundation, Inc.
NOTE: The canonical source of this file is maintained with the GNU C Library.
Bugs can be reported to bug-glibc@gnu.org.

View File

@@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-2019 Free Software Foundation, Inc.
Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
;; Contents of the (gnu make) Guile module
;; Copyright (C) 2011-2019 Free Software Foundation, Inc.
;; Copyright (C) 2011-2020 Free Software Foundation, Inc.
;; This file is part of GNU Make.
;;
;; GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -1,7 +1,7 @@
/* External interfaces usable by dynamic objects loaded into GNU Make.
--THIS API IS A "TECHNOLOGY PREVIEW" ONLY. IT IS NOT A STABLE INTERFACE--
Copyright (C) 2013-2019 Free Software Foundation, Inc.
Copyright (C) 2013-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* GNU Guile interface for GNU Make.
Copyright (C) 2011-2019 Free Software Foundation, Inc.
Copyright (C) 2011-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -16,6 +16,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "hash.h"
#include <assert.h>
#define CALLOC(t, n) ((t *) xcalloc (sizeof (t) * (n)))
#define MALLOC(t, n) ((t *) xmalloc (sizeof (t) * (n)))
@@ -364,7 +365,8 @@ round_up_2 (unsigned long n)
r += val; \
} while(0);
unsigned jhash(unsigned const char *k, int length)
unsigned int
jhash(unsigned const char *k, int length)
{
unsigned int a, b, c;
@@ -408,12 +410,16 @@ unsigned jhash(unsigned const char *k, int length)
return c;
}
#define UINTSZ sizeof (unsigned int)
#ifdef WORDS_BIGENDIAN
/* The ifs are ordered from the first byte in memory to the last. */
#define sum_up_to_nul(r, p, flag) \
#define sum_up_to_nul(r, p, plen, flag) \
do { \
unsigned int val; \
memcpy(&val, (p), 4); \
unsigned int val = 0; \
size_t pn = (plen); \
size_t n = pn < UINTSZ ? pn : UINTSZ; \
memcpy (&val, (p), n); \
if ((val & 0xFF000000) == 0) \
flag = 1; \
else if ((val & 0xFF0000) == 0) \
@@ -427,51 +433,60 @@ unsigned jhash(unsigned const char *k, int length)
/* First detect the presence of zeroes. If there is none, we can
sum the 4 bytes directly. Otherwise, the ifs are ordered as in the
big endian case, from the first byte in memory to the last. */
#define sum_up_to_nul(r, p, flag) \
do { \
unsigned int val; \
unsigned int zeroes; \
memcpy(&val, (p), 4); \
zeroes = ((val - 0x01010101) & ~val); \
if (!(zeroes & 0x80808080)) \
r += val; \
else if ((val & 0xFF) == 0) \
flag = 1; \
else if ((val & 0xFF00) == 0) \
r += val & 0xFF, flag = 1; \
else if ((val & 0xFF0000) == 0) \
r += val & 0xFFFF, flag = 1; \
else \
r += val, flag = 1; \
#define sum_up_to_nul(r, p, plen, flag) \
do { \
unsigned int val = 0; \
size_t pn = (plen); \
size_t n = pn < UINTSZ ? pn : UINTSZ; \
memcpy (&val, (p), n); \
flag = ((val - 0x01010101) & ~val) & 0x80808080; \
if (!flag) \
r += val; \
else if (val & 0xFF) \
{ \
if ((val & 0xFF00) == 0) \
r += val & 0xFF; \
else if ((val & 0xFF0000) == 0) \
r += val & 0xFFFF; \
else \
r += val; \
} \
} while (0)
#endif
/* This function performs magic which is correct but causes ASAN heartburn
when we pass in a global constant string (at least). */
__attribute__((no_sanitize_address))
unsigned jhash_string(unsigned const char *k)
unsigned int
jhash_string(unsigned const char *k)
{
unsigned int a, b, c;
unsigned int have_nul = 0;
unsigned const char *start = k;
size_t klen = strlen ((const char*)k);
/* Set up the internal state */
a = b = c = JHASH_INITVAL;
/* All but the last block: affect some 32 bits of (a,b,c) */
for (;;) {
sum_up_to_nul(a, k, have_nul);
sum_up_to_nul(a, k, klen, have_nul);
if (have_nul)
break;
k += 4;
sum_up_to_nul(b, k, have_nul);
k += UINTSZ;
assert (klen >= UINTSZ);
klen -= UINTSZ;
sum_up_to_nul(b, k, klen, have_nul);
if (have_nul)
break;
k += 4;
sum_up_to_nul(c, k, have_nul);
k += UINTSZ;
assert (klen >= UINTSZ);
klen -= UINTSZ;
sum_up_to_nul(c, k, klen, have_nul);
if (have_nul)
break;
k += 4;
k += UINTSZ;
assert (klen >= UINTSZ);
klen -= UINTSZ;
jhash_mix(a, b, c);
}

View File

@@ -1,5 +1,5 @@
/* Implicit rule searching for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -152,6 +152,7 @@ struct patdeps
const char *pattern;
struct file *file;
unsigned int ignore_mtime : 1;
unsigned int ignore_automatic_vars : 1;
};
/* This structure stores information about pattern rules that we need
@@ -220,8 +221,9 @@ pattern_search (struct file *file, int archive,
struct patdeps *deplist = xmalloc (max_deps * sizeof (struct patdeps));
struct patdeps *pat = deplist;
/* Names of possible dependencies are constructed in this buffer. */
char *depname = alloca (namelen + max_pattern_dep_length);
/* Names of possible dependencies are constructed in this buffer.
We may replace % by $(*F) for second expansion, increasing the length. */
char *depname = alloca (namelen + max_pattern_dep_length + 4);
/* The start and length of the stem of FILENAME for the current rule. */
const char *stem = 0;
@@ -265,7 +267,7 @@ pattern_search (struct file *file, int archive,
/* Set LASTSLASH to point at the last slash in FILENAME
but not counting any slash at the end. (foo/bar/ counts as
bar/ in directory foo/, not empty in directory foo/bar/.) */
lastslash = strrchr (filename, '/');
lastslash = memrchr (filename, '/', namelen - 1);
#ifdef VMS
if (lastslash == NULL)
lastslash = strrchr (filename, ']');
@@ -278,18 +280,16 @@ pattern_search (struct file *file, int archive,
/* Handle backslashes (possibly mixed with forward slashes)
and the case of "d:file". */
{
char *bslash = strrchr (filename, '\\');
char *bslash = memrchr (filename, '\\', namelen - 1);
if (lastslash == 0 || bslash > lastslash)
lastslash = bslash;
if (lastslash == 0 && filename[0] && filename[1] == ':')
lastslash = filename + 1;
}
#endif
if (lastslash != 0 && lastslash[1] == '\0')
lastslash = 0;
}
pathlen = lastslash - filename + 1;
pathlen = lastslash ? lastslash - filename + 1 : 0;
/* First see which pattern rules match this target and may be considered.
Put them in TRYRULES. */
@@ -443,7 +443,6 @@ pattern_search (struct file *file, int archive,
unsigned int deps_found = 0;
/* NPTR points to the part of the prereq we haven't processed. */
const char *nptr = 0;
const char *dir = NULL;
int order_only = 0;
unsigned int matches;
@@ -478,12 +477,12 @@ pattern_search (struct file *file, int archive,
memcpy (pathdir, filename, pathlen);
pathdir[pathlen] = '\0';
}
dir = pathdir;
}
if (stemlen > GET_PATH_MAX)
if (stemlen + (check_lastslash ? pathlen : 0) > GET_PATH_MAX)
{
DBS (DB_IMPLICIT, (_("Stem too long: '%.*s'.\n"),
DBS (DB_IMPLICIT, (_("Stem too long: '%s%.*s'.\n"),
check_lastslash ? pathdir : "",
(int) stemlen, stem));
continue;
}
@@ -491,8 +490,19 @@ pattern_search (struct file *file, int archive,
DBS (DB_IMPLICIT, (_("Trying pattern rule with stem '%.*s'.\n"),
(int) stemlen, stem));
strncpy (stem_str, stem, stemlen);
stem_str[stemlen] = '\0';
if (!check_lastslash)
{
memcpy (stem_str, stem, stemlen);
stem_str[stemlen] = '\0';
}
else
{
/* We want to prepend the directory from
the original FILENAME onto the stem. */
memcpy (stem_str, filename, pathlen);
memcpy (stem_str + pathlen, stem, stemlen);
stem_str[pathlen + stemlen] = '\0';
}
/* If there are no prerequisites, then this rule matches. */
if (rule->deps == 0)
@@ -543,18 +553,19 @@ pattern_search (struct file *file, int archive,
}
memcpy (o, nptr, p - nptr);
o += p - nptr;
memcpy (o, stem_str, stemlen);
memcpy (o, stem, stemlen);
o += stemlen;
strcpy (o, p + 1);
}
/* Parse the expanded string. It might have wildcards. */
p = depname;
dl = PARSE_SIMPLE_SEQ (&p, struct dep);
dl = PARSE_FILE_SEQ (&p, struct dep, MAP_NUL, NULL, PARSEFS_ONEWORD);
for (d = dl; d != NULL; d = d->next)
{
++deps_found;
d->ignore_mtime = dep->ignore_mtime;
d->ignore_automatic_vars = dep->ignore_automatic_vars;
}
/* We've used up this dep, so next time get a new one. */
@@ -594,10 +605,10 @@ pattern_search (struct file *file, int archive,
again. This is not good if you have certain characters
in your stem (like $).
Instead, we will replace % with $* and allow the second
expansion to take care of it for us. This way (since $*
is a simple variable) there won't be additional
re-expansion of the stem. */
Instead, we will replace % with $* or $(*F) and allow the
second expansion to take care of it for us. This way
(since $* and $(*F) are simple variables) there won't be
additional re-expansion of the stem. */
p = lindex (nptr, nptr + len, '%');
if (p == 0)
@@ -608,13 +619,22 @@ pattern_search (struct file *file, int archive,
else
{
size_t i = p - nptr;
memcpy (depname, nptr, i);
memcpy (depname + i, "$*", 2);
memcpy (depname + i + 2, p + 1, len - i - 1);
depname[len + 2 - 1] = '\0';
char *o = depname;
memcpy (o, nptr, i);
o += i;
if (check_lastslash)
add_dir = 1;
{
add_dir = 1;
memcpy (o, "$(*F)", 5);
o += 5;
}
else
{
memcpy (o, "$*", 2);
o += 2;
}
memcpy (o, p + 1, len - i - 1);
o[len - i - 1] = '\0';
}
/* Set up for the next word. */
@@ -646,7 +666,7 @@ pattern_search (struct file *file, int archive,
/* Parse the expanded string. */
struct dep *dp = PARSE_FILE_SEQ (&p, struct dep,
order_only ? MAP_NUL : MAP_PIPE,
add_dir ? dir : NULL, PARSEFS_NONE);
add_dir ? pathdir : NULL, PARSEFS_NONE);
*dptr = dp;
for (d = dp; d != NULL; d = d->next)
@@ -705,6 +725,7 @@ pattern_search (struct file *file, int archive,
memset (pat, '\0', sizeof (struct patdeps));
pat->ignore_mtime = d->ignore_mtime;
pat->ignore_automatic_vars = d->ignore_automatic_vars;
DBS (DB_IMPLICIT,
(is_rule
@@ -895,6 +916,7 @@ pattern_search (struct file *file, int archive,
dep = alloc_dep ();
dep->ignore_mtime = pat->ignore_mtime;
dep->ignore_automatic_vars = pat->ignore_automatic_vars;
s = strcache_add (pat->name);
if (recursions)
dep->name = s;
@@ -931,17 +953,13 @@ pattern_search (struct file *file, int archive,
}
else
{
size_t dirlen = (lastslash + 1) - filename;
char *sp;
/* We want to prepend the directory from
the original FILENAME onto the stem. */
fullstemlen = dirlen + stemlen;
sp = alloca (fullstemlen + 1);
memcpy (sp, filename, dirlen);
memcpy (sp + dirlen, stem, stemlen);
sp[fullstemlen] = '\0';
file->stem = strcache_add (sp);
fullstemlen = pathlen + stemlen;
memcpy (stem_str, filename, pathlen);
memcpy (stem_str + pathlen, stem, stemlen);
stem_str[fullstemlen] = '\0';
file->stem = strcache_add (stem_str);
}
file->cmds = rule->cmds;

199
src/job.c
View File

@@ -1,5 +1,5 @@
/* Job execution and handling for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -17,6 +17,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h"
#include <assert.h>
#include <string.h>
#include "job.h"
#include "debug.h"
@@ -25,8 +26,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "variable.h"
#include "os.h"
#include <string.h>
/* Default shell to use. */
#ifdef WINDOWS32
# ifdef HAVE_STRINGS_H
@@ -139,6 +138,7 @@ extern int wait3 ();
#ifdef USE_POSIX_SPAWN
# include <spawn.h>
# include "findprog.h"
#endif
#if !defined (wait) && !defined (POSIX)
@@ -557,11 +557,8 @@ child_error (struct child *child,
nm = _("<builtin>");
else
{
/* We can't use the standard <FILE>:<LINENO> syntax here because
Emacs misinterprets it and matches a bogus filename in the compile
buffer. */
char *a = alloca (strlen (flocp->filenm) + 6 + INTSTR_LENGTH + 1);
sprintf (a, "%s;%lu", flocp->filenm, flocp->lineno + flocp->offset);
sprintf (a, "%s:%lu", flocp->filenm, flocp->lineno + flocp->offset);
nm = a;
}
@@ -724,7 +721,9 @@ reap_children (int block, int err)
else if (pid < 0)
{
/* A remote status command failed miserably. Punt. */
#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)
remote_status_lose:
#endif
pfatal_with_name ("remote_status");
}
else
@@ -905,6 +904,36 @@ reap_children (int block, int err)
--job_counter;
process_child:
#if defined(USE_POSIX_SPAWN)
/* Some versions of posix_spawn() do not detect errors such as command
not found until after they fork. In that case they will exit with a
code of 127. Try to detect that and provide a useful error message.
Otherwise we'll just show the error below, as normal. */
if (exit_sig == 0 && exit_code == 127 && c->cmd_name)
{
const char *e = NULL;
struct stat st;
int r;
/* There are various ways that this will show a different error than
fork/exec. To really get the right error we'd have to fall back
to fork/exec but I don't want to bother with that. Just do the
best we can. */
EINTRLOOP(r, stat(c->cmd_name, &st));
if (r < 0)
e = strerror (errno);
else if (S_ISDIR(st.st_mode) || !(st.st_mode & S_IXUSR))
e = strerror (EACCES);
else if (st.st_size == 0)
e = strerror (ENOEXEC);
if (e)
OSS(error, NILF, "%s: %s", c->cmd_name, e);
}
#endif
/* Determine the failure status: 0 for success, 1 for updating target in
question mode, 2 for anything else. */
if (exit_sig == 0 && exit_code == 0)
@@ -1041,12 +1070,12 @@ reap_children (int block, int err)
{
DB (DB_JOBS, (_("Removing child %p PID %s%s from chain.\n"),
c, pid2str (c->pid), c->remote ? _(" (remote)") : ""));
/* There is now another slot open. */
if (job_slots_used > 0)
--job_slots_used;
}
/* There is now another slot open. */
if (job_slots_used > 0)
job_slots_used -= c->jobslot;
/* Remove the child from the chain and free it. */
if (lastc == 0)
children = c->next;
@@ -1113,6 +1142,7 @@ free_child (struct child *child)
free (child->environment);
}
free (child->cmd_name);
free (child);
}
@@ -1207,12 +1237,11 @@ start_job_command (struct child *child)
}
argv = p;
/* Although construct_command_argv contains some code for VMS, it was/is
not called/used. Please note, for VMS argv is a string (not an array
of strings) which contains the complete command line, which for
multi-line variables still includes the newlines. So detect newlines
and set 'end' (which is used for child->command_ptr) instead of
(re-)writing construct_command_argv */
/* Please note, for VMS argv is a string (not an array of strings) which
contains the complete command line, which for multi-line variables
still includes the newlines. So detect newlines and set 'end' (which
is used for child->command_ptr) instead of (re-)writing
construct_command_argv */
if (!one_shell)
{
char *s = p;
@@ -1420,8 +1449,7 @@ start_job_command (struct child *child)
child->remote = 0;
#ifdef VMS
if (!child_execute_job (child, argv))
child->pid = -1;
child->pid = child_execute_job ((struct childbase *)child, 1, argv);
#else
@@ -1429,11 +1457,12 @@ start_job_command (struct child *child)
jobserver_pre_child (flags & COMMANDS_RECURSE);
child->pid = child_execute_job (&child->output, child->good_stdin,
argv, child->environment);
child->pid = child_execute_job ((struct childbase *)child,
child->good_stdin, argv);
environ = parent_environ; /* Restore value child may have clobbered. */
jobserver_post_child (flags & COMMANDS_RECURSE);
#endif /* !VMS */
}
@@ -1615,6 +1644,8 @@ start_waiting_job (struct child *c)
c->remote ? _(" (remote)") : ""));
/* One more job slot is in use. */
++job_slots_used;
assert (c->jobslot == 0);
c->jobslot = 1;
}
children = c;
unblock_sigs ();
@@ -1977,7 +2008,18 @@ load_too_high (void)
#else
static double last_sec;
static time_t last_now;
static int proc_fd = -2;
/* This is disabled by default for now, because it will behave badly if the
user gives a value > the number of cores; in that situation the load will
never be exceeded, this function always returns false, and we'll start
all the jobs. Also, it's not quite right to limit jobs to the number of
cores not busy since a job takes some time to start etc. Maybe that's
OK, I'm not sure exactly how to handle that, but for sure we need to
clamp this value at the number of cores before this can be enabled.
*/
#define PROC_FD_INIT -1
static int proc_fd = PROC_FD_INIT;
double load, guess;
time_t now;
@@ -2128,7 +2170,7 @@ start_waiting_jobs (void)
/* EMX: Start a child process. This function returns the new pid. */
# if defined __EMX__
pid_t
child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
child_execute_job (struct childbase *child, int good_stdin, char **argv)
{
pid_t pid;
int fdin = good_stdin ? FD_STDIN : get_bad_stdin ();
@@ -2139,12 +2181,12 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
int save_fderr = -1;
/* Divert child output if we want to capture output. */
if (out && out->syncout)
if (child->output.syncout)
{
if (out->out >= 0)
fdout = out->out;
if (out->err >= 0)
fderr = out->err;
if (child->output.out >= 0)
fdout = child->output.out;
if (child->output.err >= 0)
fderr = child->output.err;
}
/* For each FD which needs to be redirected first make a dup of the standard
@@ -2190,7 +2232,7 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
}
/* Run the command. */
pid = exec_command (argv, envp);
pid = exec_command (argv, child->environment);
/* Restore stdout/stdin/stderr of the parent and close temporary FDs. */
if (save_fdin >= 0)
@@ -2227,9 +2269,9 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
/* POSIX:
Create a child process executing the command in ARGV.
ENVP is the environment of the new program. Returns the PID or -1. */
Returns the PID or -1. */
pid_t
child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
child_execute_job (struct childbase *child, int good_stdin, char **argv)
{
const int fdin = good_stdin ? FD_STDIN : get_bad_stdin ();
int fdout = FD_STDOUT;
@@ -2237,18 +2279,19 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
pid_t pid;
int r;
#if defined(USE_POSIX_SPAWN)
short flags = 0;
char *cmd;
posix_spawnattr_t attr;
posix_spawn_file_actions_t fa;
short flags = 0;
#endif
/* Divert child output if we want to capture it. */
if (out && out->syncout)
if (child->output.syncout)
{
if (out->out >= 0)
fdout = out->out;
if (out->err >= 0)
fderr = out->err;
if (child->output.out >= 0)
fdout = child->output.out;
if (child->output.err >= 0)
fderr = child->output.err;
}
#if !defined(USE_POSIX_SPAWN)
@@ -2276,9 +2319,9 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
EINTRLOOP (r, dup2 (fderr, FD_STDERR));
/* Run the command. */
exec_command (argv, envp);
exec_command (argv, child->environment);
#else /* use posix_spawn() */
#else /* USE_POSIX_SPAWN */
if ((r = posix_spawnattr_init (&attr)) != 0)
goto done;
@@ -2306,10 +2349,6 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
flags |= POSIX_SPAWN_USEVFORK;
#endif
#ifdef SET_STACK_SIZE
/* No support for resetting the stack limit with posix_spawn(). */
#endif
/* For any redirected FD, dup2() it to the standard FD.
They are all marked close-on-exec already. */
if (fdin >= 0 && fdin != FD_STDIN)
@@ -2329,10 +2368,67 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
if ((r = posix_spawnattr_setflags (&attr, flags)) != 0)
goto cleanup;
/* Look up the program on the child's PATH, if needed. */
{
const char *p = NULL;
char **pp;
for (pp = child->environment; *pp != NULL; ++pp)
if ((*pp)[0] == 'P' && (*pp)[1] == 'A' && (*pp)[2] == 'T'
&& (*pp)[3] == 'H' &&(*pp)[4] == '=')
{
p = (*pp) + 5;
break;
}
cmd = (char *)find_in_given_path (argv[0], p, 0);
}
if (!cmd)
{
r = errno;
goto cleanup;
}
/* Start the program. */
while ((r = posix_spawnp (&pid, argv[0], &fa, &attr, argv, envp)) == EINTR)
while ((r = posix_spawn (&pid, cmd, &fa, &attr, argv,
child->environment)) == EINTR)
;
/* posix_spawn() doesn't provide sh fallback like exec() does; implement
it here. POSIX doesn't specify the path to sh so use the default. */
if (r == ENOEXEC)
{
char **nargv;
char **pp;
size_t l = 0;
for (pp = argv; *pp != NULL; ++pp)
++l;
nargv = xmalloc (sizeof (char *) * (l + 3));
nargv[0] = (char *)default_shell;
nargv[1] = cmd;
memcpy (&nargv[2], &argv[1], sizeof (char *) * l);
while ((r = posix_spawn (&pid, nargv[0], &fa, &attr, nargv,
child->environment)) == EINTR)
;
free (nargv);
}
if (r == 0)
{
/* Spawn succeeded but may fail later: remember the command. */
free (child->cmd_name);
if (cmd != argv[0])
child->cmd_name = cmd;
else
child->cmd_name = xstrdup(cmd);
}
cleanup:
posix_spawn_file_actions_destroy (&fa);
posix_spawnattr_destroy (&attr);
@@ -2341,7 +2437,7 @@ child_execute_job (struct output *out, int good_stdin, char **argv, char **envp)
if (r != 0)
pid = -1;
#endif /* have posix_spawn() */
#endif /* USE_POSIX_SPAWN */
if (pid < 0)
OSS (error, NILF, "%s: %s", argv[0], strerror (r));
@@ -2662,7 +2758,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
can handle quoted file names just fine, removing the quote lifts
the limit from a very frequent use case, because using quoted
file names is commonplace on MS-Windows. */
static const char *sh_chars_dos = "|&<>%";
static const char *sh_chars_dos = "|&<>";
static const char *sh_cmds_dos[] =
{ "assoc", "break", "call", "cd", "chcp", "chdir", "cls", "color", "copy",
"ctty", "date", "del", "dir", "echo", "echo.", "endlocal", "erase",
@@ -2689,9 +2785,10 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
#else /* must be UNIX-ish */
static const char *sh_chars = "#;\"*?[]&|<>(){}$`^~!";
static const char *sh_cmds[] =
{ ".", ":", "break", "case", "cd", "command", "continue", "eval", "exec",
"exit", "export", "for", "if", "login", "logout", "read", "readonly",
"set", "shift", "switch", "test", "times", "trap", "ulimit", "umask",
{ ".", ":", "alias", "bg", "break", "case", "cd", "command", "continue",
"eval", "exec", "exit", "export", "fc", "fg", "for", "getopts", "hash",
"if", "jobs", "login", "logout", "read", "readonly", "return", "set",
"shift", "test", "times", "trap", "type", "ulimit", "umask", "unalias",
"unset", "wait", "while", 0 };
# ifdef HAVE_DOS_PATHS
@@ -2863,9 +2960,9 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
else if (instring == '"' && strchr ("\\$`", *p) != 0 && unixy_shell)
goto slow;
#ifdef WINDOWS32
/* Quoted wildcard and % characters must be passed quoted to the
/* Quoted wildcard characters must be passed quoted to the
command, so give up the fast route. */
else if (instring == '"' && strchr ("*?%", *p) != 0 && !unixy_shell)
else if (instring == '"' && strchr ("*?", *p) != 0 && !unixy_shell)
goto slow;
else if (instring == '"' && strncmp (p, "\\\"", 2) == 0)
*ap++ = *++p;

View File

@@ -1,5 +1,5 @@
/* Definitions for managing subprocesses in GNU Make.
Copyright (C) 1992-2019 Free Software Foundation, Inc.
Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -18,35 +18,50 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Structure describing a running or dead child process. */
#ifdef VMS
#define VMSCHILD \
char *comname; /* Temporary command file name */ \
int efn; /* Completion event flag number */ \
int cstatus; /* Completion status */ \
int vms_launch_status; /* non-zero if lib$spawn, etc failed */
#else
#define VMSCHILD
#endif
#define CHILDBASE \
char *cmd_name; /* Alloced copy of command run. */ \
char **environment; /* Environment for commands. */ \
VMSCHILD \
struct output output /* Output for this child. */
struct childbase
{
CHILDBASE;
};
struct child
{
CHILDBASE;
struct child *next; /* Link in the chain. */
struct file *file; /* File being remade. */
char **environment; /* Environment for commands. */
char *sh_batch_file; /* Script file for shell commands */
char **command_lines; /* Array of variable-expanded cmd lines. */
char *command_ptr; /* Ptr into command_lines[command_line]. */
struct output output; /* Output for this child. */
#ifdef VMS
char *comname; /* Temporary command file name */
int efn; /* Completion event flag number */
int cstatus; /* Completion status */
int vms_launch_status; /* non-zero if lib$spawn, etc failed */
#endif
unsigned int command_line; /* Index into command_lines. */
pid_t pid; /* Child process's ID number. */
pid_t pid; /* Child process's ID number. */
unsigned int remote:1; /* Nonzero if executing remotely. */
unsigned int noerror:1; /* Nonzero if commands contained a '-'. */
unsigned int good_stdin:1; /* Nonzero if this child has a good stdin. */
unsigned int deleted:1; /* Nonzero if targets have been deleted. */
unsigned int recursive:1; /* Nonzero for recursive command ('+' etc.) */
unsigned int jobslot:1; /* Nonzero if it's reserved a job slot. */
unsigned int dontcare:1; /* Saved dontcare flag. */
};
@@ -62,19 +77,14 @@ void start_waiting_jobs (void);
char **construct_command_argv (char *line, char **restp, struct file *file,
int cmd_flags, char** batch_file);
#ifdef VMS
int child_execute_job (struct child *child, char *argv);
#else
pid_t child_execute_job (struct output *out, int good_stdin,
char **argv, char **envp);
#endif
pid_t child_execute_job (struct childbase *child, int good_stdin, char **argv);
#ifdef _AMIGA
void exec_command (char **argv) __attribute__ ((noreturn));
void exec_command (char **argv) NORETURN;
#elif defined(__EMX__)
int exec_command (char **argv, char **envp);
#else
void exec_command (char **argv, char **envp) __attribute__ ((noreturn));
void exec_command (char **argv, char **envp) NORETURN;
#endif
void unblock_all_sigs (void);

View File

@@ -1,5 +1,5 @@
/* Loading dynamic objects for GNU Make.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* API for GNU Make dynamic objects.
Copyright (C) 2013-2019 Free Software Foundation, Inc.
Copyright (C) 2013-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Argument parsing and main program of GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -96,7 +96,7 @@ int chdir ();
#endif
#ifndef STDC_HEADERS
# ifndef sun /* Sun has an incorrect decl in a header. */
void exit (int) __attribute__ ((noreturn));
void exit (int) NORETURN;
# endif
double atof ();
#endif
@@ -1313,7 +1313,7 @@ main (int argc, char **argv, char **envp)
{
const char *features = "target-specific order-only second-expansion"
" else-if shortest-stem undefine oneshell nocomment"
" grouped-target"
" grouped-target extra-prereqs"
#ifndef NO_ARCHIVES
" archives"
#endif
@@ -2134,9 +2134,9 @@ main (int argc, char **argv, char **envp)
install_default_implicit_rules ();
/* Compute implicit rule limits. */
/* Compute implicit rule limits and do magic for pattern rules. */
count_implicit_rule_limits ();
snap_implicit_rules ();
/* Construct the listings of directories in VPATH lists. */
@@ -2469,7 +2469,12 @@ main (int argc, char **argv, char **envp)
termination. */
pid_t pid;
int r;
pid = child_execute_job (NULL, 1, nargv, environ);
struct childbase child;
child.cmd_name = NULL;
child.output.syncout = 0;
child.environment = environ;
pid = child_execute_job (&child, 1, nargv);
/* is this loop really necessary? */
do {
@@ -2639,8 +2644,8 @@ init_switches (void)
for (i = 0; switches[i].c != '\0'; ++i)
{
long_options[i].name = (switches[i].long_name == 0 ? "" :
switches[i].long_name);
long_options[i].name = (char *) (switches[i].long_name == 0 ? "" :
switches[i].long_name);
long_options[i].flag = 0;
long_options[i].val = switches[i].c;
if (short_option (switches[i].c))
@@ -3365,7 +3370,7 @@ print_version (void)
year, and none of the rest of it should be translated (including the
word "Copyright"), so it hardly seems worth it. */
printf ("%sCopyright (C) 1988-2019 Free Software Foundation, Inc.\n",
printf ("%sCopyright (C) 1988-2020 Free Software Foundation, Inc.\n",
precede);
printf (_("%sLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\

View File

@@ -1,5 +1,5 @@
/* Miscellaneous global declarations and portability cruft for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -220,19 +220,22 @@ extern int vms_legacy_behavior;
extern int vms_unix_simulation;
#endif
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(x)
# endif
#if !defined(__attribute__) && (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__)
/* Don't use __attribute__ if it's not supported. */
# define ATTRIBUTE(x)
#else
# define ATTRIBUTE(x) __attribute__ (x)
#endif
/* The __-protected variants of 'format' and 'printf' attributes
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
# endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
#endif
#define UNUSED __attribute__ ((unused))
#define UNUSED ATTRIBUTE ((unused))
#define NORETURN ATTRIBUTE ((noreturn))
#if defined (STDC_HEADERS) || defined (__GNU_LIBRARY__)
# include <stdlib.h>
@@ -255,8 +258,8 @@ void *malloc (int);
void *realloc (void *, int);
void free (void *);
void abort (void) __attribute__ ((noreturn));
void exit (int) __attribute__ ((noreturn));
void abort (void) NORETURN;
void exit (int) NORETURN;
# endif /* HAVE_STDLIB_H. */
#endif /* Standard headers. */
@@ -292,12 +295,9 @@ char *strerror (int errnum);
char *strsignal (int signum);
#endif
#if defined(HAVE_UMASK)
# define UMASK(_m) umask (_m)
# define MODE_T mode_t
#else
# define UMASK(_m) 0
# define MODE_T int
#if !defined(HAVE_UMASK)
typedef int mode_t;
extern mode_t umask (mode_t);
#endif
/* ISDIGIT offers the following features:
@@ -330,7 +330,7 @@ char *strsignal (int signum);
#define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0)
#if defined(__GNUC__) || defined(ENUM_BITFIELDS)
#if defined(ENUM_BITFIELDS) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
# define ENUM_BITFIELD(bits) :bits
#else
# define ENUM_BITFIELD(bits)
@@ -451,7 +451,8 @@ extern int unixy_shell;
#define NEXT_TOKEN(s) while (ISSPACE (*(s))) ++(s)
#define END_OF_TOKEN(s) while (! STOP_SET (*(s), MAP_SPACE|MAP_NUL)) ++(s)
#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
/* We can't run setrlimit when using posix_spawn. */
#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && !defined(USE_POSIX_SPAWN)
# define SET_STACK_SIZE
#endif
#ifdef SET_STACK_SIZE
@@ -488,12 +489,12 @@ typedef struct
const char *concat (unsigned int, ...);
void message (int prefix, size_t length, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
ATTRIBUTE ((__format__ (__printf__, 3, 4)));
void error (const floc *flocp, size_t length, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
ATTRIBUTE ((__format__ (__printf__, 3, 4)));
void fatal (const floc *flocp, size_t length, const char *fmt, ...)
__attribute__ ((noreturn, __format__ (__printf__, 3, 4)));
void out_of_memory () __attribute__((noreturn));
ATTRIBUTE ((noreturn, __format__ (__printf__, 3, 4)));
void out_of_memory () NORETURN;
/* When adding macros to this list be sure to update the value of
XGETTEXT_OPTIONS in the po/Makevars file. */
@@ -511,8 +512,8 @@ void out_of_memory () __attribute__((noreturn));
#define ONS(_t,_a,_f,_n,_s) _t((_a), INTSTR_LENGTH + strlen (_s), \
(_f), (_n), (_s))
void die (int) __attribute__ ((noreturn));
void pfatal_with_name (const char *) __attribute__ ((noreturn));
void die (int) NORETURN;
void pfatal_with_name (const char *) NORETURN;
void perror_with_name (const char *, const char *);
#define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s))
void *xmalloc (size_t);
@@ -530,8 +531,12 @@ void print_spaces (unsigned int);
char *find_percent (char *);
const char *find_percent_cached (const char **);
FILE *get_tmpfile (char **, const char *);
ssize_t writebuf (int, const void*, size_t);
ssize_t readbuf (int, void*, size_t);
ssize_t writebuf (int, const void *, size_t);
ssize_t readbuf (int, void *, size_t);
#ifndef HAVE_MEMRCHR
void *memrchr(const void *, int, size_t);
#endif
#ifndef NO_ARCHIVES
int ar_name (const char *);

View File

@@ -1,5 +1,5 @@
/* Miscellaneous generic support functions for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -24,6 +24,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdarg.h>
#ifdef WINDOWS32
# include <windows.h>
# include <io.h>
#endif
@@ -260,6 +261,30 @@ xstrndup (const char *str, size_t length)
return result;
}
#ifndef HAVE_MEMRCHR
void *
memrchr(const void* str, int ch, size_t len)
{
const char* sp = str;
const char* cp = sp;
if (len == 0)
return NULL;
cp += len - 1;
while (cp[0] != ch)
{
if (cp == sp)
return NULL;
--cp;
}
return (void*)cp;
}
#endif
/* Limited INDEX:
@@ -407,7 +432,8 @@ free_ns_chain (struct nameseq *ns)
#ifdef MAKE_MAINTAINER_MODE
void spin(const char* type)
void
spin (const char* type)
{
char filenm[256];
struct stat dummy;
@@ -418,7 +444,11 @@ void spin(const char* type)
{
fprintf (stderr, "SPIN on %s\n", filenm);
do
#ifdef WINDOWS32
Sleep (1000);
#else
sleep (1);
#endif
while (stat (filenm, &dummy) == 0);
}
}
@@ -437,6 +467,14 @@ char *mktemp (char *template);
# endif
#endif
#ifndef HAVE_UMASK
mode_t
umask (mode_t mask)
{
return 0;
}
#endif
FILE *
get_tmpfile (char **name, const char *template)
{
@@ -446,7 +484,7 @@ get_tmpfile (char **name, const char *template)
#endif
/* Preserve the current umask, and set a restrictive one for temp files. */
MODE_T mask = UMASK (0077);
mode_t mask = umask (0077);
#if defined(HAVE_MKSTEMP) || defined(HAVE_MKTEMP)
# define TEMPLATE_LEN strlen (template)
@@ -482,7 +520,7 @@ get_tmpfile (char **name, const char *template)
# endif
#endif
UMASK (mask);
umask (mask);
return file;
}

View File

@@ -1,5 +1,5 @@
/* Declarations for operating system interfaces for GNU Make.
Copyright (C) 2016-2019 Free Software Foundation, Inc.
Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Output to stdout / stderr for GNU make
Copyright (C) 2013-2019 Free Software Foundation, Inc.
Copyright (C) 2013-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -281,7 +281,7 @@ release_semaphore (void *sem)
int
output_tmpfd (void)
{
MODE_T mask = UMASK (0077);
mode_t mask = umask (0077);
int fd = -1;
FILE *tfile = tmpfile ();
@@ -297,7 +297,7 @@ output_tmpfd (void)
set_append_mode (fd);
UMASK (mask);
umask (mask);
return fd;
}

View File

@@ -1,5 +1,5 @@
/* Output to stdout / stderr for GNU make
Copyright (C) 2013-2019 Free Software Foundation, Inc.
Copyright (C) 2013-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* POSIX-based operating system interface for GNU Make.
Copyright (C) 2016-2019 Free Software Foundation, Inc.
Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Reading and parsing of makefiles for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -1395,14 +1395,7 @@ eval (struct ebuffer *ebuf, int set_default)
}
}
}
continue;
}
/* We get here except in the case that we just read a rule line.
Record now the last rule we read, so following spurious
commands are properly diagnosed. */
record_waiting_files ();
}
#undef word1eq
@@ -2836,9 +2829,9 @@ get_next_mword (char *buffer, char **startp, size_t *length)
/* A word CAN include a colon in its drive spec. The drive
spec is allowed either at the beginning of a word, or as part
of the archive member name, like in "libfoo.a(d:/foo/bar.o)". */
if (!(p - beg >= 2
&& (*p == '/' || *p == '\\') && isalpha ((unsigned char)p[-2])
&& (p - beg == 2 || p[-3] == '(')))
if ((p - beg == 2 || (p - beg > 2 && p[-3] == '('))
&& isalpha ((unsigned char)p[-2]))
break;
#endif
goto done_word;
@@ -3145,7 +3138,10 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
char *p;
glob_t gl;
char *tp;
int findmap = stopmap|MAP_VMSCOMMA|MAP_BLANK|MAP_NUL;
int findmap = stopmap|MAP_VMSCOMMA|MAP_NUL;
if (NONE_SET (flags, PARSEFS_ONEWORD))
findmap |= MAP_BLANK;
/* Always stop on NUL. */
stopmap |= MAP_NUL;
@@ -3182,7 +3178,7 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
#endif
char *s;
size_t nlen;
int i;
int tot, i;
/* Skip whitespace; at the end of the string or STOPCHAR we're done. */
NEXT_TOKEN (p);
@@ -3391,7 +3387,7 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
if (NONE_SET (flags, PARSEFS_EXISTS) && strpbrk (name, "?*[") == NULL)
{
globme = 0;
i = 1;
tot = 1;
nlist = &name;
}
else
@@ -3402,7 +3398,7 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
case 0:
/* Success. */
i = gl.gl_pathc;
tot = gl.gl_pathc;
nlist = (const char **)gl.gl_pathv;
break;
@@ -3410,20 +3406,20 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
/* If we want only existing items, skip this one. */
if (ANY_SET (flags, PARSEFS_EXISTS))
{
i = 0;
tot = 0;
break;
}
/* FALLTHROUGH */
default:
/* By default keep this name. */
i = 1;
tot = 1;
nlist = &name;
break;
}
/* For each matched element, add it to the list. */
while (i-- > 0)
for (i = 0; i < tot; ++i)
#ifndef NO_ARCHIVES
if (memname != 0)
{

View File

@@ -1,5 +1,5 @@
/* Basic dependency engine for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -3,7 +3,7 @@
Please do not send bug reports or questions about it to
the Make maintainers.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Template for the remote job exportation interface to GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Pattern and suffix rule internals for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -60,29 +60,38 @@ struct file *suffix_file;
static size_t maxsuffix;
/* Compute the maximum dependency length and maximum number of
dependencies of all implicit rules. Also sets the subdir
flag for a rule when appropriate, possibly removing the rule
completely when appropriate. */
/* Compute the maximum dependency length and maximum number of dependencies of
all implicit rules. Also sets the subdir flag for a rule when appropriate,
possibly removing the rule completely when appropriate.
Add any global EXTRA_PREREQS here as well. */
void
count_implicit_rule_limits (void)
snap_implicit_rules (void)
{
char *name;
size_t namelen;
char *name = NULL;
size_t namelen = 0;
struct rule *rule;
struct dep *dep;
struct dep *prereqs = expand_extra_prereqs (lookup_variable (STRING_SIZE_TUPLE(".EXTRA_PREREQS")));
unsigned int pre_deps = 0;
num_pattern_rules = max_pattern_targets = max_pattern_deps = 0;
max_pattern_dep_length = 0;
name = 0;
namelen = 0;
rule = pattern_rules;
while (rule != 0)
for (dep = prereqs; dep; dep = dep->next)
{
unsigned int ndeps = 0;
struct dep *dep;
struct rule *next = rule->next;
size_t l = strlen (dep_name (dep));
if (l > max_pattern_dep_length)
max_pattern_dep_length = l;
++pre_deps;
}
num_pattern_rules = max_pattern_targets = max_pattern_deps = 0;
for (rule = pattern_rules; rule; rule = rule->next)
{
unsigned int ndeps = pre_deps;
struct dep *lastdep = NULL;
++num_pattern_rules;
@@ -99,17 +108,20 @@ count_implicit_rule_limits (void)
const char *p2;
if (p == 0)
p = strrchr (dname, ':');
p2 = p != 0 ? strchr (dname, '%') : 0;
p2 = p ? strchr (p, '%') : 0;
#else
const char *p = strrchr (dname, '/');
const char *p2 = p != 0 ? strchr (dname, '%') : 0;
const char *p2 = p ? strchr (p, '%') : 0;
#endif
ndeps++;
if (len > max_pattern_dep_length)
max_pattern_dep_length = len;
if (p != 0 && p2 > p)
if (!dep->next)
lastdep = dep;
if (p2)
{
/* There is a slash before the % in the dep name.
Extract the directory name. */
@@ -134,13 +146,20 @@ count_implicit_rule_limits (void)
dep->changed = 0;
}
if (prereqs)
{
if (lastdep)
lastdep->next = copy_dep_chain (prereqs);
else
rule->deps = copy_dep_chain (prereqs);
}
if (ndeps > max_pattern_deps)
max_pattern_deps = ndeps;
rule = next;
}
free (name);
free_dep_chain (prereqs);
}
/* Create a pattern rule from a suffix rule.
@@ -253,11 +272,23 @@ convert_to_pattern (void)
memcpy (rulename + slen, dep_name (d2), s2len + 1);
f = lookup_file (rulename);
/* No target, or no commands, or it has deps: it can't be a
suffix rule. */
if (f == 0 || f->cmds == 0 || f->deps != 0)
/* No target, or no commands: it can't be a suffix rule. */
if (f == 0 || f->cmds == 0)
continue;
/* POSIX says that suffix rules can't have prerequisites.
In POSIX mode, don't make this a suffix rule. Previous versions
of GNU make did treat this as a suffix rule and ignored the
prerequisites, which is bad. In the future we'll do the same as
POSIX, but for now preserve the old behavior and warn about it. */
if (f->deps != 0)
{
if (posix_pedantic)
continue;
error (&f->cmds->fileinfo, 0,
_("warning: ignoring prerequisites on suffix rule definition"));
}
if (s2len == 2 && rulename[slen] == '.' && rulename[slen + 1] == 'a')
/* A suffix rule '.X.a:' generates the pattern rule '(%.o): %.X'.
It also generates a normal '%.a: %.X' rule below. */

View File

@@ -1,5 +1,5 @@
/* Definitions for using pattern rules in GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -48,7 +48,7 @@ extern size_t max_pattern_dep_length;
extern struct file *suffix_file;
void count_implicit_rule_limits (void);
void snap_implicit_rules (void);
void convert_to_pattern (void);
void install_pattern_rule (struct pspec *p, int terminal);
void create_pattern_rule (const char **targets, const char **target_percents,

View File

@@ -1,5 +1,5 @@
/* Convert between signal names and numbers.
Copyright (C) 1990-2019 Free Software Foundation, Inc.
Copyright (C) 1990-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Constant string caching for GNU Make.
Copyright (C) 2006-2019 Free Software Foundation, Inc.
Copyright (C) 2006-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Internals of variables for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Definitions for using variables in GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Record version and build host architecture for GNU make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -7,7 +7,7 @@
* Author: John E. Malmberg
*/
/* Copyright (C) 2014-2019 Free Software Foundation, Inc.
/* Copyright (C) 2014-2020 Free Software Foundation, Inc.
GNU Make is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software

View File

@@ -4,7 +4,7 @@
* DCL symbols.
*/
/* Copyright (C) 2014-2019 Free Software Foundation, Inc.
/* Copyright (C) 2014-2020 Free Software Foundation, Inc.
GNU Make is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software

View File

@@ -36,7 +36,7 @@
*
*/
/* Copyright (C) 2014-2019 Free Software Foundation, Inc.
/* Copyright (C) 2014-2020 Free Software Foundation, Inc.
GNU Make is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software

View File

@@ -1,5 +1,5 @@
/* dirent.h for vms
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* VMS functions
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* vmsify.c -- Module for vms <-> unix file name conversion
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,7 +1,7 @@
/* --------------- Moved here from job.c ---------------
This file must be #included in job.c, as it accesses static functions.
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -104,11 +104,12 @@ static int ctrlYPressed= 0;
inner mode level AST.
*/
static int
vmsHandleChildTerm (struct child *child)
vmsHandleChildTerm (struct childbase *cbase)
{
int exit_code;
struct child *child = (struct child*)cbase;
struct child *lastc, *c;
int child_failed;
int exit_code;
/* The child efn is 0 when a built-in or null command is executed
successfully with out actually creating a child.
@@ -803,8 +804,8 @@ build_vms_cmd (char **cmd_tokens,
return cmd_dsc;
}
int
child_execute_job (struct child *child, char *argv)
pid_t
child_execute_job (struct childbase *child, int good_stdin UNUSED, char *argv)
{
int i;
@@ -841,11 +842,10 @@ child_execute_job (struct child *child, char *argv)
/* Only a built-in or a null command - Still need to run term AST */
child->cstatus = VMS_POSIX_EXIT_MASK;
child->vms_launch_status = SS$_NORMAL;
/* TODO what is this "magic number" */
child->pid = 270163; /* Special built-in */
child->efn = 0;
vmsHandleChildTerm (child);
return 1;
/* TODO what is this "magic number" */
return 270163; /* Special built-in */
}
sprintf (procname, "GMAKE_%05x", getpid () & 0xfffff);
@@ -1162,11 +1162,9 @@ child_execute_job (struct child *child, char *argv)
free (cmd_tokens[cmd_tkn_index++]);
child->cstatus = VMS_POSIX_EXIT_MASK | (MAKE_TROUBLE << 3);
child->vms_launch_status = SS$_ABORT;
/* TODO what is this "magic number" */
child->pid = 270163; /* Special built-in */
child->efn = 0;
errno = token.cmd_errno;
return 0;
return -1;
}
/* Save any redirection to append file */
@@ -1206,21 +1204,18 @@ child_execute_job (struct child *child, char *argv)
free (cmd_dsc);
child->cstatus = VMS_POSIX_EXIT_MASK | (MAKE_TROUBLE << 3);
child->vms_launch_status = SS$_ABORT;
/* TODO what is this "magic number" */
child->pid = 270163; /* Special built-in */
child->efn = 0;
return 0;
return -1;
}
/* Only a built-in or a null command - Still need to run term AST */
free (cmd_dsc);
child->cstatus = VMS_POSIX_EXIT_MASK;
child->vms_launch_status = SS$_NORMAL;
/* TODO what is this "magic number" */
child->pid = 270163; /* Special built-in */
child->efn = 0;
vmsHandleChildTerm (child);
return 1;
/* TODO what is this "magic number" */
return 270163; /* Special built-in */
}
if (cmd_dsc->dsc$w_length > MAX_DCL_LINE_LENGTH)
@@ -1339,7 +1334,7 @@ child_execute_job (struct child *child, char *argv)
unlink (child->comname);
free (child->comname);
}
return 0;
return -1;
}
}
@@ -1465,5 +1460,6 @@ child_execute_job (struct child *child, char *argv)
}
}
return (status & 1);
/* TODO what is this "magic number" */
return (status & 1) ? 270163 : -1 ;
}

View File

@@ -1,5 +1,5 @@
/* Implementation of pattern-matching file search paths for GNU Make.
Copyright (C) 1988-2019 Free Software Foundation, Inc.
Copyright (C) 1988-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Directory entry code for Window platforms.
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -135,6 +135,13 @@ readdir(DIR* pDir)
pDir->dir_sdReturn.d_ino = (ino_t)-1;
strcpy(pDir->dir_sdReturn.d_name, wfdFindData.cFileName);
if (wfdFindData.dwFileAttributes & FILE_ATTRIBUTE_DEVICE)
pDir->dir_sdReturn.d_type = DT_CHR;
else if (wfdFindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
pDir->dir_sdReturn.d_type = DT_DIR;
else
pDir->dir_sdReturn.d_type = DT_REG;
return &pDir->dir_sdReturn;
}

View File

@@ -1,6 +1,6 @@
/* Replacements for Posix functions and Posix functionality for MS-Windows.
Copyright (C) 2013-2019 Free Software Foundation, Inc.
Copyright (C) 2013-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Windows version of dirent.h
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -33,20 +33,46 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#define __DIRENT_COOKIE 0xfefeabab
/* File types for `d_type'.
Windows only supports DT_CHR, DT_DIR, and DT_REG. */
enum
{
DT_UNKNOWN = 0,
# define DT_UNKNOWN DT_UNKNOWN
DT_FIFO = 1,
# define DT_FIFO DT_FIFO
DT_CHR = 2,
# define DT_CHR DT_CHR
DT_DIR = 4,
# define DT_DIR DT_DIR
DT_BLK = 6,
# define DT_BLK DT_BLK
DT_REG = 8,
# define DT_REG DT_REG
DT_LNK = 10,
# define DT_LNK DT_LNK
DT_SOCK = 12,
# define DT_SOCK DT_SOCK
DT_WHT = 14
# define DT_WHT DT_WHT
};
struct dirent
{
ino_t d_ino; /* unused - no equivalent on WINDOWS32 */
char d_name[NAME_MAX+1];
};
{
ino_t d_ino; /* unused - no equivalent on WINDOWS32. */
unsigned char d_type;
char d_name[NAME_MAX+1]; /* must come last due to dir.c assumptions. */
};
typedef struct dir_struct {
ULONG dir_ulCookie;
HANDLE dir_hDirHandle;
DWORD dir_nNumFiles;
char dir_pDirectoryName[NAME_MAX+1];
struct dirent dir_sdReturn;
} DIR;
typedef struct dir_struct
{
ULONG dir_ulCookie;
HANDLE dir_hDirHandle;
DWORD dir_nNumFiles;
char dir_pDirectoryName[NAME_MAX+1];
struct dirent dir_sdReturn;
} DIR;
DIR *opendir(const char *);
struct dirent *readdir(DIR *);

View File

@@ -1,5 +1,5 @@
/* dlfcn.h replacement for MS-Windows build.
Copyright (C) 2013-2019 Free Software Foundation, Inc.
Copyright (C) 2013-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,5 +1,5 @@
/* Definitions for Windows path manipulation.
Copyright (C) 1996-2019 Free Software Foundation, Inc.
Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the

Some files were not shown because too many files have changed in this diff Show More