Compare commits

...

154 Commits

Author SHA1 Message Date
Paul Smith
d66a65ad5a GNU Make release 4.4.1
* NEWS: Set the release number and date.
* configure.ac: Update the version.
* README.git: Remind to update doc/make.1.
* doc/make.1: Update the date.  Fix some "GNU Make" references.
* doc/make.texi: Update the edition.
2023-02-26 13:46:22 -05:00
Paul Smith
8093e2eee3 * tests/scripts/options/dash-l: Simplify the test via the helper
* tests/thelp.pl: Add "exist" and "noexist" operators.
2023-02-26 13:46:02 -05:00
Paul Smith
74dab224b3 * README.W32: Add Windows 11
* build_w32.bat: Ditto.
2023-02-21 20:54:48 -05:00
Paul Smith
8b8cc3a825 Use a recursive environment if any command needs it
We only create one target environment for all commands in a recipe.
Ensure it's set for recursive make if ANY command is recursive, not
just the first one.

* src/job.c (start_job_command): Check for any recursive command.
* tests/scripts/features/jobserver: Test recursion on second line.
2023-02-21 20:53:48 -05:00
Dmitry Goncharov
9b6fedef1c * src/main.c (main): Install suffix rules near pattern updates 2023-02-21 00:04:13 -05:00
Paul Smith
8ddb628927 * Makefile.am: Add mkconfig.h to the test error file 2023-02-20 23:29:26 -05:00
Dmitry Goncharov
e9dd614d73 [SV 63821] Don't set up default suffix rules if makefile sets -r
When built-in rules are disabled by adding -r to MAKEFLAGS in the
makefile, don't add suffix rules at all so that if suffixes are
added back via .SUFFIXES, the rules are still not there.

* src/main.c (main): Set default suffix rules after parsing makefiles.
* src/default.c (install_default_suffix_rules): Install a default
suffix rule only if there is no user defined rule.
* tests/scripts/features/suffixrules: Add tests.
2023-02-20 15:17:24 -05:00
Paul Smith
f5dc17ac2d * tests/scripts/misc/general4: Only test empty PATH on UNIX 2023-02-20 11:11:59 -05:00
Paul Smith
ac159491da * gl/modules/make-glob: Avoid glibc glob if bug #866 is present 2023-02-19 17:43:12 -05:00
Paul Smith
4436655568 * tests/scripts/features/include [AIX]: Set explicit timestamps 2023-02-19 15:35:22 -05:00
Paul Smith
549fc56102 * tests/scripts/features/archives: Set CC properly 2023-02-19 14:49:56 -05:00
Paul Smith
37e0010743 Prerelease GNU Make 4.4.0.91
* NEWS: Update the date.
* configure.ac: Change the release.
2023-02-19 09:53:26 -05:00
Paul Smith
536c3e2b37 * src/makeint.h [CYGWIN]: Use pipe mode for the jobserver 2023-02-19 08:52:02 -05:00
Paul Smith
4c9b922560 Don't block for child exit if other commands have completed
Running regression tests on a single CPU system shows that if a child
exits while we're checking prerequisites we might not notice it, and
then we might block waiting for the next child to exit before we try
to do more work even though we could.

* src/remake.c (update_goal_chain): Remember the command_count before
we start checking prerequisites and if it is different when we restart
at the top of the goal chain then don't block.
2023-02-19 01:27:22 -05:00
Paul Smith
2449ef3c88 Clean up depth handling in debug output
The indentation shown in debug output was misleading.  Increment the
depth when we are working on a prerequisite, not for the current
target.

* src/remake.c (check_dep): Increment depth only on recursion.
(update_file_1): Ditto.  Don't show "Finished..." if prereqs are
still running.
* src/implicit.c (pattern_search): Increment depth for the entire
search.
* tests/scripts/features/output-sync: Support debug output when run
by hand.
2023-02-19 01:25:57 -05:00
Paul Smith
fbf8c940e5 * src/makeint.h (WIN32_LEAN_AND_MEAN) [Windows]: Don't redefine.
Suggested for tcc builds by Christian Jullien <eligis@orange.fr>.
2023-02-19 01:02:16 -05:00
KO Myung-Hun
62194015fa * src/misc.c (ttyname) [OS/2]: Add an implementation for OS/2 kLIBC 2023-02-19 01:02:16 -05:00
Paul Smith
c85f68c4e9 Allow jobserver style to be forced to "pipe"
Some systems that support mkfifo() don't support the usage that GNU
make wants.  Provide a way to force using "pipe" jobserver mode even
when mkfifo() is available.

* src/makeint.h (MK_OS_HURD): Define if we're on Hurd.
(JOBSERVER_USE_FIFO): Define if we have mkfifo() and we're NOT on
Hurd.
* src/main.c (main): Test JOBSERVER_USE_FIFO not HAVE_MKFIFO.
* src/posixos.c (jobserver_setup): Ditto.
* maintMakefile: Create a config check test for forcing "pipe" mode.
* tests/run_make_tests.pl: Show discovered FEATURES in verbose mode.
2023-02-19 01:02:16 -05:00
Paul Smith
ffa28f3914 [SV 63668] Use autoconf to detect the default C++ compiler
* configure.ac: Add AC_PROG_CXX to search for a C++ compiler.
(MAKE_CXX): Add the discovered compiler to config.h.
* src/default.c (default_variables): Use MAKE_CXX as the C++ compiler.
2023-02-05 10:22:13 -05:00
Paul Smith
8f03e69af0 * doc/make.texi: Fix typo (reported by <mao492479407@163.com>) 2023-02-05 09:42:49 -05:00
Paul Smith
e819fc2022 * tests/scripts/variables/MAKEFLAGS: Fix some Perl warnings 2023-02-04 13:12:32 -05:00
Dmitry Goncharov
f21cd822a3 * doc/make.texi: [SV 63689] Fix typos in examples 2023-01-28 13:09:36 -05:00
Paul Smith
2f336608d8 * src/job.c: Switch from bit operators to flags macros
* src/remake.c: Ditto.
2023-01-28 13:05:08 -05:00
Paul Smith
faedfdb0af [SV 63667] In .POSIX, use shell flags -c when ignoring errors
* src/variable.c (lookup_variable_for_file): New function to retrieve
a variable assignment in a file context.
* src/variable.h (lookup_variable_for_file): Declare it.
* src/job.c (construct_command_argv): Look up .SHELLFLAGS.  If .POSIX
is set and we're using the default value, choose -c if we're ignoring
errors else choose -ec.
(construct_command_argv_internal): Ditto.
* tests/scripts/targets/POSIX: Add tests.
2023-01-28 13:04:47 -05:00
Dmitry Goncharov
9709d273b2 * tests/scripts/features/archives: [SV 63688] Quote cmd line vars 2023-01-28 09:46:23 -05:00
Paul Smith
eb0bd1aaec * README.in: Mention README.z/OS 2023-01-28 09:28:18 -05:00
Paul Smith
d2bf740e77 * tests/test_driver.pl: Convert z/OS answers for regex output
Allow z/OS customizations to apply to regex output matching.
* tests/scripts/features/output-sync: Use a regex for Terminated.
* tests/scripts/features/temp_stdin: Ditto.
2023-01-15 16:35:57 -05:00
Paul Smith
a8890796a4 * tests/scripts/features/archives: Use the configured compiler for CC 2023-01-15 16:35:57 -05:00
Paul Smith
be6bb0fd68 * configure.ac: Delay setting HAVE_GUILE until we're sure 2023-01-15 10:27:34 -05:00
Paul Smith
db351fe85b Prerelease GNU Make 4.4.0.90
* NEWS: Update the date.
* README.git: Fix a typo.
* maintMakefile (check-alt-config): Report success.
(upload-*): Use the gnulib gnupload script for uploads.
2023-01-14 17:07:04 -05:00
Paul Smith
8a0d7fd4ef * tests/scripts/features/reinvoke: Warn about closing STDIN.
* tests/scripts/features/temp_stdin: Ditto.
* tests/scripts/options/dash-f: Ditto.
2023-01-11 20:35:11 -05:00
Eli Zaretskii
f51fc130cc [SV 63638] Fix processing PATH on MS-Windows
* src/variable.c (sync_Path_environment): Pass only the value of
PATH to convert_Path_to_windows32, excluding the "PATH=" part.
2023-01-11 15:44:56 +02:00
Paul Smith
b99b6cdf3c Update support for OS/2
Patches provided by KO Myung-Hun <komh78@gmail.com>

* NEWS: Add a note.
* AUTHORS: Add a new author.
* README.OS2: Updates to build instructions.
* src/dir.c (dir_contents_file_exists_p): Use a stack copy when
modifying a const string.
* src/job.c (construct_command_argv_internal): Ditto.
Reuse variables rather than re-defining them.
(exec_command): Cast a const string (we don't change it anyway).
* src/getopt.c (_getopt_initialize): Reference unused variables.
(_getopt_internal): Add block braces to quiet the compiler.
* src/main.c (main): Cast argument to child_execute_job().
* src/posixos.c (set_blocking): Reference unused variables.
* src/remake.c (f_mtime): Delete useless code.
2023-01-08 18:44:25 -05:00
Paul Smith
36f955b0e8 [SV 17448] Ignore whitespace around $(file ...) names
The other issues related to whitespace reported in this bug are
not addressed by this change.

* src/functions.c (func_file): Strip whitespace from the start and
end of the filename provided to the $(file ...) function.
* tests/scripts/functions/file: Add tests for this.
* tests/test_driver.pl: Use 3-arg version of open().
2023-01-08 18:06:54 -05:00
Paul Smith
a275f4e9ab [SV 61218] Ensure MAKEFLAGS is expanded even with -e
If -e was given we weren't expanding MAKEFLAGS before passing it
through the environment to jobs: we don't expand variables we
receive from the environment and when -e is given we set the
origin of MAKEFLAGS to "environment override".  Check for MAKEFLAGS
specifically, which seems like a hack but I don't have a better
idea offhand.

* src/main.c (main): Drive-by: use o_default for MAKEOVERRIDES.
* src/variable.c (target_environment): Always expand MAKEFLAGS
regardless of the origin type.
* tests/scripts/options/dash-e: Create a test.
2023-01-08 16:40:55 -05:00
Paul Smith
11444fb001 [SV 62654] Support GNU Make on z/OS
Original patches provided by Igor Todorovski <itodorov@ca.ibm.com>
Reworked by Paul Smith <psmith@gnu.org>.
Thanks to IBM for providing a test system.

* NEWS: Announce support.
* AUTHORS: Ditto.
* README.zOS: Provide details on building GNU Make on z/OS.
* build.sh (get_mk_var): z/OS sh has a strange bug which causes it to
generate extra lines of output: rework the function to print output
as we compute it instead of collecting it into a variable, which
works around this bug.
* src/makeint.h: Declare MK_OS_ZOS if we're building for z/OS.
* src/arscan.c: Don't include <ar.h> on z/OS.
* src/job.c: We can't change environ in ASCII mode on z/OS.
* src/main.c: Ditto.  Also we can't use pselect() on z/OS.
* src/posixos.c: pselect() seems to hang on z/OS: don't use it.
* tests/run_make_tests.pl: Handle different exit codes on z/OS.
* tests/test_driver.pl: Preserve some special z/OS env.vars.
Add special checks to output comparisons when on z/OS.
* tests/scripts/features/archives: Don't validate names.  Don't
try to compile empty files as IBM compilers complain.
* tests/scripts/features/shell_assignment: Fix octal value of #.
* tests/scripts/features/temp_stdin: Don't print "term".
* tests/scripts/functions/shell: Handle shell exit codes.
* tests/scripts/targets/ONESHELL: Ditto.
* tests/scripts/targets/POSIX: sh -x prints differently.
* tests/scripts/variables/SHELL: Ditto.
2023-01-08 10:45:38 -05:00
Paul Smith
0de7a0d3bf Create src/mkcustom.h which is included by config.h
Put declarations for missing functions which we create in src/misc.c
into a file which is included by config.h via AH_BOTTOM().  This
ensures those prototypes are available, even in files added to
lib/... from gnulib.

* src/mkcustom.h: Add a new file with function declarations.
* configure.ac: Include src/mkcustom.h in config.h with AH_BOTTOM()
* Makefile.am: Add the header to the SRCS list.
* src/makeint.h: Remove content that we added to src/mkcustom.h.
* src/config.ami: Add #include "mkcustom.h" to specialized config.h.
* src/config.h-vms: Ditto.
* src/config.h.W32: Ditto.
* src/configh.dos: Ditto.
2023-01-08 10:45:24 -05:00
Paul Smith
1656cd051c Include <strings.h> globally
Various code uses str{,n}casecmp() so include <strings.h>, if it
exists, everywhere.

* configure.ac: Check for <strings.h> explicitly.
* src/makeint.h: Include it if HAVE_STRINGS_H, for str{,n}casecmp().
* src/job.c: Remove include of <strings.h>.
* src/main.c: Ditto.
2023-01-08 10:24:09 -05:00
Paul Smith
31a1337c23 * gl/lib/glob.c: Don't try to support _LIBC, don't use __stat() 2023-01-07 22:02:06 -05:00
Paul Smith
5ae02ff8c1 [SV 63609] Avoid buffer overrun in --warn-undefined-variables
Reported by Dmitry Goncharov <dgoncharov@users.sf.net>

* src/variable.c (struct defined_vars): Create a struct that holds the
name and length of each variable name.
(warn_undefined): Check the lengths before comparing the contents.
* tests/scripts/options/warn-undefined-variables: Add a test.
2023-01-03 02:14:24 -05:00
Paul Smith
1ceeb8c64b [SV 14927] Allow parallel builds for archives
Compare the timestamp of the object file (if it exists) with the
archived object and if the object file is newer, ensure it's updated
in the archive.

* NEWS: Announce the new capability.
* doc/make.texi (Dangers When Using Archives): Explain how to enable
parallel builds with archives.
* src/remake.c (f_mtime): For archive element files check the mod
time of the object file (if it exists) against the archive object
(if it exists).
* tests/scripts/features/archives: Add tests for this capability.
2023-01-03 01:57:35 -05:00
Paul Smith
8791d2b38e [SV 61463] Don't export inherited private variables
If a parent target has an exported variable that is private, don't
export it in child targets.

* NEWS: Mention this change.
* src/variable.c (target_environment): Ignore private inherited
variables.
* tests/thelp.pl: Add a new "env" operation to show env.var. values.
* tests/scripts/variables/private: Verify this new behavior.
2023-01-02 23:02:33 -05:00
Paul Smith
f91b8bbb34 Update ancient glob/fnmatch implementations
I looked again at trying to use the latest gnulib implemenentations
of GNU glob and fnmatch, and the effort required to extract them
from gnulib and make them portable to systems which don't support
configure is simply far too daunting for me.  However it's clear
that the previous implementations are growing too long on the tooth
to continue to be used without some maintenance, so perform some
upkeep on them.

- Remove support for pre-ANSI function definitions.
- Remove the obsolete "register" keyword.
- Assume standard ISO C90/C99 header file support.
- Assume standard ISO C "void" and "const" support.
- Avoid symbols prefixed with "__" as they're reserved.

* maintMakefile: Add a rule to verify lib has the latest content.
* src/dir.c: Use void* not __ptr_t which was removed.
* gl/lib/glob.c: See above.
* gl/lib/fnmatch.in.h: See above.
* gl/lib/glob.in.h: See above.
* gl/lib/fnmatch.c: See above.  Remove __strchrnul(): it is not
checked anywhere and is only used in one place anyway.
2023-01-02 22:53:05 -05:00
Paul Smith
8dc66b6c31 * doc/make.texi (Special Targets): Fix minor typo
Reported by Andrey Melnikov <vafilor@gmail.com>.
2023-01-02 00:13:28 -05:00
Paul Smith
ccbaf3861d Don't free uninitialized hash_table
* src/dir.c (clear_directory_contents): We use ht_vec to mark when
we have initialized the hash_table: don't free if it's NULL.
(everywhere): Use NULL instead of 0 when working with pointers.
2023-01-01 17:05:12 -05:00
Paul Smith
c4fbfe8b5e * maintMakefile: Add missing quote 2023-01-01 17:05:12 -05:00
Paul Smith
e7ce3a655e Convert references from "GNU make" to "GNU Make" 2023-01-01 17:05:12 -05:00
Paul Smith
c580ebae8d Update to the latest gnulib stable branch
* bootstrap.conf: Request the latest gnulib stable branch.
* README.git: Recommend the argument form of autogen/autopull.
* bootstrap: Import the latest version of bootstrap.
* bootstrap-funclib.sh: Ditto.
* autogen.sh: Ditto.
* autopull.sh: Ditto.
2023-01-01 17:05:12 -05:00
Paul Smith
56d2978141 Update the copyright year on all files 2023-01-01 10:06:01 -05:00
Paul Smith
c91b269f66 Apply spelling fixes discovered by Codespell
* maintMakefile: Apply spelling fixes.
* src/file.c: Ditto.
* src/misc.c: Ditto.
* src/remake.c: Ditto.
* src/vmsjobs.c: Ditto.
* src/w32/pathstuff.c: Ditto.
* tests/test_driver.pl: Ditto.
* tests/run_make_tests.com: Ditto
* tests/scripts/features/implicit_search: Ditto
* tests/scripts/features/output-sync: Ditto
* tests/scripts/features/patternrules: Ditto
* tests/scripts/features/se_explicit: Ditto
* tests/scripts/features/statipattrules: Ditto
* tests/scripts/functions/foreach: Ditto
* tests/scripts/variables/MAKEFLAGS: Ditto
2022-12-31 13:21:09 -05:00
Paul Smith
29f453739f Avoid using false(1) in regression tests
The POSIX standard only requires false(1) to return a "non-zero" exit
code; almost all systems return 1 but some (Solaris!!!) return 255 or
possibly even other values.  Use our helper "fail" instead.

* tests/thelp.pl: Have the "fail" command obey -q.
* tests/scripts/features/parallelism: Helper -q no longer prints fail.
* tests/scripts/targets/POSIX: Replace false with #HELPER# -q fail 1.
* tests/scripts/variables/MAKEFLAGS: Ditto.
* tests/scripts/variables/SHELL: Ditto.
2022-12-31 10:51:24 -05:00
Paul Smith
937e9aa32d Make bootstrap.bat more portable
Using backslashes in a sed command line is tricky as different programs
use them differently as escape sequences.  Eli Zaretskii points out
that Windows "echo" doesn't do any processing, so rework all our sed
invocations to use script files created by echo.

* bootstrap.bat: Use echo to create sed script files instead of -e.
* Basic.mk.template: Fix typo in the comments.
* .gitignore: Ignore any .sed scripts.
2022-12-26 13:10:26 -05:00
Paul Smith
8e9c7db1e1 * NEWS: Add a section for the next release
Add a note for the MAKEFLAGS enhancements.
2022-12-24 15:48:48 -05:00
Paul Smith
15dfad96d7 [SV 63439, SV 63452] Don't warn on undefined internal variables
Don't generate undefined variable warnings for variables that are
internal / special to make and where the empty string is valid.
Rather than defining them to empty, which could introduce unwanted
behavior, keep a list of variable names which we should never warn
about.

* src/variable.h (warn_undefined): Convert the macro to a function.
* src/variable.c (defined_vars): Always "defined" variable names.
(warn_undefined): Implement as a function and check against the
defined_vars before generating a warning.
* src/read.c (read_all_makefiles): No need to reset warning flag.
* src/vpath.c (build_vpath_lists): Ditto.
* tests/scripts/options/warn-undefined-variables: Expand all the
pre-defined variables to ensure warnings are not generated.
2022-12-24 10:52:49 -05:00
Paul Smith
76d2e5d98d [SV 63552] Change directories before constructing include paths
* src/makeint.h (reset_makeflags): New function to handle changing
MAKEFLAGS from within makefiles.  Remove decode_env_switches().
* src/variable.c (set_special_var): Call reset_makeflags() instead
of various internal methods.
* src/main.c (decode_env_switches): Only internal now so make static.
(decode_switches): Don't invoke construct_include_path() yet.
(reset_makeflags): Decode env switches and construct include paths.
(main): Construct include paths after we process -C options.
* tests/scripts/options/dash-C: Rewrite to use new test constructs.
Add a test using both -C and -I together.
Add a test for multiple -C options.
2022-12-24 10:52:43 -05:00
Paul Smith
a581146562 tests [WINDOWS32]: Support Strawberry Perl on Windows
Strawberry Perl has some different behaviors from ActiveState Perl
which impact the test suite:

- Avoid Perl's chomp() as it may not remove CRs; chomp() may remove
  only the final NL but not the CR in a CRNL line ending.
- Strawberry Perl doesn't support ActiveState's system(1, ...) form.
- Strawberry Perl (or msys?) does something weird with "/tmp" when
  provided to exec(), replacing it with the user's %TEMP%.
- Strawberry Perl uses msys paths like /c/foo instead of C:\foo.

* tests/test_driver.pl (get_osname): Strawberry Perl uses 'msys' as
its $^O so if we see that use a port of 'W32'.
(_run_with_timeout): Strawberry Perl doesn't support the special
system(1, ...) form of system() so use POSIX standard fork/exec.
(compare_answer): Paths generated by Strawberry Perl use msys path
format (e.g., /c/foo instead of C:\foo); check for those differences
and compare RE against both the unmodified and modified log.
* tests/run_make_tests.pl (set_defaults): Switch from chomp to s///
to remove CRNL and NL line endings.
* tests/scripts/features/errors: Executing directories on Strawberry
will give an error; translate it to Windows error output format.
* tests/scripts/features/output-sync: Ditto.
* tests/scripts/features/temp_stdin: Ditto.
* tests/scripts/functions/realpath: Ditto.
* tests/scripts/options/dash-I: Ditto.
* tests/scripts/variables/INCLUDE_DIRS: Ditto.
* tests/scripts/misc/close_stdout: /dev/full is reported as existing
on Strawberry Perl, but it doesn't do anything.  Skip the test.
* tests/scripts/variables/MAKEFLAGS: When an argument containing
/tmp is passed to a program via exec(), something replaces it with
the expansion of the %TEMP% variable.  Instead of using /tmp create
a local directory to use.
2022-12-20 02:14:18 -05:00
Paul Smith
b2c7446023 * tests/test_driver.pl: Remember if something failed and report it 2022-12-20 02:07:28 -05:00
Paul Smith
89427039c3 [WINDOWS32] Remove CRNL from FormatMessage() result string
Sometimes the error message is expected to contain a newline, other
times it is not.  Also the result of FormatMessage() sometimes ends
in CRNL already: when printed via fprintf() the final newline is
converted to CRNL, giving an output of CRCRNL which causes tests
to fail to match.  Remove any CR/NL chars from the result string.

* src/job.c (reap_children): Add \n to the error message fprintf.
(exec_command): Ditto.
* src/w32/subproc/w32err.c (map_windows32_error_to_string): Remove
any trailing CR or NL from the string before returning.
2022-12-19 00:20:06 -05:00
Dmitry Goncharov
7d8756a4a3 [SV 63537] Document and test flippable switches
* doc/make.texi (Options/Recursion): Clarify that MAKEFLAGS values
from the environment have precedence over those set in the makefile.
* tests/scripts/variables/MAKEFLAGS: Check boolean switches -k/-S,
-w/--no-print-directory and -s/--no-silent as follows:
1. A switch can be enabled or disabled on the command line.
2. A switch can be enabled or disabled in env.
3. A switch can be enabled or disabled in makefile.
4. Command line beats env and makefile.
5. Env beats makefile.
6. MAKEFLAGS contains each specified switch at parse and build time.
7. If switches are specified in multiple origins, MAKEFLAGS contains
   the winning switch at parse and build time.
8. MAKEFLAGS does not contain the losing switch.
Also test that --debug settings from different origins are combined
together into one option.
2022-12-18 20:06:38 -05:00
Dmitry Goncharov
8e805c7ba6 [SV 63537] Pass enabled-by-default switches to submake
Certain switches, such as -S or --no-silent, turn on behavior that is
enabled by default.  When a switch is specified via the command line,
makefile, or env, ensure the switch is added to MAKEFLAGS.

* src/main.c (struct command_switch): Add bit "specified".
(switches): Initialize command_switch->specified.
(decode_switches): Set command_switch->specified.
(define_makeflags): Check command_switch->specified.
2022-12-18 20:06:38 -05:00
Dmitry Goncharov
132528b266 [SV 63537] Remember the origin of command line options
Certain options can be flipped on and off: -k/-S, -s/--no-silent, and
-w/--no-print-directory.  Ensure they behave as follows:
 1. A switch can be enabled or disabled on the command line.
 2. A switch can be enabled or disabled in env.
 3. A switch can be enabled or disabled in makefile.
 4. Command line beats env and makefile.
 5. Env beats makefile.

* src/main.c: Add variables to hold the origin of relevant options.
(struct command_switch): Add origin field.
(switches): Set a pointer to hold the origin of relevant options.
(decode_switches): For any switch that can be specified in makefile or
env, honor the switch only if cs->origin is not set or the specified
origin beats cs->origin.  Set cs->origin when relevant.
2022-12-18 20:06:38 -05:00
Dmitry Goncharov
8f9e7722ff [SV 63537] Fix setting -w in makefiles
* src/makeint.h: Replace print_directory flag with should_print_dir().
* src/main.c (main): Remove print_directory flag and related code.
(should_print_dir): Create.
* src/output.c (output_dump): Use should_print_dir().
(output_start): Ditto.
2022-12-18 20:06:38 -05:00
Dmitry Goncharov
95c2db7b8d [SV 63484] Force included makefiles to be explicit
Ensure included makefiles are not treated as intermediate, even if
they are created by an implicit rule.
Reported by Patrick Oppenlander <patrick.oppenlander@gmail.com>.

* src/read.c (eval_makefile): Mark makefiles as explicit.
* tests/scripts/features/include: Add a test.
2022-12-18 20:06:38 -05:00
Paul Smith
5d1b757517 [SV 63516] [DOS] Support include files with drivespecs
* src/makeint.h (HAVE_DRIVESPEC): Create a macro to check.
* src/main.c (.FEATURES): Add "dospaths" as a feature.
* src/read.c (eval_makefile) [DOS]: If the included makefile name
starts with a drivespec, don't search the include directories.
* doc/make.texi (Include): Document this behavior.
* tests/scripts/features/include: Add a test.
2022-12-18 20:06:38 -05:00
Paul Smith
c0023150f1 * src/job.c (new_job): [SV 63510] Trace phony prerequisite rebuilds 2022-12-18 14:44:17 -05:00
Paul Smith
a89eef87e6 * configure.ac: Update for a new release
* README.git: Add some packages needed for building from Git.
* AUTHORS: Updates.
2022-12-18 14:44:17 -05:00
Dmitry Goncharov
6164608900 [SV 63417] Ensure global .NOTINTERMEDIATE disables all intermediates
Fix .NOTINTERMEDIATE without prerequisites to disable intermediate
status for all targets.

* src/makeint.h: Declare extern no_intermediates.
* src/main.c: Add global definition of no_intermediates.
* src/file.c: Remove static no_intermediates to use global variable.
(remove_intermediates): Check no_intermediates.
* src/implicit.c (pattern_search): For a file found by implicit search
set file->notintermediate if no_intermediates is set.
* src/remake.c (update_file_1): Don't set file->secondary for a
pre-existing file if no_intermediates is set.  The check for
no_intermediates here is redundant, but won't hurt: keep it in case
things change so that it matters.
* tests/scripts/targets/NOTINTERMEDIATE: Fix a test.
2022-11-28 10:50:55 -05:00
Paul Smith
a99183ed2b * doc/make.texi: Use $(firstword) rather than $(word 1,) 2022-11-28 10:50:55 -05:00
Dmitry Goncharov
dc2d963989 [SV 63347] Always add command line variable assignments to MAKEFLAGS
This commit introduces two visible changes:
1. Keep command line variable assignments in MAKEFLAGS at all times,
   even while parsing makefiles.
2. Define makeflags immediately when a makefile modifies MAKEFLAGS.

The new MAKEFLAGS and MAKEOVERRIDES initialization procedure:
1. decode_switches (argc, argv, o_command) is called to parse command
   line variable assignments.
2. Command line variable assignments go through quote_for_env.
   Initialize -*-command-variables-*- to the quoted values.
3. MAKEOVERRIDES is initialized to refer to -*-command-variables-*-
   with origin o_env to keep the definitions in the database intact.
4. define_makeflags() is called which adds MAKEOVERRIDES to MAKEFLAGS.
5. Makefiles are parsed.  If a makefile modifies MAKEFLAGS, the new
   value of MAKEFLAGS is defined right away.
6. Env switches are decoded again as o_env.  The definitions set by
   decode_switches at step 1 stay intact, as o_command beats o_env.

We must preserve the original intact definitions in order to detect
failure cases; for example:
  $ cat makefile
  all:; $(hello)
  $ make hello='$(world'
  makefile:1: *** unterminated variable reference.  Stop.

* src/makeint.h: Declare enum variable_origin, struct variable and
define_makeflags().  Add parameter origin to decode_env_switches().
* src/main.c (define_makeflags): Remove "all". If a variable is
assigned on the command line then append MAKEOVERRIDES to MAKEFLAGS.
(decode_env_switches): Replace parameter env with origin.
(decode_switches): Replace parameter env with origin.
Treat origin == o_command as env == 0.
(handle_non_switch_argument): Replace parameter env with origin.
Treat origin == o_command as env == 0.
(main): Call decode_switches() with origin==o_command before parsing
makefiles.  Call decode_switches() with origin==o_env after parsing
makefiles.
* src/variable.c (set_special_var): Define makeflags at parse time,
each time a makefile modifies MAKEFLAGS.
(do_variable_definition): Strip command line variable assignments from
MAKEFLAGS before appending extra flags.  set_special_var() adds them
back.
* tests/scripts/variables/MAKEFLAGS: Add tests.
2022-11-28 10:50:55 -05:00
Paul Smith
53b8f6a5da * src/main.c (main): [SV 63373] Don't use macros with memcmp()
Reported by djm <mccannd@uk.ibm.com>
2022-11-16 10:00:34 -05:00
Paul Smith
6c1a6dd77c Add specific hints for errors due to invalid conditionals
* src/read.c (eval): If "missing separator" appears to be due to
missing space after ifeq/ifneq, give a hint about the error.
* tests/scripts/misc/failure: Check for these types of failures.
* tests/scripts/variables/special: Move error checking unrelated
to special variables, to misc/failure.
2022-11-15 10:50:34 -05:00
Dmitry Goncharov
1b51ba1f5d [SV 63333] Be more lenient when failing to create temporary files
If make cannot create a temporary lock file for output sync, continue
without output sync enabled rather than dying.

However, if make cannot store a makefile from stdin to a temporary
file that is still a fatal error.

* misc.c (get_tmppath): Keep running on failure to generate a
temporary file name.
(get_tmpfd): Keep running on failure to get a temporary file.
(get_tmpfile): Keep running on failure to open a temporary file.
Ensure memory is freed if we return an error.
* posixos.c (os_anontmp): Keep running on failure to open an
anonymous temporary file.
* output.c (setup_tmpfile): Print an error on failure to create an
output sync lock file.
* main.c (main): Die on failure to store makefile from stdin to a
temporary file.
* tests/scripts/features/output-sync: Add tests.
* tests/scripts/features/temp_stdin: Ditto.
2022-11-13 16:34:01 -05:00
Paul Smith
4c9d87f4ae Keep going if we can't connect to the jobserver
* src/posixos.c (jobserver_parse_auth): Don't invoke fatal() if we
can't connect to an existing jobserver: just keep going without it.
* src/w32/w32os.c (jobserver_parse_auth): Ditto.
* tests/scripts/features/jobserver: Add a test for invalid FIFO
auth files.
2022-11-13 10:39:48 -05:00
Paul Smith
bb5df35133 * src/dir.c (dir_contents_file_exists_p): Show dir name in error.
If we fail to read a directory show the directory name in the error
message.  Pass struct directory instead of directory_contents to
allow that.
(dir_file_exists_p): Change dir_contents_file_exists_p caller.
(open_dirstrem): Ditto.
2022-11-13 10:39:48 -05:00
Paul Smith
92ab2e642d * src/main.c (main): [SV 63307] Handle SIGPIPE as a fatal signal
Always ignoring SIGPIPE is visible to child processes.
2022-11-13 10:39:48 -05:00
Paul Smith
deb4ff272a [SV 63315] tests: Simplify TERM signaling
Tests that try to kill the make process were not behaving as expected
on OpenBSD: the signal was sent from make to its children but the
sleep didn't die.  Something odd about the way the shell treats TERM.
To reduce platform dependencies add "term" to the helper tool and run
that instead of kill / sleep.

* tests/thelp.pl: Add a new operation "term" that takes a PID.
* tests/scripts/features/output-sync: Use it.
* tests/scripts/features/temp_stdin: Ditto.
2022-11-13 10:39:48 -05:00
Paul Smith
e80ce6fc90 [SV 63315] Allocate function names when defining functions
* src/function.c (define_new_function): Don't keep a pointer to the
user-provided name of a user-defined function: if the .so is unloaded
it will point to garbage.  Add the name to the strcache instead.
2022-11-13 10:39:48 -05:00
Paul Smith
d71c0bb0ce tests: Don't convert \ to / when checking regex's
When tests compare the output they will try converting backslashes
to slashes to see if that works.  When we compare using regex's,
we can't do that because backslashes can escape special characters.

* tests/test_driver.pl (compare_output): Clean up this function.
(compare_answer_vms) [VMS]: Comparing answers on VMS is complex;
move all of it into its own function returning 0/1.
(compare_answer): A new function to compare answers: return 0/1.
Remember the CRLF->LF conversion forever; only check \ -> / when
we compare strings, not regex's.
2022-11-13 10:39:48 -05:00
Justine Tunney
090d99dd2d * src/hash.c (jhash_string): Help the compiler optimize the hash
Invoke memcpy() with a constant length, where possible.

Copyright-paperwork-exempt: yes
2022-11-13 10:38:50 -05:00
Paul Smith
6b45f89adb * src/config.h.W32 [TCC]: Only redefine strtoll if not defined 2022-11-12 10:34:35 -05:00
Eli Zaretskii
11f7198f64 * src/config.h.W32: Fix last change. 2022-11-09 15:15:20 +02:00
Eli Zaretskii
4321c5e562 Fix build with Tiny C
* src/config.h.W32 (strtoll, strtoull) [__TINYC__]: Redirect to
_strtoi64 and _strtoui64, respectively.  Reported by Christian
Jullien <eligis@orange.fr>.
2022-11-05 16:46:58 +02:00
Paul Smith
ed493f6c91 Release GNU Make 4.4
* NEWS: Update the version and date.
* configure.ac: Update the version.
* doc/make.texi: Update the EDITION.
2022-10-31 02:23:04 -04:00
Paul Smith
7c3260bbdd * README.git: Update and clarify release operations 2022-10-31 02:23:04 -04:00
Paul Smith
38b19976f5 Fix issues found by ASAN and Coverity
* tests/test_driver.pl: Preserve the LSAN_OPTIONS variable.
* tests/scripts/targets/ONESHELL: Don't set a local variable.
* tests/scripts/functions/let: Test empty let variable.
* src/posixos.c (osync_parse_mutex): Free existing osync_tmpfile.
* src/misc.c (get_tmpfd): Set umask() before invoking mkstemp().
* src/ar.c (ar_parse_name): Check invalid name (shouldn't happen).
* src/function.c (define_new_function): Free previous function entry
when replacing it with a new one.
* src/job.c (child_execute_job): Initialize pid for safety.
(construct_command_argv_internal): In oneshell mode ensure that the
returned argv has the right format (0th element is a pointer to the
entire buffer).
2022-10-31 02:23:04 -04:00
Paul Smith
1dd52ab472 Avoid C99 constructs
Although gnulib requires C99, most of the code does compile with a
C90 compiler (perhaps with a lot of warnings).  Reinstate our C90
configuration test, and clean up a few C99 things that crept in.

* src/job.c (construct_command_argv_internal): Don't use loop-local
variables or C++ comments.
* src/read.c (eval_makefile): Don't use loop-local variables.
2022-10-29 13:36:21 -04:00
Paul Smith
92789aa2e7 * build.sh: Allow a "keep-going" mode during builds 2022-10-29 13:36:21 -04:00
Paul Smith
4e18732a1d tests: Avoid the use of File::Temp->newdir()
This was added in Perl 5.8 but some systems still only provide older
versions such as Perl 5.6.  We don't really need it anyway.
Paul Eggert <eggert@cs.ucla.edu> reported this issue.

* tests/README: Update this to be a bit more modern.
* tests/test_driver.pl: Delete the $TEMPDIR variable.
* tests/scripts/features/temp_stdin: Use $temppath not $TEMPDIR.
2022-10-29 13:36:21 -04:00
Paul Smith
11f9da227e * src/posixos.c (os_anontmp): [SV 63287] Only fail O_TMPFILE once
Reported by Dmitry Goncharov <dgoncharov@users.sf.net>.
2022-10-29 13:36:21 -04:00
Paul Smith
b92340a1ea [SV 62174] Force locale to be "C" before retrieving error messages
We attempt to do this with POSIX::setlocale() but apparently on some
systems (AIX) this isn't sufficient.  So, in addition force the LC
environment variables to use "C".
Reported by Dmitry Goncharov <dgoncharov@users.sf.net>.

* tests/run_make_tests.pl: Move the global setup into set_default().
Force the %ENV locale variables to use the ones we'll use when running
make, then reset them back again after we find error messages.
2022-10-28 17:39:06 -04:00
Paul Smith
8064aee4f9 * src/job.c: [SV 63185] Don't use ifdef with HAVE_DECL_* macros 2022-10-27 15:20:40 -04:00
Paul Smith
cf78e65fda * tests/scripts/features/exec: Don't test with C shells
Using C shells (csh, tcsh) with make is known to be problematic due
to incorrect ways it handles open file descriptors, at least.  If
the user's shell is *csh then don't try it during exec tests.
2022-10-25 14:49:10 -04:00
Paul Smith
04f0d8427f Increase the test framework timeout from 5s to 60s
It seems that some of the test environments hit the 5s timeout on
some tests.  Since it doesn't really matter, as long as we don't
hang forever, increase the timeout to 60s.

* tests/test_driver.pl: Increase $test_timout to 60.  We don't need
to handle VMS timeouts specially anymore.
* tests/scripts/features/parallelism: We don't need to override the
default timeout anymore.
* tests/scripts/features/patternrules: Remove confusing comment.
2022-10-25 14:44:26 -04:00
Paul Smith
f8401ad28b * Makefile.am (check-regression): Add a random suffix to results file
Put the results into a subdirectory for easy unpacking.
* .gitignore: Ignore it.
2022-10-25 14:42:52 -04:00
Paul Smith
e4b3bf7f97 Release GNU Make 4.3.92
* configure.ac: Modify the release version.
* NEWS: Update the version and date.
2022-10-24 02:14:42 -04:00
Paul Smith
d18a87d0a4 [SV 63260] Don't recurse forever if setup_tmpfile() fails
If we fail during setup_tmpfile() we'll try to write an error, which
will invoke setup_tmpfile() again, etc.  Avoid infinite recursion.
Original patch by Dmitry Goncharov <dgoncharov@users.sf.net>

* src/output.c (setup_tmpfile): Remember we're in this function and
return immediately if we enter it during recursion.
(message): Remember the starting location and use that instead of
fmtbuf.buffer.
(error): Ditto.
(fatal): Ditto.
2022-10-24 01:50:12 -04:00
Paul Smith
41c35f2ffe * src/output.c (_outputs): Don't use invalid output sync FDs
Just write to stdout/stderr in this situation.
2022-10-24 01:50:12 -04:00
Paul Smith
deb4a42c3e * src/misc.c (get_tmpdir): Report errors if tmpdirs are invalid
* src/main.c (main): Set up initial temporary directories.
2022-10-24 01:50:12 -04:00
Dmitry Goncharov
252c26bd20 * src/posixos.c (os_anontmp): If O_TMPFILE fails try dup() method. 2022-10-23 18:41:50 -04:00
Paul Smith
6f8da5f4b8 * src/rule.c (get_rule_defn): Don't use STRING_SIZE_TUPLE in mempcpy
If mempcpy() is a macro then STRING_SIZE_TUPLE won't compile.
2022-10-23 18:41:50 -04:00
Paul Smith
c46b5a9e0e Provide a maintainer-only debug method
Generating debug logs to stdout or stderr makes it impossible to
run tests etc. so create a dumb DBG facility to log to a temp file.
This exists only in maintainer mode and the DBG macro gives a
compile error if it's used in non-maintainer mode.

* src/makeint.h (DBG): Call dbg() in maintainer mode, else error.
(dbg): Define it in maintainer mode.
* src/misc.c (dbg): Open a log file for append, write, then close.
2022-10-23 18:41:50 -04:00
Paul Smith
b4157d2ff4 * configure.ac: Check that we can link with Guile
On multi-arch systems we may be able to find the header file but
not successfully link the library.
2022-10-22 22:40:26 -04:00
Paul Smith
f364e0d8d6 Set PATH_MAX on systems without a default value
Some systems (HURD) use fully-dynamic pathnames, with no limit.
We can't support this without significant effort so for now set
PATH_MAX to a large value.

* src/makeint.h: Set PATH_MAX to 4096 if not set and MAXPATHLEN
is also not set.  Remove MAXPATHLEN setting: we won't use it.
* src/misc.c (get_path_max): If we can't get the path max via
pathconf() use the default PATH_MAX.
* src/dir.c (find_directory) [W32]: Use MAX_PATH not MAXPATHLEN.
(local_stat) [W32]: Ditto.
* src/job.c (create_batch_file) [W32]: Ditto.
* src/remake.c (name_mtime) [W32]: Ditto.
* src/w32/w32os.c (os_anontmp) [W32]: Ditto.
2022-10-22 22:40:26 -04:00
Paul Smith
bb0c05a7f0 [SV 63098] Enhance detection of missing peer also-make targets
The previous attempt to detect missing peer targets for implicit
rules had some holes.  Move the detection to notice_finished_file().

* src/remake.c (check_also_make): If we don't have the current mtime
for the file, obtain it.
(update_goal_chain): Don't call check_also_make() here.
(check_dep): Ditto.
(notice_finished_file): If we finished running an implicit rule that
has also_make targets, invoke check_also_make().
2022-10-22 22:40:26 -04:00
Paul Smith
f987d181c4 Collect failure details when the regression tests fail
* README.in: Add a section on running regression tests.
* Makefile.am (check-regression): Capture the test run output, and
on failure collect configure and test results into a tar file.
2022-10-22 22:40:26 -04:00
Paul Smith
cad3ddd165 Enhance tests to work on different systems
The GNU platform testers reported a number of test errors on
different systems; try to address them.

* tests/thelp.pl: A number of tests timed out with a 4-second
timeout.  Increase the default timeout to 10 seconds.
* tests/run_make_tests.pl: Executing directories on cygwin behaves
differently in Perl than make so skip these tests there.
* tests/scripts/options/symlinks: Check for the symlink feature
in make, rather than whether the system supports them.
* tests/scripts/features/implicit_search: On some systems "false"
exits with a different exit code.  Use the helper instead.
* tests/scripts/features/loadapi: Ditto.
* tests/scripts/features/output-sync: Sleep before make -f bar in
the first test as well as the second one.
* tests/scripts/features/exec: Skip on cygwin, which seems to
be "UNIX" but where scripts don't run normally.
* tests/scripts/misc/fopen-fail: Skip on cygwin, where make
eventually exits with exit code 0 and no error messages.
2022-10-22 22:37:49 -04:00
Dmitry Goncharov
54214176b1 [SV 63243] tests: Avoid SIGTERM racing with make error messages
Original patch from Frank Heckenbach <f.heckenbach@fh-soft.de>.

* tests/scripts/features/output-sync: Introduce a sleep to let make
write its error message.  Some systems use different names for
SIGTERM so match with a regex.
* tests/scripts/features/temp_stdin: Ditto.
2022-10-22 10:02:41 -04:00
Dmitry Goncharov
c2f92c980f [SV 63236] Fix getloadavg related error message on AIX
On AIX getloadavg keeps errno intact when it fails, resulting in a
bogus error message from make.

* src/job.c (load_too_high): Reset errno before calling getloadavg.
2022-10-22 09:45:40 -04:00
Dmitry Goncharov
5b1ca277ca [SV 63248] Ignore SIGPIPE
Don't terminate when make's output is redirected to a pipe and the
reader exits early; e.g.:
  $ echo 'all:; sleep 2' | make -f- -j2 -O |:

This lets us unlink temporary files, and tell the user that make was
not able to write its output.
Reported by Frank Heckenbach <f.heckenbach@fh-soft.de>.

* src/main.c (main): Ignore SIGPIPE.
* src/posixos.c (osync_clear): Fix a memory leak.
2022-10-22 09:45:40 -04:00
Paul Smith
7c71df5695 * NEWS: Release GNU make 4.3.91 2022-10-18 14:37:47 -04:00
Paul Smith
a0956c1803 * AUTHORS: Update the authors list. 2022-10-18 14:37:47 -04:00
Paul Smith
4ec74e568d * NEWS: Use GNU Make instead of GNU make
* README.git: Ditto.
* README.Amiga: Ditto.
* README.DOS: Ditto.
* README.OS2: Ditto.
* README.VMS: Ditto.
* README.W32: Ditto.
* README.customs: Ditto.
* make-gdb.py: Ditto.
* tests/run_make_tests.pl: Ditto.
2022-10-18 14:37:47 -04:00
Paul Smith
d9fc1ac5d2 Update URLs to use https rather than http
* (all): Change http:// to https://
* README.W32: Remove invalid link to mingw.org.
2022-10-18 14:37:47 -04:00
Paul Smith
9f55e9fd13 Rework temp file handling to avoid GNU libc warnings
Original patch provided by Paul Eggert <eggert@cs.ucla.edu>.
GNU libc will generate a link-time warning if we use mktemp() even
though we are using it safely (we only use it with mkfifo()).
Avoid this and clean up some handling.

First, check all calls related to temporary files and exit with a
fatal error and a useful message if we can't obtain them.  In some
situations it might be possible to continue with reduced capability
but it's not worth the effort.

On POSIX systems we can create anonymous temp files using O_TMPFILE
if it's supported, else if we're using the default location and we
have dup(2), we can use standard tmpfile() and get an FD from it.

If we need a named temp file and FILE* and we have mkstemp() we can
use that, else if we have fdopen() we can get a temp FD and open it.
If none of those are available all we can do is generate a temp name
then open it with fopen() which is not secure.

* src/makeint.h (get_tmpdir): Declare it for use elsewhere.
* src/misc.c (get_tmpdir): Make it public not static.
(get_tmptemplate): Simplify the implementation.
(get_tmppath): Only define this if we have to have it to avoid
warnings from GNU libc.
(get_tmpfd): Generate fatal errors on error.
(get_tmpfile): Ditto.  Open files in "wb+" mode to match tmpfile().
Require a filename pointer (all callers want it).
* src/os.h (os_anontmp): Implement for posixos.c as well.
* src/posix.c (jobserver_setup): Don't use mktemp to avoid GNU libc
errors.  Instead construct the FIFO name based on the PID.
(osync_setup): get_tmpfd() can't fail so don't check it.
(os_anontmp): If the system supports O_TMPFILE use it.  If not, and
we want to create the temporary file in the default directory, we
can use tmpfile() then use dup() to copy the file descriptor.
* src/main.c (main): get_tmpfile() can't fail.
* src/vmsjobs.c (child_execute_job): get_tmpfile() can't fail.
2022-10-18 14:20:44 -04:00
Paul Smith
7bb7bb4ba4 Add ISDIRSEP() helper macro and use it
Create a ISDIRSEP() macro to check for directory separator chars
using the stopchar_map, and replace inline checks and explicit
STOP_SET calls with this macro.

* src/makeint.h (ISDIRSEP): Create the macro using MAP_DIRSEP.
* src/dir.c (find_directory): Replace inline checks with ISDIRSEP.
(file_exists_p): Ditto.
(file_impossible): Ditto.
(file_impossible_p): Ditto.
(local_stat): Ditto.
* src/file.c (lookup_file): Ditto.
* src/function.c (abspath): Ditto.
* src/job.c (_is_unixy_shell): Ditto.
(is_bourne_compatible_shell): Ditto.
(construct_command_argv): Ditto.
* src/main.c (find_and_set_default_shell): Ditto.
(main): Ditto.
* src/read.c (eval): Ditto.
(parse_file_seq): Ditto.
* src/remake.c (name_mtime): Ditto.
* src/vpath.c (construct_vpath_list): Ditto.
2022-10-18 14:20:44 -04:00
Paul Smith
b79791533b Add preprocessor macros for different platforms
* configure.ac: MK_CONFIGURE shows config.h was generated by configure.
* src/config.ami: Define MK_AMIGAOS.
* src/config.h-vms: Define MK_VMS.
* src/configh.dos: Define MK_DJGPP.
* src/config.h.W32: Define MK_W32 and WINDOWS32.
* src/build_w32.bat: Let WINDOWS32 be defined by config.h.  Remove
unused setting of WIN32.
* src/job.c: Clean up use of WIN32.
* src/main.c: Ditto.
* tests/scripts/features/default_names: Ditto.
2022-10-18 14:20:44 -04:00
Paul Smith
9d24d41801 Check for recipe line count overflow before it overflows
awk 'BEGIN {
       print "x:"
       for (i = 0; i < 65536; i++)
         printf "\techo %d\n", i}
    ' | make -f -

Outputs only "make: 'x' is up to date."  Larger values run only the
lines above 65536.  Reported by Paul Eggert <eggert@cs.ucla.edu>.

* src/commands.c (chop_commands): Check the line count before it has
a chance to overflow.  Use size_t for max count so it can't overflow.
Remove stray 'd' in diagnostic.
2022-10-18 14:20:44 -04:00
Paul Smith
2d943d3d2e Remove template files to simplify distribution creation
The README templates were not useful since the replacement step
didn't have anything to replace: rename them.

Rather than creating template files for the config variants, create
mkconfig.h.in containg PACKAGE_* variables to be replaced, and have
config variant header files include it.  Note on POSIX we don't use
this, and continue to generate a single config.h.in file.

Use config.status to convert the README.in and mkconfig.h.in files
during distribution creation.

Modify all users of VERSION to use PACKAGE_VERSION instead.

* configure.ac: Use GNU Make not GNU make as the package name.
* README.in: Use GNU Make not GNU make.
* README.git: Remove references to README.W32.template.
* .gitignore: Update for new behavior.
* Basic.mk.template: Remove unused posix_SOURCES and VERSION, and
references to unshipped mk/Posix.mk
* Makefile.am: Add src/mkconfig.h as an extra dist file.
* bootstrap.bat: Rewrite mkconfig.h.in to mkconfig.h
* maintMakefile: Remove obsolete template files; add mkconfig.h.in.
* prepare_vms.com: Rewrite mkconfig.h.in to mkconfig.h
* mk/VMS.mk: Fix incorrect header file prerequisite.
* src/mkconfig.h.in: New file containing PACKAGE variables.
* src/config.ami: Include mkconfig.h.
* src/config.h.W32: Ditto.
* src/configh.dos: Ditto.
* src/config.h-vms: Ditto.
* src/version.c: Use PACKAGE_VERSION not VERSION.
2022-10-18 14:20:44 -04:00
Juan M. Guerrero
b16913a67e Support building with DJGPP 2.05
* builddos.bat: Use env var settings for paths.  Fix a typo in
expand.o.  Add the missing load.o compilation and link.  Enable
Guile support.  Copy Basic.mk from the correct location.
* src/configh.dos.templage: DJGPP supports strtoll() and ssize_t
given new enough versions.  Set preprocessor variables to 1 not 0.
2022-10-16 16:19:42 -04:00
Paul Smith
72ee43c473 * src/job.c: [SV 63185] Include sys/loadavg.h if needed. 2022-10-16 16:19:42 -04:00
Paul Smith
e5e538fb7a [SV 63215] Remember the random seed for shuffle mode
Basic fix provided by James Hilliard <james.hilliard1@gmail.com>.
Ensure we remember and propagate the random seed we generate during
shuffle mode.  Also add a debug statement displaying the seed.

* src/shuffle.c (shuffle_set_mode): Init and save the randoms seed.
* src/misc.c (make_rand): Code cleanups.
* src/main.c (main): Show a debug message containing the seed.
2022-10-16 16:18:21 -04:00
Paul Smith
c453f898a0 Use (void) rather than () in function declarations
In C, a function declaration with () allows any set of arguments.
Use (void) to mean "no arguments".

* src/dep.h: Switch () to (void) for functions with no arguments.
* src/makeint.h: Ditto.
* src/os.h: Ditto.
* src/shuffle.h: Ditto.
* src/variable.h: Ditto.
2022-10-15 18:39:32 -04:00
Paul Smith
18c4b508ef [SV 63157] Ensure temporary files are removed when signaled
Original patch from Dmitry Goncharov <dgoncharov@users.sf.net>.
When handling a fatal signal ensure the temporary files for
stdin and the jobserver fifo (if in use) are deleted.

* src/makeint.h (temp_stdin_unlink): Declare a new method.
* src/main.c (temp_stdin_unlink): Delete the stdin temporary file
if it exists.  If the unlink fails and we're not handling a signal
then show an error.
(main): Call temp_stdin_unlink() instead of unlinking by hand.
* src/commands.c (fatal_error_signal): Invoke cleanup methods if
we're handling a fatal signal.
* tests/scripts/features/output-sync: Test signal handling during
output sync and jobserver with FIFO.
* tests/scripts/features/temp_stdin: Test signal handling when
makefiles are read from stdin.
2022-10-15 18:39:32 -04:00
Paul Smith
383eb3a923 * src/posixos.c (job_root): Remember root jobserver instances
(jobserver_setup): Set job_root to true.
(jobserver_clear): if we're the root instance and we're using a
FIFO, unlink it.  If we're not in a signal handler, free memory.
(jobserver_acquire_all): Call jobserver_clear().
(sync_root): Rename from sync_parent for consistency.
2022-10-15 18:39:32 -04:00
Paul Smith
01b1d4f401 Set the proper type for variables set in signal handlers
* bootstrap.conf: Get gnulib's sig_atomic_t type checking M4 macro.
* configure.ac: Invoke it.
* src/makeint.h (handling_fatal_signal): Set the type correctly.
* src/commands.c (handling_fatal_signal): Ditto.
2022-10-15 18:39:32 -04:00
Dmitry Goncharov
bf2d71498c * tests/test_driver.pl (toplevel): [SV 63156] Keep temp env vars 2022-10-08 11:53:19 -04:00
Paul Smith
3e20e376b7 Clean up some warnings on Windows builds
* src/arscan.c (parse_int): Avoid conversion from int to char and
check for overflow given a max value.
(ar_scan): Check intmax sizes then cast to the proper type.
(ar_member_touch): Get proper return type from ar_scan and cast it
to off_t.
* src/function.c (a_word_hash_cmp): Don't cast from size_t to int.
(func_filter_filterout): Count using unsigned long to avoid casts.
(construct_include_path): Explicitly cast to void*.
* src/shuffle.c (reverse_shuffle_array): Use size_t index.
* src/w32/subproc/sub_proc.c (process_wait_for_multiple_objects):
Initialize the return value in case the count is 0.
2022-10-03 16:08:14 -04:00
Paul Smith
7ddfc42ee3 * src/misc.c (make_lltoa): Use printf format macro from makeint.h
(make_ulltoa): Ditto.
2022-10-03 15:11:57 -04:00
Paul Smith
ca92d83cde * src/arscan.c (ar_scan): Avoid sign comparison warnings
Pacify 12.2.1 20220819 (Red Hat 12.2.1-2) -Wsign-compare by checking
the readbuf() return explicitly for errors then casting from ssize_t.
Initial patch provided by Paul Eggert <eggert@cs.ucla.edu>.
2022-10-03 15:11:57 -04:00
Paul Eggert
ae80eefe65 Support systems with 32-bit long and 64-bit time_t
Don't assume that time_t fits in long, as some hosts (e.g.,
glibc x86 -D_TIME_BITS=64) have 32-bit long and 64-bit time_t.

* bootstrap.conf (gnulib_modules): Add largefile, to support files
with timestamps after Y2038 on hosts with 32-bit long.
* configure.ac: Do not call AC_SYS_LARGEFILE, as the largefile module
does that for us.
* src/makeint.h (PRIdMAX, PRIuMAX, SCNdMAX): Define if not already
defined (taken from gnulib).
* src/ar.c: Include intprops.h, for TYPE_MAXIMUM, as
INTEGER_TYPE_MAXIMUM does not work on time_t without issuing a bunch
of warnings.
(ar_member_date): Check that result is in time_t range.
(ar_member_date_1): Use intmax_t to hold the date.
(ar_glob_match): Ditto.
* src/arscan.c (VMS_function, VMS_function_ret, ar_scan)
(parse_int, ar_scan, ar_member_pos, ar_member_touch)
(describe_member): Convert long int to intmax_t.
* src/file.c (file_timestamp_sprintf): Use intmax_t/uintmax_t instead
of long/unsigned long for values that might be time_t.
* src/arscan.c (ar_member_touch): Fix buffer overrun if the timestamp
is too large.
2022-10-03 15:11:57 -04:00
Paul Smith
01142a53c9 Add support for intmax_t
* configure.ac: Ask autoconf to detect it.
* src/config.ami.template: Add #define intmax_t for AmigaOS.
* src/config.h-vms.template: Add #define intmax_t for VMS.
* src/config.h.W32.template: Add #define intmax_t for Windows.
* src/configh.dos.template: Add #define intmax_t for MS-DOS/DJPP.
2022-10-03 15:11:57 -04:00
Paul Smith
dee6af912a * NEWS: Deprecate Xenix 2022-10-03 15:11:57 -04:00
Paul Smith
7296991d6c [SV 63098] Temporarily revert the change to pattern rule behavior
The fix for SV 12078 caused a backward-compatibility issue with some
makefiles.  In order to allow users to resolve this issue, revert
that change for this release cycle: it will be reinstated in the
next release cycle.  Introduce a warning if we detect that the recipe
of a multi-target pattern rule doesn't create all the targets.

* NEWS: Announce the future backward-incompatibility.
* doc/make.texi (Pattern Intro): Describe the behavior and that it
will change in the future.
* src/remake.c (check_also_make): Check for also_make targets that
were not created and generate a warning.
(update_goal_chain): Call the new function.
(check_dep): Ditto.
(update_file_1): Defer implicit rule detection until after we check
all the also_make files (as it used to be).
* tests/scripts/features/patternrules: Add tests of the new warning.
Skip the tests for SV 12078.
2022-10-02 10:18:21 -04:00
Paul Smith
d51ac70122 * doc/make.texi (Prerequisite Types): [SV 58056] Clarify ordering. 2022-10-02 09:30:20 -04:00
Paul Smith
3cb84fe933 * src/filedef.h (is_ordinary_mtime): Check for "ordinary" mod time.
* src/remake.c (update_file_1): Use the new macro.
2022-10-02 08:55:29 -04:00
Paul Smith
ad84ec2fdc * src/remake.c (update_file_1): Return valid enum element, not 0. 2022-10-02 08:55:29 -04:00
Paul Smith
26b9f30714 * NEWS: Announce deprecation of OS/2 and AmigaOS ports 2022-10-02 08:55:29 -04:00
Paul Smith
5ac80176a3 * src/main.c (main): Add debug output for jobserver and osync.
* src/posixos.c (jobserver_setup): Remove redundant debug output.
(jobserver_parse_auth): Ditto.
2022-10-02 08:46:00 -04:00
Andreas Schwab
c801a7fb67 [SV 63111] Ensure output-sync is cleaned on re-exec and recursion
Now that output-sync is using a separate file as a mutex rather than
stdout, ensure the new file descriptor is closed before re-exec and
not inherited by children.

* src/main.c (main): Call osync_clear() before re-exec.
* src/posixos.c (osync_setup): Reset output-sync handle inheritance.
(osync_parse_mutex): Ditto.

Copyright-paperwork-exempt: yes
2022-10-02 08:46:00 -04:00
Paul Smith
c2eddf9be2 * src/function.c: Change int to uint to align with gmk_func_ptr 2022-10-01 11:47:41 -04:00
Dmitry Goncharov
f8852311cc * doc/make.texi (Loaded Object API): [SV 63126] Fix typos and examples 2022-10-01 11:47:41 -04:00
Paul Smith
a99378ebe4 Implement a simple xorshift 32bit random number generator
Avoid relying on the system random number generator for our random
shuffle, so that the same seed gives the same results on all systems.
This generator doesn't need to be amazing, just pretty good, so don't
bother with xorshift* or xorshift+, etc.

* src/makeint.h: Declare make_seed() and make_rand().
* src/misc.c (make_seed): Set the seed value for the RNG.
(make_rand): Return the next random number.  If the seed was not set
initialize it first.
* src/shuffle.c (shuffle_set_mode): If we don't get a seed from the
user just leave it unset (0).
(shuffle_deps_recursive): Use make_seed() not srand().
(random_shuffle_array): Use make_rand() not rand().
2022-10-01 11:45:39 -04:00
Dmitry Goncharov
6c87f3fb85 [SV 63100] Set the floc of every created goal dep struct
* src/read.c (eval): Initialize the goaldep floc pointer.
* tests/scripts/features/loadapi: Verify that the floc is set after
unloading and reloading dynamic objects.
2022-09-25 17:09:08 -04:00
Paul Smith
38116baee9 * doc/make.texi: Update out of date behavior for grouped targets. 2022-09-25 16:58:36 -04:00
Paul Smith
614033f8c6 * README.git: Announce releases to the platform-testers list 2022-09-25 16:57:31 -04:00
Paul Smith
f3640ecf4f Provide new functions to convert long long to string
The previous attempt to use PRI* macros to avoid compiler-specific
printf format specifiers didn't work because we are using raw
long long type, not the uintX_t types.  On systems where long and
long long are the same size, uint64_t might be type "long" and PRId64
is just "ld".

Instead write new functions that convert [unsigned] long long to a
string and call those instead.

* src/makeint.h: Declare make_lltoa() and make_ulltoa().
* src/misc.c (make_lltoa): New function that writes a long long value
into a provided buffer.  Return the buffer for ease-of-use.
(make_ulltoa): Ditto, for unsigned long long.
* src/function.c (func_wordlist): Call these new methods.  Also
rework the error strings so we share the translated string.
* src/dir.c (print_dir_data_base): Call the new methods instead of
using MSVC macros.
2022-09-25 16:57:31 -04:00
Paul Smith
c4e232e44f Always restore global environ if we use vfork
We may change the global environ variable in the child; when using
vfork() this also sets it in the parent.  Preserve the parent's
environ in child_execute_job() so it takes effect for all callers.

Reported by Denis Excoffier <bug-tar@Denis-Excoffier.org>
Root cause found by Martin Dorey <Martin.Dorey@hitachivantara.com>

* src/job.c (start_job_command): Remove save/restore of the parent
environment.
(child_execute_job): Add save/restore of the parent environment,
if we use vfork().
* tests/scripts/functions/shell: Add a test the crashes if we don't
reset environ after we run $(shell ...).
2022-09-25 16:57:31 -04:00
Dmitry Goncharov
aa99e810a9 * configure.ac: [SV 63070] Clean up the test program for posix_spawn. 2022-09-25 16:57:13 -04:00
Paul Smith
8f49029561 * src/posixos.c (osync_clear): Don't close invalid FDs. 2022-09-25 13:37:12 -04:00
Paul Smith
f7ed583675 * maintMakefile: Use gnulib ncftpput-ftp if ncftpput is missing. 2022-09-25 13:37:12 -04:00
Paul Smith
cf7f7de7ae * src/misc.c (strncasecmp): Use size_t for length to match std.
* src/misc.h (strncasecmp): Fix the declaration.
2022-09-25 13:37:12 -04:00
Paul Smith
d4cb7ae6d4 * configure.ac: Update to GNU make 4.3.91
* NEWS: Update the version and clarify some backward-compat issues.
2022-09-25 13:37:12 -04:00
Eli Zaretskii
387d349dc8 Fix compiler warnings in the MS-Windows build.
* src/w32/w32os.c (osync_get_mutex, osync_parse_mutex): Cast to
DWORD_PTR when converting integers to HANDLEs and vice versa.

* src/w32/pathstuff.c (w32ify): Pacify compiler warnings about
'strncpy'.

* src/makeint.h (PRId64) [!HAVE_INTTYPES_H]: Define if undefined.
* src/function.c (func_wordlist): Use PRId64 instead of %lld.
2022-09-25 17:11:12 +03:00
Eli Zaretskii
caad0e2181 Avoid compilation warnings
* src/implicit.c: (pattern_search):
* src/main.c: (main): Avoid compilation warnings for variables
only used when compiling a debug version with assertions.
2022-09-24 21:15:41 +03:00
187 changed files with 5808 additions and 3572 deletions

16
.gitignore vendored
View File

@@ -34,10 +34,10 @@ config.log
config.status
configure
/mk/Posix.mk
stamp-h1
stamp-*
.dirstamp
gnulib
convert.sed
*.sed
# Build artifacts
.deps/
@@ -60,19 +60,17 @@ WinRel/
GccDebug/
GccRel/
# Test artifacts
makeerror-*
test-suite.log
# Distribution artifacts
.dep_segment
.check-git-HEAD
ChangeLog
README
README.DOS
README.OS2
README.W32
build.cfg
config.ami
config.h-vms
config.h.W32
configh.dos
mkconfig.h
make-[0-9]*/
make-[0-9]*.tar.*
checkcfg.*.log

30
AUTHORS
View File

@@ -1,15 +1,17 @@
-----------------------------------
GNU make development up to version 3.75 by:
Roland McGrath <roland@gnu.org>
Development starting with GNU make 3.76 by:
GNU Make development starting with GNU Make 3.76 by:
Paul D. Smith <psmith@gnu.org>
Additional development starting with GNU make 3.81 by:
Additional development starting with GNU Make 4.3 by:
Dmitry Goncharov <dgoncharov@users.sf.net>
Additional development starting with GNU Make 3.81 by:
Boris Kolpackov <boris@kolpackov.net>
GNU Make development up to version 3.75 by:
Roland McGrath <roland@gnu.org>
GNU Make User's Manual
Written by:
Richard M. Stallman <rms@gnu.org>
@@ -21,7 +23,7 @@ GNU Make User's Manual
Paul D. Smith <psmith@gnu.org>
-----------------------------------
GNU make porting efforts:
GNU Make porting efforts:
Port to VMS by:
Klaus Kaempf <kkaempf@progis.de>
@@ -44,6 +46,11 @@ GNU make porting efforts:
Andreas Beuning <andreas.buening@nexgo.de>
Earnie Boyd <earnie@uses.sf.net>
Troy Runkel <Troy.Runkel@mathworks.com>
Juan M. Guerrero <juan.guerrero@gmx.de>
KO Myung-Hun <komh78@gmail.com>
Port to z/OS by:
Igor Todorovski <itodorov@ca.ibm.com>
-----------------------------------
Other contributors:
@@ -63,7 +70,7 @@ Other contributors:
Paul Eggert <eggert@twinsun.com>
Mike Frysinger <vapier@gentoo.org>
Ramon Garcia Fernandez <ramon.garcia.f@gmail.com>
Dmitry Goncharov <dgoncharov@users.sf.net>
Noah Goldstein <goldstein.w.n@gmail.com>
Mike Haboustak <haboustak@gmail.com>
Frank Heckenbach <f.heckenbach@fh-soft.de>
Klaus Heinz <kamar@ease.rhein-main.de>
@@ -85,12 +92,13 @@ Other contributors:
Thomas Riedl <thomas.riedl@siemens.com>
Jaak Ristioja <jaak@ristioja.ee>
Christoph Schulz <develop@kristov.de>
Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
Andreas Schwab <schwab@suse.de>
spagoveanu <spagoveanu@gmail.com>
Carl Staelin (Princeton University)
Ian Stewartson (Data Logic Limited)
Tobias Stoeckmann <tobias@stoeckmann.org>
Sergei Trofimovich <siarheit@google.com>
Justine Tunney <jtunney@gmail.com>
Marc Ullman <marc@mathworks.com>
Christof Warlich <cwarlich@gmx.de>
Florian Weimer <fweimer@redhat.com>
@@ -103,7 +111,7 @@ With suggestions/comments/bug reports from a cast of ... well ...
hundreds, anyway :)
-------------------------------------------------------------------------------
Copyright (C) 1997-2022 Free Software Foundation, Inc.
Copyright (C) 1997-2023 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
@@ -116,4 +124,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1,16 +1,16 @@
# Basic GNU -*-Makefile-*- to build GNU make
# Basic GNU -*-Makefile-*- to build GNU Make
#
# NOTE:
# If you have no 'make' program at all to process this makefile:
# * On Windows, run ".\buildw32.bat" to bootstrap one.
# * On Windows, run ".\build_w32.bat" to bootstrap one.
# * On MS-DOS, run ".\builddos.bat" to bootstrap one.
#
# Once you have a GNU make program created, you can use it with this makefile
# Once you have a GNU Make program created, you can use it with this makefile
# to keep it up to date if you make changes, as:
#
# make.exe -f Basic.mk
#
# Copyright (C) 2017-2022 Free Software Foundation, Inc.
# Copyright (C) 2017-2023 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
@@ -24,7 +24,7 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
all:
@@ -39,7 +39,6 @@ w32_SOURCES = %w32_SOURCES%
vms_SOURCES = %vms_SOURCES%
amiga_SOURCES = %amiga_SOURCES%
posix_SOURCES = $(src)posixos.c
remote_SOURCES = $(src)remote-stub.c
OUTDIR =
@@ -104,9 +103,7 @@ CP.cmd = cp $1 $2
CLEANSPACE = $(call RM.cmd,$(OBJECTS) $(PROG) $(BUILT_SOURCES))
# Load overrides for the above variables.
include $(firstword $(wildcard $(SRCDIR)/mk/$(lastword $(subst -, ,$(MAKE_HOST)).mk) $(OUTDIR)mk/Posix.mk $(SRCDIR)/mk/Posix.mk))
VERSION = %VERSION%
include $(firstword $(wildcard $(SRCDIR)/mk/$(lastword $(subst -, ,$(MAKE_HOST)).mk)))
VPATH = $(SRCDIR)

View File

@@ -4994,4 +4994,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1322,7 +1322,7 @@
non-standard versions of free() don't like it.
* configure.in (--enable-dmalloc): Install some support for using
dmalloc (http://www.dmalloc.com/) with make. Use --enable-dmalloc
dmalloc (https://www.dmalloc.com/) with make. Use --enable-dmalloc
with configure to enable it.
* function.c (function_table_entry): Whoops! The function.c
@@ -6632,7 +6632,7 @@ Fri Nov 1 19:34:28 1991 Roland McGrath (roland@churchy.gnu.ai.mit.edu)
See ChangeLog.1, available in the Git repository at:
http://git.savannah.gnu.org/cgit/make.git/tree/
https://git.savannah.gnu.org/cgit/make.git/tree/
for earlier changes.
@@ -6650,4 +6650,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -664,7 +664,7 @@
characters in its name, pass NULL as the first argument to
CreateProcess. This avoids weird failures due to buggy quoting by
CreateProcess. For the details, see the discussion starting at
http://lists.gnu.org/archive/html/make-w32/2013-04/msg00008.html.
https://lists.gnu.org/archive/html/make-w32/2013-04/msg00008.html.
* load.c (load_object, load_file): Accept an additional argument
DLP and return in it a pointer that can be used to unload the
@@ -706,7 +706,7 @@
(construct_command_argv_internal): Don't treat a backslash as an
escape character before whitespace, if the shell is not a Posix
shell. For the description of the problem, see
http://lists.gnu.org/archive/html/make-w32/2013-04/msg00014.html.
https://lists.gnu.org/archive/html/make-w32/2013-04/msg00014.html.
2013-05-01 Paul Smith <psmith@gnu.org>
@@ -1392,7 +1392,7 @@
2011-09-16 Paul Smith <psmith@gnu.org>
* maintMakefile (do-po-update): Apparently we have to avoid
certificate checks on the http://translationproject.org site now.
certificate checks on the https://translationproject.org site now.
2011-09-12 Paul Smith <psmith@gnu.org>
@@ -5612,7 +5612,7 @@
See ChangeLog.2, available in the Git repository at:
http://git.savannah.gnu.org/cgit/make.git/tree/
https://git.savannah.gnu.org/cgit/make.git/tree/
for earlier changes.
@@ -5630,4 +5630,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1,6 +1,6 @@
# This is a -*-Makefile-*-, or close enough
#
# Copyright (C) 1997-2022 Free Software Foundation, Inc.
# Copyright (C) 1997-2023 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
@@ -14,7 +14,7 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
AUTOMAKE_OPTIONS = dist-lzip silent-rules std-options subdir-objects nostdinc
ACLOCAL_AMFLAGS = -I m4
@@ -34,8 +34,8 @@ make_SRCS = src/ar.c src/arscan.c src/commands.c src/commands.h \
src/getopt.h src/getopt1.c src/gettext.h src/guile.c \
src/hash.c src/hash.h src/implicit.c src/job.c src/job.h \
src/load.c src/loadapi.c src/main.c src/makeint.h src/misc.c \
src/os.h src/output.c src/output.h src/read.c src/remake.c \
src/rule.c src/rule.h src/shuffle.h src/shuffle.c \
src/mkcustom.h src/os.h src/output.c src/output.h src/read.c \
src/remake.c src/rule.c src/rule.h src/shuffle.h src/shuffle.c \
src/signame.c src/strcache.c src/variable.c src/variable.h \
src/version.c src/vpath.c
@@ -112,7 +112,7 @@ test_FILES = tests/run_make_tests tests/run_make_tests.bat \
# test/scripts are added via dist-hook below.
EXTRA_DIST = ChangeLog INSTALL README build.sh build.cfg.in $(man_MANS) \
README.customs README.OS2 \
src/mkconfig.h README.customs README.OS2 README.zOS \
README.Amiga SCOPTIONS src/config.ami \
README.DOS builddos.bat src/configh.dos \
README.W32 build_w32.bat src/config.h.W32 \
@@ -137,14 +137,14 @@ src/gmk-default.h: $(top_srcdir)/src/gmk-default.scm
dist-hook:
(cd $(top_srcdir); \
sub=`find tests/scripts -follow \( -name .git -o -name .deps -o -name work -o -name .gitignore -o -name \*.orig -o -name \*.rej -o -name \*~ -o -name \*.out -o -name Makefile \) -prune -o -type f -print`; \
tar chf - $$sub) \
| (cd $(distdir); tar xfBp -)
$(AMTAR) chf - $$sub) \
| (cd $(distdir); $(AMTAR) xfBp -)
# --------------- Local CHECK Section
check-local: check-regression
@banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \
@banner=" Regression PASSED: $(PACKAGE_STRING) ($(MAKE_HOST)) built with $(CC) "; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo; \
echo "$$dashes"; \
@@ -162,9 +162,25 @@ MAKETESTFLAGS =
.PHONY: check-regression
GMK_OUTDIR=..
GMK_OUTDIR = ..
testlog = test-suite.log
testresult = tests/.test-result
errorpre = makeerror-$(PACKAGE_VERSION)-$(host_triplet)
testfiles = $(testlog) $(testresult) $(errorfile)
MOSTLYCLEANFILES = $(testfiles)
errordetails = config.status config.log src/config.h src/mkconfig.h \
$(testlog) tests/work
# Create a 4-letter random sequence
rand_value = c = "abcdefghijklmnopqrstuvwxyz0123456789"
rand_char = substr(c,int(rand()*36),1)
rand_string = $(AWK) 'BEGIN{srand(); $(rand_value); print $(rand_char) "" $(rand_char) "" $(rand_char) "" $(rand_char);}'
check-regression: tests/config-flags.pm
@rm -f $(testfiles)
@if test -f '$(top_srcdir)/tests/run_make_tests'; then \
ulimit -n 128; \
if $(PERL) -v >/dev/null 2>&1; then \
@@ -177,12 +193,21 @@ check-regression: tests/config-flags.pm
done; fi ;; \
esac; \
echo "cd tests && $(PERL) $(PERLFLAGS) ./run_make_tests.pl -srcdir $(abs_top_srcdir) -make $(GMK_OUTDIR)/make$(EXEEXT) $(MAKETESTFLAGS)"; \
cd tests && $(PERL) $(PERLFLAGS) ./run_make_tests.pl -srcdir '$(abs_top_srcdir)' -make '$(GMK_OUTDIR)/make$(EXEEXT)' $(MAKETESTFLAGS); \
(cd tests && $(PERL) $(PERLFLAGS) ./run_make_tests.pl -srcdir '$(abs_top_srcdir)' -make '$(GMK_OUTDIR)/make$(EXEEXT)' $(MAKETESTFLAGS); echo $$? >.test-result) 2>&1 | tee $(testlog); \
er=$$(cat $(testresult)); if test "$$er" -ne 0; then \
dirnm="$(errorpre)-$$($(rand_string))"; fnm="$$dirnm.tar.gz"; \
rm -rf "$$dirnm"; mkdir "$$dirnm"; \
$(AMTAR) chf - $(errordetails) | (cd "$$dirnm"; $(AMTAR) xf -); \
$(AMTAR) chf - "$$dirnm" | eval GZIP= gzip $(GZIP_ENV) -c >"$$fnm"; \
echo "*** Testing FAILED! Details: $$fnm"; \
echo '*** Please report to <$(PACKAGE_BUGREPORT)>'; echo; \
exit $$er; \
fi; \
else \
echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
fi; \
else \
echo "Can't find the GNU Make test suite ($(top_srcdir)/tests)."; \
echo "Can't find the $(PACKAGE_NAME) test suite ($(top_srcdir)/tests)."; \
fi

246
NEWS
View File

@@ -1,20 +1,96 @@
GNU make NEWS -*-indented-text-*-
GNU Make NEWS -*-indented-text-*-
History of user-visible changes.
20 September 2022
26 February 2023
See the end of this file for copyrights and conditions.
All user-visible changes are more fully described in the GNU make manual,
All user-visible changes are more fully described in the GNU Make manual,
which is contained in this distribution as the file doc/make.texi.
See the README file and the GNU make manual for instructions for
See the README file and the GNU Make manual for instructions for
reporting bugs.
Version 4.3.90 (20 Sep 2022)
Version 4.4.1 (26 Feb 2023)
This release is primarily a bug-fix release.
A complete list of bugs fixed in this version is available here:
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=110&set=custom
* WARNING: Backward-incompatibility!
In previous releases it was not well-defined when updates to MAKEFLAGS made
inside a makefile would be visible. This release ensures they are visible
immediately, even when invoking $(shell ...) functions. Also, command line
variable assignments are now always present in MAKEFLAGS, even when parsing
makefiles.
Implementation provided by Dmitry Goncharov <dgoncharov@users.sf.net>
* New feature: Parallel builds of archives
Previously it was not possible to use parallel builds with archives. It is
still not possible using the built-in rules, however you can now override
the built-in rules with a slightly different set of rules and use parallel
builds with archive creation. See the "Dangers When Using Archives" section
of the GNU Make manual, and https://savannah.gnu.org/bugs/index.php?14927
* Previously target-specific variables would inherit their "export" capability
from parent target-specific variables even if they were marked private. Now
private parent target-specific variables have no affect. For more details
see https://savannah.gnu.org/bugs/index.php?61463
* Disable FIFO jobserver on GNU/Hurd and Cygwin
Experimentation shows that the new FIFO-based jobserver doesn't work well on
GNU/Hurd or Cygwin: revert these systems to use the pipe-based jobserver.
* Updates to allow building on OS/2
Provided by KO Myung-Hun <komh78@gmail.com>
* New platform: GNU Make is supported on z/OS
Thanks to Igor Todorovski <itodorov@ca.ibm.com> for the patches and testing
assistance.
Version 4.4 (31 Oct 2022)
A complete list of bugs fixed in this version is available here:
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&set=custom
* WARNING: Deprecation!
The following systems are deprecated in this release:
- OS/2 (EMX)
- AmigaOS
- Xenix
- Cray
In the NEXT release of GNU Make, support for these systems will be removed.
If you want to see them continue to be supported, contact <bug-make@gnu.org>.
* WARNING: Future backward-incompatibility!
In the NEXT release of GNU Make, pattern rules will implement the same
behavior change for multiple targets as explicit grouped targets, below: if
any target of the rule is needed by the build, the recipe will be invoked if
any target of the rule is missing or out of date. During testing some
makefiles were found to contain pattern rules that do not build all targets;
this can cause issues so we are delaying this change for one release cycle
to allow these makefiles to be updated. GNU Make shows a warning if it
detects this situation: "pattern recipe did not update peer target".
* WARNING: Backward-incompatibility!
GNU Make now uses temporary files in more situations than previous releases.
If your build system sets TMPDIR (or TMP or TEMP on Windows) and deletes the
contents during the build, or uses restrictive permissions, this may cause
problems. You can choose an alternative temporary directory only for use by
GNU Make by setting the new MAKE_TMPDIR environment variable before invoking
make. Note that this value CANNOT be set inside the makefile, since make
needs to find its temporary directory before the makefiles are parsed.
* WARNING: Backward-incompatibility!
Previously each target in a explicit grouped target rule was considered
individually: if the targets needed by the build were not out of date the
recipe was not run even if other targets in the group were out of date. Now
if any of the grouped targets are needed by the build, then if any of the
grouped targets are out of date the recipe is run and all targets in the
group are considered updated.
* WARNING: Backward-incompatibility!
Previously if --no-print-directory was seen anywhere in the environment or
command line it would take precedence over any --print-directory. Now, the
@@ -26,7 +102,7 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&se
stated, but it was (roughly) the inverse of the order in which they were
processed by make. In this release, the order in which makefiles are
rebuilt is the same order in which make processed them, and this is defined
to be true in the GNU make manual.
to be true in the GNU Make manual.
* WARNING: Backward-incompatibility!
Previously only simple (one-letter) options were added to the MAKEFLAGS
@@ -43,14 +119,14 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&se
To detect this change search for 'shell-export' in the .FEATURES variable.
* WARNING: New build requirement
GNU make utilizes facilities from GNU Gnulib: Gnulib requires certain C99
features in the C compiler and so these features are required by GNU make:
GNU Make utilizes facilities from GNU Gnulib: Gnulib requires certain C99
features in the C compiler and so these features are required by GNU Make:
https://www.gnu.org/software/gnulib/manual/html_node/C99-features-assumed.html
The configure script should verify the compiler has these features.
* New feature: The .WAIT special target
If the .WAIT target appears between two prerequisites of a target, then
GNU make will wait for all of the targets to the left of .WAIT in the list
GNU Make will wait for all of the targets to the left of .WAIT in the list
to complete before starting any of the targets to the right of .WAIT.
This feature is available in some other versions of make, and it will be
required by an upcoming version of the POSIX standard for make.
@@ -64,7 +140,7 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&se
each prerequisite).
* New feature: The .NOTINTERMEDIATE special target
.NOTINTERMEDIATE Disables intermediate behavior for specific files, for all
.NOTINTERMEDIATE disables intermediate behavior for specific files, for all
files built using a pattern, or for the entire makefile.
Implementation provided by Dmitry Goncharov <dgoncharov@users.sf.net>
@@ -80,7 +156,7 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&se
Implementation provided by Jouke Witteveen <j.witteveen@gmail.com>
* New feature: Improved support for -l / --load-average
On systems that provide /proc/loadavg (Linux), GNU make will use it to
On systems that provide /proc/loadavg (Linux), GNU Make will use it to
determine the number of runnable jobs and use this as the current load,
avoiding the need for heuristics.
Implementation provided by Sven C. Dack <sdack@gmx.com>
@@ -95,24 +171,16 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&se
* New feature: The --jobserver-style command line option and named pipes
A new jobserver method is used on systems where mkfifo(3) is supported.
This solves a number of obscure issues related to using the jobserver
and recursive invocations of GNU make. This change means that sub-makes
and recursive invocations of GNU Make. This change means that sub-makes
will connect to the jobserver even if they are not marked as recursive.
It also means that other tools that want to participate in the jobserver
will need to be enhanced as described in the GNU make manual.
You can force GNU make to use the simple pipe-based jobserver (perhaps if
you are integrating with other tools or older versions of GNU make) by
will need to be enhanced as described in the GNU Make manual.
You can force GNU Make to use the simple pipe-based jobserver (perhaps if
you are integrating with other tools or older versions of GNU Make) by
adding the '--jobserver-style=pipe' option to the command line of the
top-level invocation of GNU make, or via MAKEFLAGS or GNUMAKEFLAGS.
top-level invocation of GNU Make, or via MAKEFLAGS or GNUMAKEFLAGS.
To detect this change search for 'jobserver-fifo' in the .FEATURES variable.
* New feature: The MAKE_TMPDIR environment variable
If you prefer that GNU make place temporary files in a different directory
than the standard TMPDIR (or TMP or TEMP on Windows), set the MAKE_TMPDIR
environment variable before starting make (this value CANNOT be set inside
the makefile, since make needs to find its temporary directory before the
makefiles are parsed). This is useful for build systems which reset TMPDIR
and clean it out during the build process.
* Some POSIX systems (*BSD) do not allow locks to be taken on pipes, which
caused the output sync feature to not work properly there. Also multiple
invocations of make redirecting to the same output file (e.g., /dev/null)
@@ -120,16 +188,16 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&se
performance characteristics, but is not portable) create a temporary file
and lock that. Windows continues to use a mutex as before.
* GNU make has sometimes chosen unexpected, and sub-optimal, chains of
* GNU Make has sometimes chosen unexpected, and sub-optimal, chains of
implicit rules due to the definition of "ought to exist" in the implicit
rule search algorithm, which considered any prerequisite mentioned in the
makefile as "ought to exist". This algorithm has been modified to prefer
prerequisites mentioned explicitly in the target being built and only if
that results in no matching rule, will GNU make consider prerequisites
that results in no matching rule, will GNU Make consider prerequisites
mentioned in other targets as "ought to exist".
Implementation provided by Dmitry Goncharov <dgoncharov@users.sf.net>
* GNU make was performing secondary expansion of all targets, even targets
* GNU Make was performing secondary expansion of all targets, even targets
which didn't need to be considered during the build. In this release
only targets which are considered will be secondarily expanded.
Implementation provided by Dmitry Goncharov <dgoncharov@users.sf.net>
@@ -141,7 +209,7 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&se
* The -I option accepts an argument "-" (e.g., "-I-") which means "reset the
list of search directories to empty". Among other things this can be used
to prevent GNU make from searching in its default list of directories.
to prevent GNU Make from searching in its default list of directories.
* New debug option "print" will show the recipe to be run, even when silent
mode is set, and new debug option "why" will show why a target is rebuilt
@@ -158,9 +226,9 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=109&se
* Special targets like .POSIX are detected upon definition, ensuring that any
change in behavior takes effect immediately, before the next line is parsed.
* When the jobserver is enabled and GNU make decides it is invoking a non-make
sub-process and closes the jobserver pipes, it will now add a new option to
the MAKEFLAGS environment variable that disables the jobserver.
* When the pipe-based jobserver is enabled and GNU Make decides it is invoking
a non-make sub-process and closes the jobserver pipes, it will now add a new
option to the MAKEFLAGS environment variable that disables the jobserver.
This prevents sub-processes that invoke make from accidentally using other
open file descriptors as jobserver pipes. For more information see
https://savannah.gnu.org/bugs/?57242 and https://savannah.gnu.org/bugs/?62397
@@ -217,7 +285,7 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&se
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.
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
@@ -238,7 +306,7 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&se
* 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 posix_spawn() on systems where it is available.
* 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>
@@ -255,17 +323,17 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&se
* A new option -E has been added as a short alias for --eval.
* All wildcard expansion within GNU make, including $(wildcard ...), will sort
* All wildcard expansion within GNU Make, including $(wildcard ...), will sort
the results. See https://savannah.gnu.org/bugs/index.php?52076
* Interoperate with newer GNU libc and musl C runtime libraries.
* Performance improvements provided by Paolo Bonzini <pbonzini@redhat.com>
GNU make Developer News
GNU Make Developer News
* Import the GNU standard bootstrap script to replace the hand-rolled
"make update" method for building code from a GNU make Git repository.
"make update" method for building code from a GNU Make Git repository.
* Rework the source distribution to move source files into the src/*
subdirectory. This aligns with modern best practices in GNU.
@@ -299,11 +367,11 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=106&se
The function is expanded to the contents of the file. The contents are
expanded verbatim except that the final newline, if any, is stripped.
* The makefile line numbers shown by GNU make now point directly to the
* The makefile line numbers shown by GNU Make now point directly to the
specific line in the recipe where the failure or warning occurred.
Sample changes suggested by Brian Vandenberg <phantall@gmail.com>
* The interface to GNU make's "jobserver" is stable as documented in the
* The interface to GNU Make's "jobserver" is stable as documented in the
manual, for tools which may want to access it.
WARNING: Backward-incompatibility! The internal-only command line option
@@ -338,7 +406,7 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=105&se
requested mode, then closed again.
* Change the fatal error for mixed explicit and implicit rules, that was
introduced in GNU make 3.82, to a non-fatal error. However, this syntax is
introduced in GNU Make 3.82, to a non-fatal error. However, this syntax is
still deprecated and may return to being illegal in a future version of GNU
make. Makefiles that rely on this syntax should be fixed.
See https://savannah.gnu.org/bugs/?33034
@@ -386,7 +454,7 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&se
single space
* New feature: GNU Guile integration
This version of GNU make can be compiled with GNU Guile integration.
This version of GNU Make can be compiled with GNU Guile integration.
GNU Guile serves as an embedded extension language for make.
See the "Guile Function" section in the GNU Make manual for details.
Currently GNU Guile 1.8 and 2.0+ are supported. In Guile 1.8 there is no
@@ -418,20 +486,20 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&se
* New feature: "!=" shell assignment operator as an alternative to the
$(shell ...) function. Implemented for compatibility with BSD makefiles.
Note there are subtle differences between "!=" and $(shell ...). See the
description in the GNU make manual.
description in the GNU Make manual.
WARNING: Backward-incompatibility!
Variables ending in "!" previously defined as "variable!= value" will now be
interpreted as shell assignment. Change your assignment to add whitespace
between the "!" and "=": "variable! = value"
* New feature: "::=" simple assignment operator as defined by POSIX in 2012.
This operator has identical functionality to ":=" in GNU make, but will be
This operator has identical functionality to ":=" in GNU Make, but will be
portable to any implementation of make conforming to a sufficiently new
version of POSIX (see http://austingroupbugs.net/view.php?id=330). It is
version of POSIX (see https://austingroupbugs.net/view.php?id=330). It is
not necessary to define the .POSIX target to access this operator.
* New feature: Loadable objects
This version of GNU make contains a "technology preview": the ability to
This version of GNU Make contains a "technology preview": the ability to
load dynamic objects into the make runtime. These objects can be created by
the user and can add extended functionality, usable by makefiles.
@@ -439,8 +507,8 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&se
* New variable: $(GNUMAKEFLAGS) will be parsed for make flags, just like
MAKEFLAGS is. It can be set in the environment or the makefile, containing
GNU make-specific flags to allow your makefile to be portable to other
versions of make. Once this variable is parsed, GNU make will set it to the
GNU Make-specific flags to allow your makefile to be portable to other
versions of make. Once this variable is parsed, GNU Make will set it to the
empty string so that flags will not be duplicated on recursion.
* New variable: `MAKE_HOST' gives the name of the host architecture
@@ -481,7 +549,7 @@ A complete list of bugs fixed in this version is available here:
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
* Compiling GNU Make now requires a conforming ISO C 1989 compiler and
standard runtime library.
* WARNING: Backward-incompatibility!
@@ -489,7 +557,7 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&se
fundamentally incompatible way: make is required to invoke the shell as if
the '-e' flag were provided. Because this would break many makefiles that
have been written to conform to the original text of the standard, the
default behavior of GNU make remains to invoke the shell with simply '-c'.
default behavior of GNU Make remains to invoke the shell with simply '-c'.
However, any makefile specifying the .POSIX special target will follow the
new POSIX standard and pass '-e' to the shell. See also .SHELLFLAGS
below.
@@ -598,9 +666,9 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&se
* A note on appending the redirected output. With this change, a simple
mechanism is implemented to make ">>" work in action lines. In VMS
there is no simple feature like ">>" to have DCL command or program
output redirected and appended to a file. GNU make for VMS already
output redirected and appended to a file. GNU Make for VMS already
implements the redirection of output. If such a redirection is detected,
an ">" on the action line, GNU make creates a DCL command procedure to
an ">" on the action line, GNU Make creates a DCL command procedure to
execute the action and to redirect its output. Based on that, now ">>"
is also recognized and a similar but different command procedure is
created to implement the append. The main idea here is to create a
@@ -609,7 +677,7 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&se
in the command procedure to keep changes in make small and simple. This
obviously has some limitations but it seems good enough compared with
the current ">" implementation. (And in my opinion, redirection is not
really what GNU make has to do.) With this approach, it may happen that
really what GNU Make has to do.) With this approach, it may happen that
the temporary file is not yet appended and is left in SYS$SCRATCH.
The temporary file names look like "CMDxxxxx.". Any time the created
command procedure can not complete, this happens. Pressing Ctrl+Y to
@@ -632,9 +700,9 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&se
Version 3.81 (01 Apr 2006)
* GNU make is ported to OS/2.
* GNU Make is ported to OS/2.
* GNU make is ported to MinGW. The MinGW build is only supported by
* GNU Make is ported to MinGW. The MinGW build is only supported by
the build_w32.bat batch file; see the file README.W32 for more
details.
@@ -642,12 +710,12 @@ Version 3.81 (01 Apr 2006)
Up to and including this release, the '$?' variable does not contain
any prerequisite that does not exist, even though that prerequisite
might have caused the target to rebuild. Starting with the _next_
release of GNU make, '$?' will contain all prerequisites that caused
release of GNU Make, '$?' will contain all prerequisites that caused
the target to be considered out of date.
See https://savannah.gnu.org/bugs/?16051
* WARNING: Backward-incompatibility!
GNU make now implements a generic "second expansion" feature on the
GNU Make now implements a generic "second expansion" feature on the
prerequisites of both explicit and implicit (pattern) rules. In order
to enable this feature, the special target '.SECONDEXPANSION' must be
defined before the first target which takes advantage of it. If this
@@ -665,23 +733,23 @@ Version 3.81 (01 Apr 2006)
of this SysV feature you will need to update them.
* WARNING: Backward-incompatibility!
In order to comply with POSIX, the way in which GNU make processes
In order to comply with POSIX, the way in which GNU Make processes
backslash-newline sequences in recipes has changed. If your makefiles
use backslash-newline sequences inside of single-quoted strings in
recipes you will be impacted by this change. See the GNU make manual
recipes you will be impacted by this change. See the GNU Make manual
subsection "Splitting Recipe Lines" (node "Splitting Lines"), in
section "Recipe Syntax", chapter "Writing Recipe in Rules", for
details.
* WARNING: Backward-incompatibility!
Some previous versions of GNU make had a bug where "#" in a function
Some previous versions of GNU Make had a bug where "#" in a function
invocation such as $(shell ...) was treated as a make comment. A
workaround was to escape these with backslashes. This bug has been
fixed: if your makefile uses "\#" in a function invocation the
backslash is now preserved, so you'll need to remove it.
* New command line option: -L (--check-symlink-times). On systems that
support symbolic links, if this option is given then GNU make will
support symbolic links, if this option is given then GNU Make will
use the most recent modification time of any symbolic links that are
used to resolve target files. The default behavior remains as it
always has: use the modification time of the actual target file only.
@@ -701,16 +769,16 @@ Version 3.81 (01 Apr 2006)
call are now masked in the context of the inner call.
* Implemented a solution for the "thundering herd" problem with "-j -l".
This version of GNU make uses an algorithm suggested by Thomas Riedl
This version of GNU Make uses an algorithm suggested by Thomas Riedl
<thomas.riedl@siemens.com> to track the number of jobs started in the
last second and artificially adjust GNU make's view of the system's
last second and artificially adjust GNU Make's view of the system's
load average accordingly.
* New special variables available in this release:
- .INCLUDE_DIRS: Expands to a list of directories that make searches
for included makefiles.
- .FEATURES: Contains a list of special features available in this
version of GNU make.
version of GNU Make.
- .DEFAULT_GOAL: Set the name of the default goal make will
use if no goals are provided on the command line.
- MAKE_RESTARTS: If set, then this is the number of times this
@@ -748,7 +816,7 @@ Version 3.81 (01 Apr 2006)
it will be set in the environment, just as before.
* On MS Windows systems, explicitly setting SHELL to a pathname ending
in "cmd" or "cmd.exe" (case-insensitive) will force GNU make to use
in "cmd" or "cmd.exe" (case-insensitive) will force GNU Make to use
the DOS command interpreter in batch mode even if a UNIX-like shell
could be found on the system.
@@ -780,7 +848,7 @@ Version 3.80 (03 Oct 2002)
requiring that target A will always be rebuilt if target B is updated.
Patch for this feature provided by Greg McGary <greg@mcgary.org>.
* For compatibility with SysV make, GNU make now supports the peculiar
* For compatibility with SysV make, GNU Make now supports the peculiar
syntax $$@, $$(@D), and $$(@F) in the prerequisites list of a rule.
This syntax is only valid within explicit and static pattern rules: it
cannot be used in implicit (suffix or pattern) rules. Edouard G. Parmelan
@@ -805,7 +873,7 @@ Version 3.80 (03 Oct 2002)
useful here.
* A new built-in variable is defined, $(MAKEFILE_LIST). It contains a
list of each makefile GNU make has read, or started to read, in the
list of each makefile GNU Make has read, or started to read, in the
order in which they were encountered. So, the last filename in the
list when a makefile is just being read (before any includes) is the
name of the current makefile.
@@ -815,7 +883,7 @@ Version 3.80 (03 Oct 2002)
makefiles at that moment.
* A new command line option is defined, -B or --always-make. If
specified GNU make will consider all targets out-of-date even if they
specified GNU Make will consider all targets out-of-date even if they
would otherwise not be.
* The arguments to $(call ...) functions were being stored in $1, $2,
@@ -840,7 +908,7 @@ Version 3.80 (03 Oct 2002)
Turkish.
* Updated internationalization support to Gettext 0.11.5.
GNU make now uses Gettext's "external" feature, and does not include
GNU Make now uses Gettext's "external" feature, and does not include
any internationalization code itself. Configure will search your
system for an existing implementation of GNU Gettext (only GNU Gettext
is acceptable) and use it if it exists. If not, NLS will be disabled.
@@ -872,7 +940,7 @@ Version 3.80 (03 Oct 2002)
available ECOs for VMS V7.1 and newer versions. It is fixed in versions
shipped with newer VMS versions and all ECO kits after October 1999. It
only shows up during the daylight saving time period (DST): stat()
returns a modification time 1 hour ahead. This results in GNU make
returns a modification time 1 hour ahead. This results in GNU Make
warning messages. For a just created source you will see:
$ gmake x.exe
@@ -900,11 +968,11 @@ Version 3.79.1 (23 Jun 2000)
Version 3.79 (04 Apr 2000)
* GNU make optionally supports internationalization and locales via the
* GNU Make optionally supports internationalization and locales via the
GNU gettext (or local gettext if suitable) package. See the ABOUT-NLS
file for more information on configuring GNU make for NLS.
file for more information on configuring GNU Make for NLS.
* Previously, GNU make quoted variables such as MAKEFLAGS and
* Previously, GNU Make quoted variables such as MAKEFLAGS and
MAKEOVERRIDES for proper parsing by the shell. This allowed them to
be used within make build scripts. However, using them there is not
proper behavior: they are meant to be passed to subshells via the
@@ -938,12 +1006,12 @@ Version 3.79 (04 Apr 2000)
value is greater than the "end" value. If that's true, nothing is
returned.
* Hartmut Becker provided many updates for the VMS port of GNU make.
* Hartmut Becker provided many updates for the VMS port of GNU Make.
See the README.VMS file for more details.
* VMS-specific changes:
* Fix a problem with automatically remaking makefiles. GNU make uses an
* Fix a problem with automatically remaking makefiles. GNU Make uses an
execve to restart itself after a successful remake of the makefile. On
UNIX systems execve replaces the running program with a new one and
resets all signal handling to the default. On VMS execve creates a child
@@ -1021,7 +1089,7 @@ Version 3.78 (22 Sep 1999)
* A "job server" feature, suggested by Howard Chu <hyc@highlandsun.com>.
On systems that support POSIX pipe(2) semantics, GNU make can now pass
On systems that support POSIX pipe(2) semantics, GNU Make can now pass
-jN options to submakes rather than forcing them all to use -j1. The
top make and all its sub-make processes use a pipe to communicate with
each other to ensure that no more than N jobs are started across all
@@ -1029,20 +1097,20 @@ Version 3.78 (22 Sep 1999)
with the --disable-job-server option.
* The confusing term "dependency" has been replaced by the more accurate
and standard term "prerequisite", both in the manual and in all GNU make
and standard term "prerequisite", both in the manual and in all GNU Make
output.
* GNU make supports the "big archive" library format introduced in AIX 4.3.
* GNU Make supports the "big archive" library format introduced in AIX 4.3.
* GNU make supports large files on AIX, HP-UX, and IRIX. These changes
* GNU Make supports large files on AIX, HP-UX, and IRIX. These changes
were provided by Paul Eggert <eggert@twinsun.com>. (Large file
support for Solaris and Linux was introduced in 3.77, but the
configuration had issues: these have also been resolved).
* The Windows 95/98/NT (W32) version of GNU make now has native support
* The Windows 95/98/NT (W32) version of GNU Make now has native support
for the Cygnus Cygwin release B20.1 shell (bash).
* The GNU make regression test suite, long available separately "under
* The GNU Make regression test suite, long available separately "under
the table", has been integrated into the release. You can invoke it
by running "make check" in the distribution. Note that it requires
Perl (either Perl 4 or Perl 5) to run.
@@ -1085,10 +1153,10 @@ Version 3.77 (28 Jul 1998)
you'll have to escape both of them: "foo : bar\\\=baz".
* A new appendix listing the most common error and warning messages
generated by GNU make, with some explanation, has been added to the
GNU make User's Manual.
generated by GNU Make, with some explanation, has been added to the
GNU Make User's Manual.
* Updates to the GNU make Customs library support (see README.customs).
* Updates to the GNU Make Customs library support (see README.customs).
* Updates to the Windows 95/NT port from Rob Tulloh (see README.W32),
and to the DOS port from Eli Zaretski (see README.DOS).
@@ -1100,7 +1168,7 @@ Version 3.77 (28 Jul 1998)
This port was done by Klaus Kämpf <kkaempf@rmi.de>
* There is first-level support available from proGIS Software, Germany.
Visit their web-site at http://www.progis.de to get information
Visit their web-site at https://www.progis.de to get information
about other vms software and forthcoming updates to gnu make.
* /bin/sh style I/O redirection is supported. You can now write lines like
@@ -1138,7 +1206,7 @@ Version 3.76.1 (19 Sep 1997)
Version 3.76 (16 Sep 1997)
* GNU make now uses automake to control Makefile.in generation. This
* GNU Make now uses automake to control Makefile.in generation. This
should make it more consistent with the GNU standards.
* VPATH functionality has been changed to incorporate the VPATH+ patch,
@@ -1153,7 +1221,7 @@ Version 3.76 (16 Sep 1997)
list of words from number S to number E (inclusive) of TEXT.
* Instead of an error, detection of future modification times gives a
warning and continues. The warning is repeated just before GNU make
warning and continues. The warning is repeated just before GNU Make
exits, so it is less likely to be lost.
* Fix the $(basename) and $(suffix) functions so they only operate on
@@ -1308,9 +1376,9 @@ Version 3.71 (21 May 1994)
There is no longer a separate distribution containing Info and DVI files.
* You can now set the variables `binprefix' and/or `manprefix' in
Makefile.in (or on the command line when installing) to install GNU make
Makefile.in (or on the command line when installing) to install GNU Make
under a name other than `make' (i.e., ``make binprefix=g install''
installs GNU make as `gmake').
installs GNU Make as `gmake').
* The built-in Texinfo rules use the new variables `TEXI2DVI_FLAGS' for
flags to the `texi2dvi' script, and `MAKEINFO_FLAGS' for flags to the
@@ -1790,7 +1858,7 @@ Version 3.05
(Changes from versions 1 through 3.05 were never recorded. Sorry.)
-------------------------------------------------------------------------------
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -1803,4 +1871,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1,11 +1,11 @@
Short: Port of GNU make with SAS/C (no ixemul.library required)
Short: Port of GNU Make with SAS/C (no ixemul.library required)
Author: GNU, Amiga port by Aaron "Optimizer" Digulla
Uploader: Aaron "Optimizer" Digulla (digulla@fh-konstanz.de)
Type: dev/c
This is a pure Amiga port of GNU make. It needs no extra libraries or
This is a pure Amiga port of GNU Make. It needs no extra libraries or
anything. It has the following features (in addition to any features of
GNU make):
GNU Make):
- Runs Amiga-Commands with SystemTags() (Execute)
- Can run multi-line statements
@@ -44,9 +44,9 @@ COMPILING FROM SCRATCH
To recompile, you need SAS/C 6.51.
As of GNU make 4.3, the build environment has been cleaned up and alternate
As of GNU Make 4.3, the build environment has been cleaned up and alternate
make files (including smakefiles) have been removed. If you have an existing
version of GNU make available you _should_ be able to run:
version of GNU Make available you _should_ be able to run:
make -f Basic.mk
@@ -64,7 +64,7 @@ If you plan to use recursive makes, install make resident:
-------------------------------------------------------------------------------
Copyright (C) 1995-2022 Free Software Foundation, Inc.
Copyright (C) 1995-2023 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
@@ -77,4 +77,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -79,7 +79,7 @@ To build from sources:
6. To install copy make.exe to the preferred location.
Since GNU make 4.3, support for customized platform installations
Since GNU Make 4.3, support for customized platform installations
has been removed. If you'd like to collaborate on reinstating
these capabilities, contact bug-make@gnu.org.
@@ -280,7 +280,7 @@ Bug reports:
-------------------------------------------------------------------------------
Copyright (C) 1996-2022 Free Software Foundation, Inc.
Copyright (C) 1996-2023 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
@@ -293,4 +293,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1,6 +1,6 @@
Port of GNU make to OS/2.
Port of GNU Make to OS/2.
Features of GNU make that do not work under OS/2:
Features of GNU Make that do not work under OS/2:
- remote job execution
- dynamic load balancing
@@ -9,7 +9,7 @@ Special features of the OS/2 version:
Due to the fact that some people might want to use sh syntax in
Makefiles while others might want to use OS/2's native shell cmd.exe,
GNU make supports both shell types. The following list defines the order
GNU Make supports both shell types. The following list defines the order
that is used to determine the shell:
1. The shell specified by the environment variable MAKESHELL.
@@ -37,7 +37,7 @@ I. ***** SPECIAL OPTIONS *****
cmd or by specifying SHELL=cmd in your Makefile.
- At compile time you can set CPPFLAGS="-DNO_CHDIR2" to turn off that
GNU make prints drive letters. This is necessary if you want to run
GNU Make prints drive letters. This is necessary if you want to run
the testsuite.
@@ -49,7 +49,7 @@ A standard Unix like build environment:
release 2)
If you use pdksh it is recommended to update to 5.2.14 release 2. Older
versions may not work! You can get this version at
http://www.math.ohio-state.edu/~ilya/software/os2/pdksh-5.2.14-bin-2.zip
https://www.math.ohio-state.edu/~ilya/software/os2/pdksh-5.2.14-bin-2.zip
- GNU file utilities (make sure that install.exe from the file utilities
is in front of your PATH before X:\OS2\INSTALL\INSTALL.EXE. I recommend
also to change the filename to ginstall.exe instead of install.exe
@@ -59,7 +59,7 @@ A standard Unix like build environment:
- gawk
- grep
- sed
- GNU make 3.79.1 (special OS/2 patched version) or higher
- GNU Make 3.79.1 (special OS/2 patched version) or higher
- perl 5.005 or higher
- GNU texinfo (you can use 3.1 (gnuinfo.zip), but I recommend 4.0)
@@ -73,7 +73,7 @@ III. ***** COMPILATION AND INSTALLATION *****
To recreate the configuration files use:
export EMXSHELL=ksh
aclocal -I config
aclocal -I m4
automake
autoconf
autoheader
@@ -93,7 +93,7 @@ Recommended environment variables and installation options:
export CFLAGS="-O2 -Zomf -Zmt"
export LDFLAGS="-Zcrtdll -Zlinker /exepack:2 -Zlinker /pm:vio -Zstack 0x6000"
export RANLIB="echo"
./configure --prefix=x:/usr --infodir=x:/usr/share/info --mandir=x:/usr/share/man --without-included-gettext
./configure --prefix=x:/usr --infodir=x:/usr/share/info --mandir=x:/usr/share/man
make AR=emxomfar
make install
@@ -102,18 +102,21 @@ Note: If you use gcc 2.9.x I recommend to set also LIBS="-lgcc"
Note: You can add -DNO_CMD_DEFAULT and -DNO_CHDIR2 to CPPFLAGS.
See section I. for details.
Note: If you use Open Watcom Linker instead of IBM Linker, remove
'-Zlinker /exepack:2' from LDFLAGS.
IV. ***** NLS support *****
GNU make has NLS (National Language Support), with the following
GNU Make has NLS (National Language Support), with the following
caveats:
a) It will only work with GNU gettext, and
b) GNU gettext support is not included in the GNU make package.
b) GNU gettext support is not included in the GNU Make package.
Therefore, if you wish to enable the internationalization features of
GNU make you must install GNU gettext on your system before configuring
GNU make.
GNU Make you must install GNU gettext on your system before configuring
GNU Make.
You can choose the languages to be installed. To install support for
English, German and French only enter:
@@ -160,7 +163,7 @@ from the make source tree.
-------------------------------------------------------------------------------
Copyright (C) 2003-2022 Free Software Foundation, Inc.
Copyright (C) 2003-2023 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
@@ -173,4 +176,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1,7 +1,7 @@
Overview: -*-text-mode-*-
---------
This version of GNU make has been tested on:
This version of GNU Make has been tested on:
OpenVMS V8.3/V8.4 (Alpha) and V8.4 (Integrity) AND V7.3 (VAX)
This version of GNU Make is intended to be run from DCL to run
@@ -14,7 +14,7 @@ Overview: -*-text-mode-*-
detect that it is running under a POSIX shell and then operate as close to
GNU Make on Unix as possible.
The descriptions below are for running GNU make from DCL or equivalent.
The descriptions below are for running GNU Make from DCL or equivalent.
Recipe differences:
-------------------
@@ -84,7 +84,7 @@ Recipe differences:
The format for recipes are a combination of Unix macros, a subset of
simulated UNIX commands, some shell emulation, and OpenVMS commands.
This makes the resulting makefiles unique to the OpenVMS port of GNU make.
This makes the resulting makefiles unique to the OpenVMS port of GNU Make.
If you are creating a OpenVMS specific makefile from scratch, you should also
look at MMK (Madgoat Make) available at https://github.com/endlesssoftware/mmk
@@ -177,7 +177,7 @@ Recipe differences:
Since the OpenVMS utilities generally expect OpenVMS format paths, you will
usually have to use OpenVMS format paths for rules and targets.
BUG: Relative OpenVMS paths may not work in targets, especially combined
with vpaths. This is because GNU make will just concatenate the directories
with vpaths. This is because GNU Make will just concatenate the directories
as it does on Unix.
The variables $^ and $@ separate files with commas instead of spaces.
@@ -211,9 +211,9 @@ foo: $(addsuffix .3,$(subs $(comma),$(space),$^)
shows them as "environment override". On POSIX the test scripts indicate
that they should show up just as "environment".
When GNU make reads in a symbol or logical name into the environment, it
When GNU Make reads in a symbol or logical name into the environment, it
converts any dollar signs found to double dollar signs for convenience in
using DCL symbols and logical names in recipes. When GNU make exports a
using DCL symbols and logical names in recipes. When GNU Make exports a
DCL symbol for a child process, if the first dollar sign found is followed
by second dollar sign, then all double dollar signs will be converted to
single dollar signs.
@@ -284,7 +284,7 @@ Runtime issues:
MAKE_FAILURE has a POSIX value of 2 and an OpenVMS status of %x1035a012.
Output from GNU make may have single quotes around some values where on
Output from GNU Make may have single quotes around some values where on
other platforms it does not. Also output that would be in double quotes
on some platforms may show up as single quotes on VMS.
@@ -353,7 +353,7 @@ Unix compatibility features:
A note on appending the redirected output. A simple mechanism is
implemented to make ">>" work in action lines. In OpenVMS there is no simple
feature like ">>" to have DCL command or program output redirected and
appended to a file. GNU make for OpenVMS implements the redirection
appended to a file. GNU Make for OpenVMS implements the redirection
of ">>" by using a command procedure.
The current algorithm creates the output file if it does not exist and
@@ -409,7 +409,7 @@ Unimplemented functionality:
The new feature "Loadable objects" is not yet supported. If you need it,
please send a change request or submit a bug report.
The new option --output-sync (-O) is accepted but has no effect: GNU make
The new option --output-sync (-O) is accepted but has no effect: GNU Make
for OpenVMS does not support running multiple commands simultaneously.
@@ -421,7 +421,7 @@ Self test failures and todos:
Need to find a way to set the VMS features before running make as a
child.
GNU make was not currently translating the OpenVMS encoded POSIX values
GNU Make was not currently translating the OpenVMS encoded POSIX values
returned to it back to the POSIX values. I have temporarily modified the
Perl test script to compensate for it. This should be being handled
internally to Make.

View File

@@ -1,5 +1,5 @@
This version of GNU make has been tested on:
Microsoft Windows 2000/XP/2003/Vista/7/8/10
This version of GNU Make has been tested on:
Microsoft Windows 2000/XP/2003/Vista/7/8/10/11
It has also been used on Windows 95/98/NT, and on OS/2.
It builds with the MinGW port of GCC (tested with GCC 3.4.2, 4.8.1,
@@ -15,7 +15,7 @@ which compilation and link switches and libraries need to be mentioned
on the compiler command lines to correctly link with Guile. A Windows
port of pkg-config can be found on ezwinports site:
http://sourceforge.net/projects/ezwinports/
https://sourceforge.net/projects/ezwinports/
The libraries on which Guile depends can vary depending on your
version and build of Guile. At the very least, the Boehm's GC library
@@ -25,7 +25,7 @@ also provide you with these dependencies or a URL where to download
them. A precompiled 32-bit Windows build of Guile is available from
the ezwinports site mentioned above.
The Windows port of GNU make is maintained jointly by various people.
The Windows port of GNU Make is maintained jointly by various people.
It was originally made by Rob Tulloh.
It is currently maintained by Eli Zaretskii.
@@ -33,12 +33,14 @@ It is currently maintained by Eli Zaretskii.
Do this first, regardless of the build method you choose:
---------------------------------------------------------
1. Edit config.h.W32 to your liking (especially the few shell-related
defines near the end, or HAVE_CASE_INSENSITIVE_FS which corresponds
to './configure --enable-case-insensitive-file-system'). (We don't
recommend to define HAVE_CASE_INSENSITIVE_FS, but you may wish to
consider that if you have a lot of files whose names are in upper
case, while Makefile rules are written for lower-case versions.)
1. If you have special requirements, edit config.h.W32 to your liking
(especially the shell-related defines, or HAVE_CASE_INSENSITIVE_FS which
corresponds to './configure --enable-case-insensitive-file-system'). We
don't recommend to define HAVE_CASE_INSENSITIVE_FS, but you may wish to
consider that if you have a lot of files whose names are in upper case,
while Makefile rules are written for lower-case versions.
If you don't have special requirements no changes are needed.
Building with (MinGW-)GCC using build_w32.bat
@@ -51,7 +53,7 @@ Building with (MinGW-)GCC using build_w32.bat
This produces gnumake.exe in the GccRel directory.
If you want a version of GNU make built with debugging enabled,
If you want a version of GNU Make built with debugging enabled,
add the --debug option. Output goes into the GccDebug directory.
The batch file will probe for Guile installation, and will build
@@ -73,21 +75,21 @@ Building with (MSVC++-)cl using build_w32.bat
file will probe your system and choose the newest MSVC version it can
find.
If you want a 32bit version of GNU make, add the --x86 option.
If you want a 32bit version of GNU Make, add the --x86 option.
If you want a Debug build of GNU make, add the --debug option. Output
If you want a Debug build of GNU Make, add the --debug option. Output
will go into the .\WinDebug directory.
The batch file will probe for Guile installation, and will build
gnumake.exe with Guile if it finds it. If Guile is installed,
but you prefer to build GNU make without Guile support, add the
but you prefer to build GNU Make without Guile support, add the
--without-guile option.
Building with (MinGW-)GCC using GNU make
Building with (MinGW-)GCC using GNU Make
----------------------------------------
2. If you already have a version of GNU make available you can use it
2. If you already have a version of GNU Make available you can use it
to build this version. Open a W32 command prompt for your installed
(MinGW-)GCC, setup a correct PATH and other environment variables
for it, then execute ...
@@ -95,7 +97,7 @@ Building with (MinGW-)GCC using GNU make
make -f Basic.mk TOOLCHAIN=gcc
This produces GccRel\gnumake.exe.
If you want a version of GNU make built with debugging enabled,
If you want a version of GNU Make built with debugging enabled,
add the TARGET_TYPE=debug option:
make -f Basic.mk TOOLCHAIN=gcc TARGET_TYPE=debug
@@ -104,10 +106,10 @@ Building with (MinGW-)GCC using GNU make
if you want to build with Guile support.
Building with (MSVC++-)cl using GNU make
Building with (MSVC++-)cl using GNU Make
----------------------------------------
2. If you already have a version of GNU make available you can use it
2. If you already have a version of GNU Make available you can use it
to build this version. Open a W32 command prompt for your installed
(MSVC++-)cl, setup a correct PATH and other environment variables
for it (usually via executing vcvars32.bat or vsvars32.bat from the
@@ -117,7 +119,7 @@ Building with (MSVC++-)cl using GNU make
make -f Basic.mk
This produces an optimized WinRel/gnumake.exe.
If you want a version of GNU make built with debugging enabled,
If you want a version of GNU Make built with debugging enabled,
add the TARGET_TYPE=debug option:
make -f Basic.mk TARGET_TYPE=debug
@@ -132,7 +134,7 @@ Running the test suite
3. You will need an installation of Perl. Be sure to use a relatively
modern version: older versions will sometimes throw spurious errors.
To run the suite after building using GNU make, use:
To run the suite after building using GNU Make, use:
make -f Basic.mk check
@@ -156,7 +158,7 @@ Running the test suite
-- Notes/Caveats --
-------------------
GNU make on Windows 32-bit platforms:
GNU Make on Windows 32-bit platforms:
This version of make is ported natively to Windows32 platforms
(Windows NT 3.51, Windows NT 4.0, Windows 2000, Windows XP,
@@ -166,11 +168,11 @@ GNU make on Windows 32-bit platforms:
officially are the MinGW port of GNU GCC, and the various
versions of the Microsoft C compiler.
Do not confuse this port of GNU make with other Windows32 projects
which provide a GNU make binary. These are separate projects
Do not confuse this port of GNU Make with other Windows32 projects
which provide a GNU Make binary. These are separate projects
and are not connected to this port effort.
GNU make and sh.exe:
GNU Make and sh.exe:
This port prefers if you have a working sh.exe somewhere on
your system. If you don't have sh.exe, the port falls back to
@@ -180,12 +182,12 @@ GNU make and sh.exe:
There are very few true ports of Bourne shell for NT right now.
There is a version of GNU bash available from Cygnus "Cygwin"
porting effort (http://www.cygwin.com/).
porting effort (https://www.cygwin.com/).
Other possibilities are the MKS version of sh.exe, or building
your own with a package like NutCracker (DataFocus) or Portage
(Consensys). Also MinGW includes sh (http://mingw.org/).
(Consensys). Also MinGW includes sh.
GNU make and brain-dead shells (BATCH_MODE_ONLY_SHELL):
GNU Make and brain-dead shells (BATCH_MODE_ONLY_SHELL):
Some versions of Bourne shell do not behave well when invoked
as 'sh -c' from CreateProcess(). The main problem is they seem
@@ -211,21 +213,21 @@ Support for parallel builds
Parallel builds (-jN) are supported in this port. The number of
concurrent processes has a hard limit of 4095.
GNU make and Cygnus GNU Windows32 tools:
GNU Make and Cygnus GNU Windows32 tools:
Good news! Make now has native support for Cygwin sh. To enable,
define the HAVE_CYGWIN_SHELL in config.h and rebuild make
from scratch. This version of make tested with B20.1 of Cygwin.
Do not define BATCH_MODE_ONLY_SHELL if you use HAVE_CYGWIN_SHELL.
GNU make and the MKS shell:
GNU Make and the MKS shell:
There is now semi-official support for the MKS shell. To turn this
support on, define HAVE_MKS_SHELL in the config.h.W32 before you
build make. Do not define BATCH_MODE_ONLY_SHELL if you turn
on HAVE_MKS_SHELL.
GNU make handling of drive letters in pathnames (PATH, vpath, VPATH):
GNU Make handling of drive letters in pathnames (PATH, vpath, VPATH):
There is a caveat that should be noted with respect to handling
single character pathnames on Windows systems. When colon is
@@ -291,7 +293,7 @@ Pathnames and Case insensitivity:
the file with other case permutations will succeed (i.e. opening a
file named "target" or "TARGET" will open the file "Target").
By default, GNU make retains its case sensitivity when comparing
By default, GNU Make retains its case sensitivity when comparing
target names and existing files or directories. It can be
configured, however, into a case preserving and case insensitive
mode by adding a define for HAVE_CASE_INSENSITIVE_FS to
@@ -309,10 +311,10 @@ Pathnames and Case insensitivity:
SUBDIR/DepTarget: SubDir/TARGET
cp $^ $@
Reliance on this behavior also eliminates the ability of GNU make
Reliance on this behavior also eliminates the ability of GNU Make
to use case in comparison of matching rules. For example, it is
not possible to set up a C++ rule using %.C that is different
than a C rule using %.c. GNU make will consider these to be the
than a C rule using %.c. GNU Make will consider these to be the
same rule and will issue a warning.
SAMBA/NTFS/VFAT:
@@ -342,10 +344,10 @@ FAT:
Bug reports:
Please submit bugs via the normal bug reporting mechanism which
is described in the GNU make manual and the base README.
is described in the GNU Make manual and the base README.
-------------------------------------------------------------------------------
Copyright (C) 1996-2022 Free Software Foundation, Inc.
Copyright (C) 1996-2023 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
@@ -358,4 +360,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1,6 +1,6 @@
-*-indented-text-*-
GNU make can utilize the Customs library, distributed with Pmake, to
GNU Make can utilize the Customs library, distributed with Pmake, to
provide builds distributed across multiple hosts.
In order to utilize this capability, you must first download and build
@@ -21,11 +21,11 @@ please see the pmake and Customs documentation for details. The best
place to look for instructions is in the pmake-2.1.33/INSTALL file.
Note that the 2.1.33 Pmake distribution comes with a set of patches to
GNU make, distributed in the pmake-2.1.33/etc/gnumake/ directory. These
patches are based on GNU make 3.75 (there are patches for earlier
versions of GNU make, also). The parts of this patchfile which relate
GNU Make, distributed in the pmake-2.1.33/etc/gnumake/ directory. These
patches are based on GNU Make 3.75 (there are patches for earlier
versions of GNU Make, also). The parts of this patchfile which relate
directly to Customs support have already been incorporated into this
version of GNU make, so you should _NOT_ apply the patch file.
version of GNU Make, so you should _NOT_ apply the patch file.
However, there are a few non-Customs specific (as far as I could tell)
changes here which are not incorporated (for example, the modification
@@ -42,14 +42,14 @@ install' there directly).
BUILDING GNU MAKE
-----------------
Once you've installed Customs, you can build GNU make to use it. When
configuring GNU make, merely use the '--with-customs=DIR' option.
Once you've installed Customs, you can build GNU Make to use it. When
configuring GNU Make, merely use the '--with-customs=DIR' option.
Provide the directory containing the 'lib' and 'include/customs'
subdirectories as DIR. For example, if you installed the customs
library in /usr/local/lib and the headers in /usr/local/include/customs,
then you'd pass '--with-customs=/usr/local' as an option to configure.
Run make (or use build.sh) normally to build GNU make as described in
Run make (or use build.sh) normally to build GNU Make as described in
the INSTALL file.
See the documentation for Customs for information on starting and
@@ -83,7 +83,7 @@ PROBLEMS
SunOS 4.1.x:
The customs/sprite.h header file #includes the <malloc.h> header
files; this conflicts with GNU make's configuration so you'll get a
files; this conflicts with GNU Make's configuration so you'll get a
compile error if you use GCC (or any other ANSI-capable C compiler).
I commented out the #include in sprite.h:107:
@@ -96,7 +96,7 @@ SunOS 4.1.x:
-------------------------------------------------------------------------------
Copyright (C) 1998-2022 Free Software Foundation, Inc.
Copyright (C) 1998-2023 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
@@ -109,4 +109,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1,7 +1,7 @@
-*-text-*-
-------------------------------------------------------------------------------
Copyright (C) 2002-2022 Free Software Foundation, Inc.
Copyright (C) 2002-2023 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
@@ -31,13 +31,13 @@ make source code via Git from the FSF's Savannah project
Changes using Git
-----------------
If you do not have push privileges to the GNU make Git repository, see the
If you do not have push privileges to the GNU Make Git repository, see the
README file section "Submitting Patches" for information.
If you have push privileges to the GNU make Git repository keep this
If you have push privileges to the GNU Make Git repository keep this
information in mind:
Starting with GNU make 4.0 we no longer keep a separate ChangeLog file in
Starting with GNU Make 4.0 we no longer keep a separate ChangeLog file in
source control. We use the Gnulib git-to-changelog conversion script to
convert the Git comments into ChangeLog-style entries for release. As a
result, please format your Git comments carefully so they will look clean
@@ -48,8 +48,8 @@ your commit messages (sans the leading TAB of course).
Rule #1: Don't rewrite pushed history on master (no "git push --force").
Rule #2: Feel free to rewrite pushed history on personal branches.
Rule #3: Prefer to squash-merge or rebase + merge --ff-only, rather than
merging from personal branches into master.
Rule #3: Squash-merge or rebase + merge --ff-only, rather than merging from
personal branches into master.
Typical simple workflow might be:
@@ -70,12 +70,12 @@ available which helps a lot.
Coding Standards
----------------
GNU make code adheres to the GNU Coding Standards. Please use only spaces and
GNU Make code adheres to the GNU Coding Standards. Please use only spaces and
no TAB characters in source code.
Additionally, GNU make is a foundational bootstrap package for the GNU
Additionally, GNU Make is a foundational bootstrap package for the GNU
project; as such it is conservative about language features it expects.
However, GNU make does rely on the Gnulib portability library, and Gnulib
However, GNU Make does rely on the Gnulib portability library, and Gnulib
currently requires a ISO C99 compiler. So features in ISO C99 can be
assumed.
@@ -83,25 +83,28 @@ assumed.
Building From Git for POSIX
---------------------------
To build GNU make from Git on POSIX systems such as GNU/Linux, you will
To build GNU Make from Git on POSIX systems such as GNU/Linux, you will
need to install the following extra software:
* autoconf >= 2.69
* automake >= 1.16.1
* gettext
* autopoint
* pkg-config
* texinfo (for makeinfo)
* gettext
* pkg-config
* GCC
* GNU make (POSIX make is not sufficient)
* GNU Make (POSIX make is not sufficient)
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.
To create dist files you will additionally need:
GNU make requires Gnulib to provide some facilities. If you want to maintain
* lzip (to create tar.lz dist files)
* texlive (or some other TeX package)
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.
@@ -125,11 +128,11 @@ After checking out the code, you will need to run the bootstrap script:
Alternatively you can just pull content from remote locations with:
$ ./autopull.sh
$ ./bootstrap --pull
And/or just re-generate auto-generatable files with:
$ ./autogen.sh
$ ./bootstrap --gen
(Running ./bootstrap does both in one step.)
@@ -141,9 +144,9 @@ That is, you can just run:
$ ./configure
$ make check
to build and test GNU make.
to build and test GNU Make.
NOTE! This method builds GNU make in "maintainer mode". Make programs built
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
@@ -163,22 +166,24 @@ NOTE! This method builds GNU make in "maintainer mode". Make programs built
Building From Git for Windows
-----------------------------
If you have a UNIX emulation like CYGWIN you can opt to run the general
build procedure above; it will work. Consult README.W32.template for
information on options you might want to use when running ./configure.
If you have a UNIX emulation like CYGWIN you can opt to run the general build
procedure above; it will work. Consult README.W32 for information on options
you might want to use when running ./configure.
If you can't or don't want to do that, then first run the .\bootstrap.bat
script to prime your Git workspace:
script to "prime" your Git workspace:
> .\bootstrap.bat
Next, rename the file README.W32.template to README.W32 and follow those
instructions.
Next, follow the instructions in the README.W32 file.
Note, neither of these methods are tested regularly by the GNU make
Note, neither of these methods are tested regularly by the GNU Make
maintainers. Building for Windows from a distribution tarball IS tested
regularly.
NOTE! "Maintainer mode" (see above) IS ENABLED when building from Git using
the build_w32.bat file.
Debugging and Testing
---------------------
@@ -204,7 +209,7 @@ work on non-GNU systems (Windows, MacOS, etc.)
make clean
make -j8 CFLAGS='-ggdb3 -fsanitize=address' LDFLAGS='-ggdb3 -fsanitize=address'
(cd tests && ./run_make_tests -make ../make)
make check
Note that ASAN is reporting many more errors than valgrind. I don't know
which one is wrong: I haven't looked at them closely.
@@ -214,7 +219,7 @@ Creating a Package
------------------
Once you have performed the above steps (including the configuration and
build) you can create a GNU make package. This is very simple, just
build) you can create a GNU Make package. This is very simple, just
run:
$ make dist-gzip
@@ -246,38 +251,123 @@ consistent (that's why we don't finalize the Git tag, etc. until the end).
* Update the configure.ac file with the new release number.
* Update the EDITION value in the doc/make.texi file.
* Update the doc/make.1 file with the release date.
* Update the NEWS file with the release number and date.
* Ensure the Savannah bug list URL in the NEWS file uses the correct
"Fixed Release" ID number.
* Run "make distcheck" to be sure it all works.
* Run "make check-alt-config" to be sure alternative configurations work
* Run "make update-makeweb" to get a copy of the GNU make web pages
* Run "make update-gnuweb" to get a copy of the GNU website boilerplate pages
* Update the web page boilerplate if necessary:
../gnu-www/www/server/standards/patch-from-parent ../make-web/make.html \
../gnu-www/www/server/standards/boilerplate.html
* Run "make gendocs" (requires gnulib) to generate the manual files for
the GNU make web pages.
* Follow the directions from gendocs for the web page repository
* run "make tag-release" to create a Git tag for the release
* Push everything:
git push --tags origin master
Manage the Savannah project for GNU make:
The safest thing is to create an entirely new repository and build the final
package from there:
>>> This is only for real releases, not release candidate builds <<<
git clone git://git.savannah.gnu.org/make.git make-release
cd make-release
If you don't want to create a new repository then run "git clean -fdx".
Then:
./bootstrap
./configure
make distcheck
Perform test builds on whichever systems you have access to.
Use a previous announcement as a template to create an announcement in a text
file then sign it with GPG:
gpg --clearsign <announcement.txt>
Or, use your mail client's PGP/GPG signing capabilities.
NOTE! In order to publish a package on the FSF FTP site you need to have my
GPG private key, and my passphrase to unlock it.
Depending on your distribution (whether GnuPG is integrated with your
keyring etc.) the upload operation will either pop up a window asking
for the GPG key passphrase one time, or else it will use the CLI to ask
for the GPG passphrase _THREE_ times. Sigh.
Publishing a Release Candidate
------------------------------
Usually I publish one or two release candidates for people to test before
making an official release. Release candidates use a GNU numbering scheme,
which add a ".9x" release number to the PREVIOUS major release. So the first
release candidate for GNU Make 4.4 would be GNU Make 4.3.90, the second
release candidate would be 4.3.91, etc.
Upload a release candidate using:
make upload-alpha
Announce a release candidate to these mailing lists:
To: bug-make@gnu.org
BCC: help-make@gnu.org, make-w32@gnu.org, make-alpha@gnu.org
You will have to approve the BCC's on the mailing list admin sites. Send
separate copies to (don't use CC as replies will go to these lists):
* coordinator@translationproject.org
* platform-testers@gnu.org
Publishing a Release
--------------------
When publishing a final release there are extra steps that need to be taken:
* Run "make update-makeweb" to get a copy of the GNU Make web pages
* Run "make update-gnuweb" to get a copy of the GNU website boilerplate pages
* Update the web page boilerplate if necessary:
( cd ~/src/make/make-web \
&& ~/src/gnu-www/www/server/standards/patch-from-parent \
make.html \
~/src/gnu-www/www/server/standards/boilerplate.html )
* Run "make gendocs" (requires gnulib) to generate the manual files for
the GNU Make web pages.
* Follow the directions from gendocs for the web page repository
Manage the Savannah project for GNU Make:
* In Savannah modify the "Value", "Rank", and "Description" values for the
current "SCM" entry in both "Component Version" and "Fix Release" fields
to refer to the new release. The "Rank" field should be 10 less than the
previous release so it orders properly.
* In Savannah create a new entry for the "Component Version" and "Fix
Release" fields:
* In Savannah create a new entry for the "Component Version" field:
- Value: SCM
- Rank: 20
- Descr: Issues found in code retrieved from Source Code Management (Git), rather than a distributed version. Please include the SHA you are working with.
- Descr: Fixed in Source Code Management (Git). The fix will be included in the next release of GNU make.
* In Savannah create a new entry for the "Fix Release" field:
- Value: SCM
- Rank: 20
- Descr: Fixed in Source Code Management (Git). The fix will be included in the next release of GNU Make.
Upload a release using:
make upload-ftp
Announce a release to these mailing lists:
To: info-gnu@gnu.org, bug-make@gnu.org
BCC: help-make@gnu.org, make-w32@gnu.org, make-alpha@gnu.org
You will have to approve the BCC's on the mailing list admin sites. Send
separate copies to (don't use CC as replies will go to these lists):
* coordinator@translationproject.org
* platform-testers@gnu.org
Announce on Savannah:
* Add a news item to the Savannah project site.
Start the next release:
@@ -286,71 +376,11 @@ Start the next release:
* Update the Savannah URL for the bugs fixed in the NEWS section.
Publishing a Package
--------------------
In order to publish a package on the FSF FTP site, either the release
site ftp://ftp.gnu.org, or the prerelease site ftp://alpha.gnu.org, you
first need to have my GPG private key and my passphrase to unlock it.
And, you can't have them! So there! But, just so I remember here's
what to do:
Make sure the "Steps to Release" are complete and committed and tagged.
git clone git://git.savannah.gnu.org/make.git make-release
cd make-release
<run the commands above to build the release>
make upload-alpha # for alpha.gnu.org (pre-releases)
-OR-
make upload-ftp # for ftp.gnu.org (official releases)
Depending on your distribution (whether GnuPG is integrated with your keyring
etc.) it will either pop up a window asking for your GPG key passphrase one
time, or else it will use the CLI to ask for the GPG passphrase _THREE_ times.
Sigh.
For both final releases and pre-releases, send an email with the URL of
the package to the GNU translation robot to allow the translators to
work on it:
<coordinator@translationproject.org>
Where to Announce
-----------------
Create the announcement in a text file, using 'git shortlog',
then sign it with GPG:
gpg --clearsign <announcement.txt>
Or, use your mail client's PGP/GPG signing capabilities.
Announce the release:
* For release candidate builds:
To: bug-make@gnu.org
CC: coordinator@translationproject.org
BCC: help-make@gnu.org, make-w32@gnu.org, make-alpha@gnu.org
* For release builds
To: info-gnu@gnu.org, bug-make@gnu.org
CC: coordinator@translationproject.org
BCC: help-make@gnu.org, make-w32@gnu.org, make-alpha@gnu.org
* Add a news item to the Savannah project site.
* Add an update to freecode.com (nee freshmeat.net)
Appendix A - For The Brave
--------------------------
For those of you who trust me implicitly, or are just brave (or
foolhardy), here is a canned sequence of commands to build a GNU make
foolhardy), here is a canned sequence of commands to build a GNU Make
distribution package from a virgin Git source checkout (assuming all the
prerequisites are available of course).
@@ -361,6 +391,6 @@ For a debugging version:
./bootstrap && ./configure CFLAGS=-g && make check
For a release version
For an optimized version
./bootstrap && ./configure && make check

View File

@@ -1,4 +1,4 @@
This directory contains the %VERSION% release of GNU Make.
This directory contains the @PACKAGE_VERSION@ release of @PACKAGE_NAME@.
See the file NEWS for the user-visible changes from previous releases.
In addition, there have been bugs fixed.
@@ -6,7 +6,7 @@ In addition, there have been bugs fixed.
Please check the system-specific notes below for any caveats related to your
operating system.
If you are trying to build GNU make from a Git clone rather than a downloaded
If you are trying to build GNU Make from a Git clone rather than a downloaded
source distribution, see the README.git file for instructions.
For source distribution building and installation instructions, see the file
@@ -15,12 +15,12 @@ INSTALL.
If you need to build GNU Make and have no other 'make' program to use, you can
use the shell script 'build.sh' instead. To do this, first run 'configure' as
described in INSTALL. Then, instead of typing 'make' to build the program,
type 'sh build.sh'. This should compile the program in the current directory.
Then you will have a Make program that you can use for './make install', or
type 'sh build.sh'. This will compile the program in the current directory.
Then you will have a 'make' program that you can use for './make install', or
whatever else.
Some systems' Make programs cannot process the Makefile for GNU Make. If you
get errors from your system's Make when building GNU Make, try using
Some systems' 'make' programs cannot process the Makefile for GNU Make.
If you get errors from your system's 'make' when building GNU Make, try using
'build.sh' instead.
@@ -40,10 +40,10 @@ GNU Make can be obtained in many different ways. See a description here:
Documentation
-------------
GNU make is fully documented in the GNU Make manual, which is contained
in this distribution as the file make.texinfo. You can also find
on-line and preformatted (PostScript and DVI) versions at the FSF's web
site. There is information there about ordering hardcopy documentation.
GNU Make is fully documented in the GNU Make manual, which is contained in
this distribution as the file make.texi. You can also find on-line and
preformatted (PostScript and DVI) versions at the FSF's web site. There is
information there about ordering hardcopy documentation.
https://www.gnu.org/
https://www.gnu.org/doc/doc.html
@@ -66,30 +66,43 @@ You can find most information concerning the development of GNU Make at
this site.
Regression Tests
----------------
GNU Make contains a suite of regression tests. To run them use "make check"
after building GNU Make. If they fail a tar package will be created
containing useful information, which can be emailed (as an attachment) to
the <bug-make@gnu.org> mailing list.
Please note that since these tests rely on known-good-output comparisons,
they can show spurious failures on some systems (particularly non-POSIX systems
such as Windows).
Bug Reporting
-------------
You can send GNU make bug reports to <bug-make@gnu.org>. Please see the
section of the GNU make manual entitled 'Problems and Bugs' for
information on submitting useful and complete bug reports.
If you need help using GNU Make, try asking on <help-make@gnu.org>.
If you found a bug, you can send a bug reports to <bug-make@gnu.org>.
Please see the section of the GNU Make manual entitled 'Problems and Bugs'
for information on submitting useful and complete bug reports.
You do not need to subscribe to these lists first.
You can also use the online bug tracking system in the Savannah GNU Make
project to submit new problem reports or search for existing ones:
https://savannah.gnu.org/bugs/?group=make
If you need help using GNU make, try these forums:
help-make@gnu.org
help-utils@gnu.org
news:gnu.utils.help
news:gnu.utils.bug
We prefer to use the bug tracking system ONLY for bugs or enhancements,
not for help requests: please use the mailing lists to get help.
Submitting Patches
------------------
If you'd like to propose a change to GNU make, you can provide a patch with
If you'd like to propose a change to GNU Make, you can provide a patch with
your changes. If you are making your changes in a Git workspace you can run
"git format-patch" to create a patch file. If not, you can use the diff(1)
utility to create a patch file; please use "diff -u".
@@ -102,24 +115,23 @@ Once you have a patch you can submit it in any of these ways:
* Send the patch via email to <bug-make@gnu.org>: be sure to add it as an
attachment to avoid interference by email processors.
Be aware that all non-trivial changes proposed for GNU make require FSF
copyright paperwork to be completed before they can be accepted. Contact
<bug-make@gnu.org> for help.
All non-trivial changes require FSF copyright paperwork to be completed
before they can be accepted. Contact <bug-make@gnu.org> for help.
Git Access
----------
The GNU make source repository is available via Git from the GNU Savannah Git
The GNU Make source repository is available via Git from the GNU Savannah Git
server; look here for details:
https://savannah.gnu.org/git/?group=make
Please note: you won't be able to build GNU make from Git without installing
Please note: you won't be able to build GNU Make from Git without installing
appropriate maintainer's tools, such as GNU m4, automake, autoconf, Perl, GNU
make, and GCC.
See the README.git file for instructions on how to build GNU make once these
See the README.git file for instructions on how to build GNU Make once these
tools are available. We make no guarantees about the contents or quality of
the latest code in the Git repository: it is not unheard of for code that is
known to be broken to be checked in. Use at your own risk.
@@ -133,7 +145,7 @@ that if you compile make with 'cc -O' on AIX 3.2, it will not work
correctly. It is said that using 'cc' without '-O' does work.
The standard /bin/sh on SunOS 4.1.3_U1 and 4.1.4 is broken and cannot be
used to configure GNU make. Please install a different shell such as
used to configure GNU Make. Please install a different shell such as
bash or pdksh in order to run "configure". See this message for more
information:
https://mail.gnu.org/archive/html/bug-autoconf/2003-10/msg00190.html
@@ -142,7 +154,7 @@ One area that is often a problem in configuration and porting is the code
to check the system's current load average. To make it easier to test and
debug this code, you can do 'make check-loadavg' to see if it works
properly on your system. (You must run 'configure' beforehand, but you
need not build Make itself to run this test.)
need not build 'make' itself to run this test.)
Another potential source of porting problems is the support for large
files (LFS) in configure for those operating systems that provide it.
@@ -151,7 +163,7 @@ difficulties, then as a workaround you should be able to disable LFS by
adding the '--disable-largefile' option to the 'configure' script.
On systems that support micro- and nano-second timestamp values and
where stat(2) provides this information, GNU make will use it when
where stat(2) provides this information, GNU Make will use it when
comparing timestamps to get the most accurate possible result. However,
note that many current implementations of tools that *set* timestamps do
not preserve micro- or nano-second granularity. This means that "cp -p"
@@ -165,13 +177,15 @@ force make to treat them properly. See the manual for details.
Ports
-----
- See README.customs for details on integrating GNU make with the
- See README.customs for details on integrating GNU Make with the
Customs distributed build environment from the Pmake distribution.
- See README.VMS for details about GNU Make on OpenVMS.
- See README.Amiga for details about GNU Make on AmigaDOS.
- See README.zOS for details about GNU Make on z/OS.
- See README.W32 for details about GNU Make on Windows NT, 95, or 98.
- See README.DOS for compilation instructions on MS-DOS and MS-Windows
@@ -181,19 +195,19 @@ Ports
of DJGPP; see the WWW page https://www.delorie.com/djgpp/ for more
information.
The Cygwin project maintains its own port of GNU make. That port may have
The Cygwin project maintains its own port of GNU Make. That port may have
patches which are not present in this version. If you are using Cygwin
you should use their version of GNU make, and if you have questions about
you should use their version of GNU Make, and if you have questions about
it you should start by asking on those mailing lists and forums.
Please note there are two _separate_ ports of GNU make for Microsoft
Please note there are two _separate_ ports of GNU Make for Microsoft
systems: a native Windows tool built with (for example) MSVC or Cygwin,
and a DOS-based tool built with DJGPP. Please be sure you are looking
at the right README!
-------------------------------------------------------------------------------
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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

83
README.zOS Normal file
View File

@@ -0,0 +1,83 @@
-*-text-*-
GNU Make has been ported to z/OS, tested on z/OS V2R4.
PREREQUISITES
-------------
Building GNU Make requires certain tools be installed on your z/OS system.
These tools can be downloaded from: https://github.com/ZOSOpenTools
For detailed instructions on how to set up these tools, visit
https://zosopentools.github.io/meta/#/Guides/Pre-req
You will need curl, tar, and gzip to download and unpack the GNU Make release
package, but presumably you've already worked this out if you're reading this
document!
You will need the IBM C/C++ compiler. You can download a web deliverable
add-on feature to your XL C/C++ compiler here:
https://www-40.ibm.com/servers/resourcelink/svc00100.nsf/pages/xlCC++V241ForZOsV24
Alternatively, you can install and manage C/C++ for Open Enterprise Languages
on z/OS using RedHat OpenShift Container Platform and IBM Z and Cloud
Modernization Stack.
GNU Make has a dependency on the ZOSLIB library, which is documented here:
https://zosopentools.github.io/meta/#/Guides/Zoslib.
To obtain the latest release of zoslib, you can download it from here:
https://github.com/ZOSOpenTools/zoslibport/releases.
BUILDING
--------
If you are trying to build from a checked-out Git workspace, see README.git.
Before building GNU Make, you will need to ensure that the following
environment variables are set, to turn on z/OS enhanced ASCII support:
export _BPXK_AUTOCVT=ON
export _CEE_RUNOPTS="$_CEE_RUNOPTS FILETAG(AUTOCVT,AUTOTAG) POSIX(ON)"
export _TAG_REDIR_ERR=txt
export _TAG_REDIR_IN=txt
export _TAG_REDIR_OUT=txt
To ensure proper functioning of xlclang, set the following environment
variables before building:
export _CC_CCMODE=1
export _C89_CCMODE=1
export _CXX_CCMODE=1
Set PATH_TO_ZOSLIB to the location of your zoslib installation; e.g.:
PATH_TO_ZOSLIB=$HOME/zopen/prod/zoslib
Invoke ./configure as follows:
./configure \
CC=xlclang \
CPPFLAGS="-DNSIG=42 -D_XOPEN_SOURCE=600 -D_ALL_SOURCE -D_OPEN_SYS_FILE_EXT=1 -D_AE_BIMODAL=1 -D_ENHANCED_ASCII_EXT=0xFFFFFFF -DZOSLIB_OVERRIDE_CLIB=1" \
CFLAGS="-qascii -std=gnu11 -qnocsect -qenum=int -I$PATH_TO_ZOSLIB/include" \
LDFLAGS="-L$PATH_TO_ZOSLIB/lib" \
LIBS="-lzoslib $PATH_TO_ZOSLIB/lib/CXXRT64.x"
If you have an instance of make already available you can build with:
make
If not, you can build with:
./build.sh
TESTING
-------
To run the regression tests you'll need to install Perl and enable it.
Then you can run:
./make check
INSTALLING
----------
Copy the "make" program to wherever you want it to be installed, on your PATH.

View File

@@ -101,7 +101,7 @@ The Rest of the List
-------------------------------------------------------------------------------
Copyright (C) 1997-2022 Free Software Foundation, Inc.
Copyright (C) 1997-2023 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
@@ -114,4 +114,4 @@ 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/>.
this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -4,7 +4,7 @@
# also regenerates all aclocal.m4, config.h.in, Makefile.in, configure files
# with new versions of autoconf or automake.
# Copyright (C) 2003-2022 Free Software Foundation, Inc.
# Copyright (C) 2003-2023 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
@@ -30,457 +30,10 @@
# Alternatively, you can use an autogen.sh script that is specific
# to your package.
scriptversion=2022-07-24.15; # UTC
me="$0"
medir=`dirname "$me"`
# Read the function library and the configuration.
. "$medir"/bootstrap-funclib.sh
# Ensure that CDPATH is not set. Otherwise, the output from cd
# would cause trouble in at least one use below.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Environment variables that may be set by the user.
: "${AUTOPOINT=autopoint}"
: "${AUTORECONF=autoreconf}"
if test "$vc_ignore" = auto; then
vc_ignore=
test -d .git && vc_ignore=.gitignore
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
fi
usage() {
cat <<EOF
Usage: $me [OPTION]...
Bootstrap this package from the checked-out sources.
Optional environment variables:
GNULIB_SRCDIR Specifies the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
you want to use these sources.
Options:
--copy copy files instead of creating symbolic links
--force attempt to bootstrap even if the sources seem
not to have been checked out
EOF
bootstrap_print_option_usage_hook
cat <<EOF
If the file bootstrap.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap.
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored.
Gnulib sources are assumed to be present:
* in \$GNULIB_SRCDIR, if that environment variable is set,
* otherwise, in the 'gnulib' submodule, if such a submodule is configured,
* otherwise, in the 'gnulib' subdirectory.
Running without arguments will suffice in most cases.
EOF
}
# Parse options.
# Whether to use copies instead of symlinks.
copy=false
for option
do
case $option in
--help)
usage
exit;;
--version)
set -e
echo "autogen.sh $scriptversion"
echo "$copyright"
exit 0
;;
--force)
checkout_only_file=;;
--copy)
copy=true;;
*)
bootstrap_option_hook $option || die "$option: unknown option";;
esac
done
test -z "$GNULIB_SRCDIR" || test -d "$GNULIB_SRCDIR" \
|| die "Error: \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option is specified, but does not denote a directory"
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
die "Running this script from a non-checked-out distribution is risky."
fi
if $use_gnulib; then
if test -z "$GNULIB_SRCDIR"; then
gnulib_path=$(test -f .gitmodules && git config --file .gitmodules submodule.gnulib.path)
test -z "$gnulib_path" && gnulib_path=gnulib
GNULIB_SRCDIR=$gnulib_path
fi
fi
version_controlled_file() {
parent=$1
file=$2
if test -d .git; then
git rm -n "$file" > /dev/null 2>&1
elif test -d .svn; then
svn log -r HEAD "$file" > /dev/null 2>&1
elif test -d CVS; then
grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
grep '^/[^/]*/[0-9]' > /dev/null
else
warn_ "no version control for $file?"
false
fi
}
# Strip blank and comment lines to leave significant entries.
gitignore_entries() {
sed '/^#/d; /^$/d' "$@"
}
# If $STR is not already on a line by itself in $FILE, insert it at the start.
# Entries are inserted at the start of the ignore list to ensure existing
# entries starting with ! are not overridden. Such entries support
# whitelisting exceptions after a more generic blacklist pattern.
insert_if_absent() {
file=$1
str=$2
test -f $file || touch $file
test -r $file || die "Error: failed to read ignore file: $file"
duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
if [ "$duplicate_entries" ] ; then
die "Error: Duplicate entries in $file: " $duplicate_entries
fi
linesold=$(gitignore_entries $file | wc -l)
linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
if [ $linesold != $linesnew ] ; then
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|| die "insert_if_absent $file $str: failed"
fi
}
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
# insert_if_absent.
insert_vc_ignore() {
vc_ignore_file="$1"
pattern="$2"
case $vc_ignore_file in
*.gitignore)
# A .gitignore entry that does not start with '/' applies
# recursively to subdirectories, so prepend '/' to every
# .gitignore entry.
pattern=$(echo "$pattern" | sed s,^,/,);;
esac
insert_if_absent "$vc_ignore_file" "$pattern"
}
symlink_to_dir()
{
src=$1/$2
dst=${3-$2}
test -f "$src" && {
# If the destination directory doesn't exist, create it.
# This is required at least for "lib/uniwidth/cjk.h".
dst_dir=$(dirname "$dst")
if ! test -d "$dst_dir"; then
mkdir -p "$dst_dir"
# If we've just created a directory like lib/uniwidth,
# tell version control system(s) it's ignorable.
# FIXME: for now, this does only one level
parent=$(dirname "$dst_dir")
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
ig=$parent/$dot_ig
insert_vc_ignore $ig "${dst_dir##*/}"
done
fi
if $copy; then
{
test ! -h "$dst" || {
echo "$me: rm -f $dst" &&
rm -f "$dst"
}
} &&
test -f "$dst" &&
cmp -s "$src" "$dst" || {
echo "$me: cp -fp $src $dst" &&
cp -fp "$src" "$dst"
}
else
# Leave any existing symlink alone, if it already points to the source,
# so that broken build tools that care about symlink times
# aren't confused into doing unnecessary builds. Conversely, if the
# existing symlink's timestamp is older than the source, make it afresh,
# so that broken tools aren't confused into skipping needed builds. See
# <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
test -h "$dst" &&
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
test "$src_i" = "$dst_i" &&
both_ls=$(ls -dt "$src" "$dst") &&
test "X$both_ls" = "X$dst$nl$src" || {
dot_dots=
case $src in
/*) ;;
*)
case /$dst/ in
*//* | */../* | */./* | /*/*/*/*/*/)
die "invalid symlink calculation: $src -> $dst";;
/*/*/*/*/) dot_dots=../../../;;
/*/*/*/) dot_dots=../../;;
/*/*/) dot_dots=../;;
esac;;
esac
echo "$me: ln -fs $dot_dots$src $dst" &&
ln -fs "$dot_dots$src" "$dst"
}
fi
}
}
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
found_aux_dir=no
grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'])' configure.ac \
>/dev/null && found_aux_dir=yes
grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
>/dev/null && found_aux_dir=yes
test $found_aux_dir = yes \
|| die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it"
# If $build_aux doesn't exist, create it now, otherwise some bits
# below will malfunction. If creating it, also mark it as ignored.
if test ! -d $build_aux; then
mkdir $build_aux
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
insert_vc_ignore $dot_ig $build_aux
done
fi
check_build_prerequisites false
use_libtool=0
# We'd like to use grep -E, to see if any of LT_INIT,
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
# but that's not portable enough (e.g., for Solaris).
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
&& use_libtool=1
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
&& use_libtool=1
if test $use_libtool = 1; then
find_tool LIBTOOLIZE glibtoolize libtoolize
fi
if $use_gnulib; then
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || exit $?
fi
# NOTE: we have to be careful to run both autopoint and libtoolize
# before gnulib-tool, since gnulib-tool is likely to provide newer
# versions of files "installed" by these two programs.
# Then, *after* gnulib-tool (see below), we have to be careful to
# run autoreconf in such a way that it does not run either of these
# two just-pre-run programs.
# Import from gettext.
with_gettext=yes
grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
with_gettext=no
if test $with_gettext = yes || test $use_libtool = 1; then
tempbase=.bootstrap$$
trap "rm -f $tempbase.0 $tempbase.1" 1 2 13 15
> $tempbase.0 > $tempbase.1 &&
find . ! -type d -print | sort > $tempbase.0 || exit
if test $with_gettext = yes; then
# Released autopoint has the tendency to install macros that have been
# obsoleted in current gnulib, so run this before gnulib-tool.
echo "$0: $AUTOPOINT --force"
$AUTOPOINT --force || exit
fi
# Autoreconf runs aclocal before libtoolize, which causes spurious
# warnings if the initial aclocal is confused by the libtoolized
# (or worse out-of-date) macro directory.
# libtoolize 1.9b added the --install option; but we support back
# to libtoolize 1.5.22, where the install action was default.
if test $use_libtool = 1; then
install=
case $($LIBTOOLIZE --help) in
*--install*) install=--install ;;
esac
echo "running: $LIBTOOLIZE $install --copy"
$LIBTOOLIZE $install --copy
fi
find . ! -type d -print | sort >$tempbase.1
old_IFS=$IFS
IFS=$nl
for file in $(comm -13 $tempbase.0 $tempbase.1); do
IFS=$old_IFS
parent=${file%/*}
version_controlled_file "$parent" "$file" || {
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
ig=$parent/$dot_ig
insert_vc_ignore "$ig" "${file##*/}"
done
}
done
IFS=$old_IFS
rm -f $tempbase.0 $tempbase.1
trap - 1 2 13 15
fi
# Import from gnulib.
if $use_gnulib; then
gnulib_tool_options="\
--no-changelog\
--aux-dir=$build_aux\
--doc-base=$doc_base\
--lib=$gnulib_name\
--m4-base=$m4_base/\
--source-base=$source_base/\
--tests-base=$tests_base\
--local-dir=$local_gl_dir\
$gnulib_tool_option_extras\
"
if test $use_libtool = 1; then
case "$gnulib_tool_options " in
*' --libtool '*) ;;
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
esac
fi
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|| die "gnulib-tool failed"
for file in $gnulib_files; do
symlink_to_dir "$GNULIB_SRCDIR" $file \
|| die "failed to symlink $file"
done
fi
bootstrap_post_import_hook \
|| die "bootstrap_post_import_hook failed"
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
# The following requires GNU find 4.2.3 or newer. Considering the usual
# portability constraints of this script, that may seem a very demanding
# requirement, but it should be ok. Ignore any failure, which is fine,
# since this is only a convenience to help developers avoid the relatively
# unusual case in which a symlinked-to .m4 file is git-removed from gnulib
# between successive runs of this script.
find "$m4_base" "$source_base" \
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
-type l -xtype l -delete > /dev/null 2>&1
# Invoke autoreconf with --force --install to ensure upgrades of tools
# such as ylwrap.
AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
# Some systems (RHEL 5) are using ancient autotools, for which the
# --no-recursive option had not been invented. Detect that lack and
# omit the option when it's not supported. FIXME in 2017: remove this
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
case $($AUTORECONF --help) in
*--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";;
esac
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \
|| die "autoreconf failed"
# Get some extra files from gnulib, overriding existing files.
for file in $gnulib_extra_files; do
case $file in
*/INSTALL) dst=INSTALL;;
build-aux/*) dst=$build_aux/${file#build-aux/};;
*) dst=$file;;
esac
symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
|| die "failed to symlink $file"
done
if test $with_gettext = yes; then
# Create gettext configuration.
echo "$0: Creating po/Makevars from po/Makevars.template ..."
rm -f po/Makevars
sed '
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
/^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
/^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
}
' po/Makevars.template >po/Makevars \
|| die 'cannot generate po/Makevars'
# If the 'gettext' module is in use, grab the latest Makefile.in.in.
# If only the 'gettext-h' module is in use, assume autopoint already
# put the correct version of this file into place.
case $gnulib_modules in
*gettext-h*) ;;
*gettext*)
cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \
|| die "cannot create po/Makefile.in.in"
;;
esac
if test -d runtime-po; then
# Similarly for runtime-po/Makevars, but not quite the same.
rm -f runtime-po/Makevars
sed '
/^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
/^subdir *=.*/s/=.*/= runtime-po/
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
}
' po/Makevars.template >runtime-po/Makevars \
|| die 'cannot generate runtime-po/Makevars'
# Copy identical files from po to runtime-po.
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
fi
fi
bootstrap_epilogue
echo "$0: done. Now you can run './configure'."
# ----------------------------------------------------------------------------
# Local Variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
autogen "$@"

View File

@@ -2,7 +2,7 @@
# Convenience script for fetching auxiliary files that are omitted from
# the version control repository of this package.
# Copyright (C) 2003-2022 Free Software Foundation, Inc.
# Copyright (C) 2003-2023 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
@@ -28,246 +28,10 @@
# Alternatively, you can use an autopull.sh script that is specific
# to your package.
scriptversion=2022-07-24.15; # UTC
me="$0"
medir=`dirname "$me"`
# Read the function library and the configuration.
. "$medir"/bootstrap-funclib.sh
# Ensure that CDPATH is not set. Otherwise, the output from cd
# would cause trouble in at least one use below.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
usage() {
cat <<EOF
Usage: $me [OPTION]...
Bootstrap this package from the checked-out sources.
Optional environment variables:
GNULIB_SRCDIR Specifies the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
you want to use these sources.
GNULIB_REFDIR Specifies the local directory where a gnulib
repository (with a .git subdirectory) resides.
Use this if you already have gnulib sources
and history on your machine, and do not want
to waste your bandwidth downloading them again.
GNULIB_URL Cloneable URL of the gnulib repository.
Options:
--bootstrap-sync if this bootstrap script is not identical to
the version in the local gnulib sources,
update this script, and then restart it with
/bin/sh or the shell \$CONFIG_SHELL
--no-bootstrap-sync do not check whether bootstrap is out of sync
--force attempt to bootstrap even if the sources seem
not to have been checked out
--no-git do not use git to update gnulib. Requires that
\$GNULIB_SRCDIR or the --gnulib-srcdir option
points to a gnulib repository with the correct
revision
--skip-po do not download po files
EOF
bootstrap_print_option_usage_hook
cat <<EOF
If the file bootstrap.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap.
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored.
Gnulib sources can be fetched in various ways:
* If the environment variable GNULIB_SRCDIR is set (either as an
environment variable or via the --gnulib-srcdir option), then sources
are fetched from that local directory. If it is a git repository and
the configuration variable GNULIB_REVISION is set in bootstrap.conf,
then that revision is checked out.
* Otherwise, if this package is in a git repository with a 'gnulib'
submodule configured, then that submodule is initialized and updated
and sources are fetched from there. If GNULIB_REFDIR is set (either
as an environment variable or via the --gnulib-refdir option) and is
a git repository, then it is used as a reference.
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources
are cloned into that directory using git from \$GNULIB_URL, defaulting
to $default_gnulib_url.
If the configuration variable GNULIB_REVISION is set in bootstrap.conf,
then that revision is checked out.
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are
used. If it is a git repository and the configuration variable
GNULIB_REVISION is set in bootstrap.conf, then that revision is
checked out.
If you maintain a package and want to pin a particular revision of the
Gnulib sources that has been tested with your package, then there are
two possible approaches: either configure a 'gnulib' submodule with the
appropriate revision, or set GNULIB_REVISION (and if necessary
GNULIB_URL) in bootstrap.conf.
Running without arguments will suffice in most cases.
EOF
}
# Parse options.
# Use git to update gnulib sources
use_git=true
for option
do
case $option in
--help)
usage
exit;;
--version)
set -e
echo "autopull.sh $scriptversion"
echo "$copyright"
exit 0
;;
--skip-po)
SKIP_PO=t;;
--force)
checkout_only_file=;;
--bootstrap-sync)
bootstrap_sync=true;;
--no-bootstrap-sync)
bootstrap_sync=false;;
--no-git)
use_git=false;;
*)
bootstrap_option_hook $option || die "$option: unknown option";;
esac
done
$use_git || test -n "$GNULIB_SRCDIR" \
|| die "Error: --no-git requires \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option"
test -z "$GNULIB_SRCDIR" || test -d "$GNULIB_SRCDIR" \
|| die "Error: \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option is specified, but does not denote a directory"
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
die "Running this script from a non-checked-out distribution is risky."
fi
check_build_prerequisites $use_git
if $use_gnulib || $bootstrap_sync; then
prepare_GNULIB_SRCDIR
if $bootstrap_sync; then
upgrade_bootstrap
fi
fi
# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
# Also find the compatible sha1 utility on the BSDs
if test x"$SKIP_PO" = x; then
find_tool SHA1SUM sha1sum gsha1sum shasum sha1
fi
# See if we can use gnulib's git-merge-changelog merge driver.
if $use_git && test -d .git && check_exists git; then
if git config merge.merge-changelog.driver >/dev/null ; then
:
elif check_exists git-merge-changelog; then
echo "$0: initializing git-merge-changelog driver"
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
else
echo "$0: consider installing git-merge-changelog from gnulib"
fi
fi
# ----------------------------- Get translations. -----------------------------
download_po_files() {
subdir=$1
domain=$2
echo "$me: getting translations into $subdir for $domain..."
cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
eval "$cmd"
}
# Mirror .po files to $po_dir/.reference and copy only the new
# or modified ones into $po_dir. Also update $po_dir/LINGUAS.
# Note po files that exist locally only are left in $po_dir but will
# not be included in LINGUAS and hence will not be distributed.
update_po_files() {
# Directory containing primary .po files.
# Overwrite them only when we're sure a .po file is new.
po_dir=$1
domain=$2
# Mirror *.po files into this dir.
# Usually contains *.s1 checksum files.
ref_po_dir="$po_dir/.reference"
test -d $ref_po_dir || mkdir $ref_po_dir || return
download_po_files $ref_po_dir $domain \
&& ls "$ref_po_dir"/*.po 2>/dev/null |
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
test "$langs" = '*' && langs=x
for po in $langs; do
case $po in x) continue;; esac
new_po="$ref_po_dir/$po.po"
cksum_file="$ref_po_dir/$po.s1"
if ! test -f "$cksum_file" ||
! test -f "$po_dir/$po.po" ||
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
echo "$me: updated $po_dir/$po.po..."
cp "$new_po" "$po_dir/$po.po" \
&& $SHA1SUM < "$new_po" > "$cksum_file" || return
fi
done
}
case $SKIP_PO in
'')
if test -d po; then
update_po_files po $package || exit
fi
if test -d runtime-po; then
update_po_files runtime-po $package-runtime || exit
fi;;
esac
# -----------------------------------------------------------------------------
bootstrap_post_pull_hook \
|| die "bootstrap_post_pull_hook failed"
# Don't proceed if there are uninitialized submodules. In particular,
# autogen.sh will remove dangling links, which might be links into
# uninitialized submodules.
# But it's OK if the 'gnulib' submodule is uninitialized, as long as
# GNULIB_SRCDIR is set.
if $use_git; then
# Uninitialized submodules are listed with an initial dash.
uninitialized=`git submodule | grep '^-' | awk '{ print $2 }'`
if test -n "$GNULIB_SRCDIR"; then
uninitialized=`echo "$uninitialized" | grep -v '^gnulib$'`
fi
if test -n "$uninitialized"; then
die "Some git submodules are not initialized: "`echo "$uninitialized" | tr '\n' ',' | sed -e 's|,$|.|'`" Either use option '--no-git', or run 'git submodule update --init' and bootstrap again."
fi
fi
echo "$0: done. Now you can run './autogen.sh'."
# ----------------------------------------------------------------------------
# Local Variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"
# End:
autopull "$@"

View File

@@ -1,7 +1,9 @@
#! /bin/sh
# Bootstrap this package from checked-out sources.
# Copyright (C) 2003-2022 Free Software Foundation, Inc.
scriptversion=2022-12-27.07; # UTC
# Copyright (C) 2003-2023 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
@@ -26,8 +28,6 @@
# Please report bugs or propose patches to bug-gnulib@gnu.org.
scriptversion=2022-07-29.23; # UTC
me="$0"
medir=`dirname "$me"`
@@ -48,6 +48,11 @@ Optional environment variables:
GNULIB_URL Cloneable URL of the gnulib repository.
Options:
--pull Do phase 1: pull files from network
--gen Do phase 2: generate from local files.
(The default is to do both phases.)
--gnulib-srcdir=DIRNAME specify the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
@@ -59,11 +64,13 @@ Options:
and history on your machine, and do not want
to waste your bandwidth downloading them again.
Defaults to \$GNULIB_REFDIR
--bootstrap-sync if this bootstrap script is not identical to
the version in the local gnulib sources,
update this script, and then restart it with
/bin/sh or the shell \$CONFIG_SHELL
--no-bootstrap-sync do not check whether bootstrap is out of sync
--copy copy files instead of creating symbolic links
--force attempt to bootstrap even if the sources seem
not to have been checked out
@@ -118,6 +125,10 @@ EOF
# Parse options.
# Whether to pull and generate.
pull=false
gen=false
# Whether to use copies instead of symlinks.
copy=false
@@ -132,10 +143,14 @@ do
exit;;
--version)
set -e
echo "bootstrap $scriptversion"
echo "bootstrap $scriptversion lib $scriptlibversion"
echo "$copyright"
exit 0
;;
--pull)
pull=true;;
--gen)
gen=true;;
--gnulib-srcdir=*)
GNULIB_SRCDIR=${option#--gnulib-srcdir=};;
--gnulib-refdir=*)
@@ -157,6 +172,9 @@ do
esac
done
# Default is to do both.
$pull || $gen || pull=true gen=true
$use_git || test -n "$GNULIB_SRCDIR" \
|| die "Error: --no-git requires \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option"
test -z "$GNULIB_SRCDIR" || test -d "$GNULIB_SRCDIR" \
@@ -168,12 +186,6 @@ fi
check_build_prerequisites $use_git
if ! test -f "$medir"/bootstrap-funclib.sh; then
# We have only completed the first phase of an upgrade from a bootstrap
# version < 2022-07-24. Need to do the second phase now.
bootstrap_sync=true
fi
if $bootstrap_sync; then
prepare_GNULIB_SRCDIR
upgrade_bootstrap
@@ -183,25 +195,25 @@ fi
echo "$0: Bootstrapping from checked-out $package sources..."
# Pass GNULIB_SRCDIR to autopull.sh and autogen.sh.
# Pass GNULIB_SRCDIR and GNULIB_REFDIR to any subsidiary commands that care.
export GNULIB_SRCDIR
# Pass GNULIB_REFDIR to autopull.sh.
export GNULIB_REFDIR
if $use_git || test -z "$SKIP_PO"; then
"$medir"/autopull.sh \
if $pull && { $use_git || test -z "$SKIP_PO"; }; then
autopull \
`if $bootstrap_sync; then echo ' --bootstrap-sync'; else echo ' --no-bootstrap-sync'; fi` \
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
`if ! $use_git; then echo ' --no-git'; fi` \
`if test -n "$SKIP_PO"; then echo ' --skip-po'; fi` \
|| die "autopull.sh failed."
|| die "could not fetch auxiliary files"
fi
"$medir"/autogen.sh \
if $gen; then
autogen \
`if $copy; then echo ' --copy'; fi` \
`if test -z "$checkout_only_file"; then echo ' --force'; fi` \
|| die "autogen.sh failed."
|| die "could not generate auxiliary files"
fi
# ----------------------------------------------------------------------------

View File

@@ -1,6 +1,8 @@
# A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
# Copyright (C) 2003-2022 Free Software Foundation, Inc.
scriptlibversion=2022-12-27.16; # UTC
# Copyright (C) 2003-2023 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
@@ -23,8 +25,6 @@
# file also maintained in your version control; gnulib comes with a
# template build-aux/bootstrap.conf to get you started.
scriptversion=2022-07-24.15; # UTC
nl='
'
@@ -38,7 +38,7 @@ PERL="${PERL-perl}"
default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git
# Copyright year, for the --version output.
copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
copyright_year=`echo "$scriptlibversion" | sed -e 's/[^0-9].*//'`
copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
@@ -501,7 +501,7 @@ prepare_GNULIB_SRCDIR ()
elif [ ! -d "$gnulib_path" ]; then
echo "$0: getting gnulib files..."
trap cleanup_gnulib 1 2 13 15
trap cleanup_gnulib HUP INT PIPE TERM
shallow=
if test -z "$GNULIB_REVISION"; then
@@ -531,7 +531,7 @@ prepare_GNULIB_SRCDIR ()
git -C "$gnulib_path" reset --hard FETCH_HEAD
fi
trap - 1 2 13 15
trap - HUP INT PIPE TERM
fi
fi
GNULIB_SRCDIR=$gnulib_path
@@ -554,18 +554,28 @@ prepare_GNULIB_SRCDIR ()
upgrade_bootstrap ()
{
{ cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/top/bootstrap" \
&& cmp -s "$medir"/bootstrap-funclib.sh "$GNULIB_SRCDIR/top/bootstrap-funclib.sh" \
&& cmp -s "$medir"/autopull.sh "$GNULIB_SRCDIR/top/autopull.sh" \
&& cmp -s "$medir"/autogen.sh "$GNULIB_SRCDIR/top/autogen.sh"; \
} || {
echo "$0: updating bootstrap & companions and restarting..."
if test -f "$medir"/bootstrap-funclib.sh; then
update_lib=true
{ cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/top/bootstrap" \
&& cmp -s "$medir"/bootstrap-funclib.sh "$GNULIB_SRCDIR/top/bootstrap-funclib.sh" \
&& cmp -s "$medir"/autopull.sh "$GNULIB_SRCDIR/top/autopull.sh" \
&& cmp -s "$medir"/autogen.sh "$GNULIB_SRCDIR/top/autogen.sh"; \
}
else
update_lib=false
cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/build-aux/bootstrap"
fi || {
if $update_lib; then
echo "$0: updating bootstrap & companions and restarting..."
else
echo "$0: updating bootstrap and restarting..."
fi
case $(sh -c 'echo "$1"' -- a) in
a) ignored=--;;
*) ignored=ignored;;
esac
exec sh -c \
'{ if test -f "$1"; then cp "$1" "$3"; else cp "$2" "$3"; fi; } && { if test -f "$4"; then cp "$4" "$5"; else rm -f "$5"; fi; } && { if test -f "$6"; then cp "$6" "$7"; else rm -f "$7"; fi; } && { if test -f "$8"; then cp "$8" "$9"; else rm -f "$9"; fi; } && shift && shift && shift && shift && shift && shift && shift && shift && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
'{ if '$update_lib' && test -f "$1"; then cp "$1" "$3"; else cp "$2" "$3"; fi; } && { if '$update_lib' && test -f "$4"; then cp "$4" "$5"; else rm -f "$5"; fi; } && { if '$update_lib' && test -f "$6"; then cp "$6" "$7"; else rm -f "$7"; fi; } && { if '$update_lib' && test -f "$8"; then cp "$8" "$9"; else rm -f "$9"; fi; } && shift && shift && shift && shift && shift && shift && shift && shift && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
$ignored \
"$GNULIB_SRCDIR/top/bootstrap" "$GNULIB_SRCDIR/build-aux/bootstrap" "$medir/bootstrap" \
"$GNULIB_SRCDIR/top/bootstrap-funclib.sh" "$medir/bootstrap-funclib.sh" \
@@ -583,11 +593,692 @@ else
use_gnulib=true
fi
# -------- Fetch auxiliary files from the network. --------------------------
autopull_usage() {
cat <<EOF
Usage: $me [OPTION]...
Bootstrap this package from the checked-out sources.
Optional environment variables:
GNULIB_SRCDIR Specifies the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
you want to use these sources.
GNULIB_REFDIR Specifies the local directory where a gnulib
repository (with a .git subdirectory) resides.
Use this if you already have gnulib sources
and history on your machine, and do not want
to waste your bandwidth downloading them again.
GNULIB_URL Cloneable URL of the gnulib repository.
Options:
--bootstrap-sync if this bootstrap script is not identical to
the version in the local gnulib sources,
update this script, and then restart it with
/bin/sh or the shell \$CONFIG_SHELL
--no-bootstrap-sync do not check whether bootstrap is out of sync
--force attempt to bootstrap even if the sources seem
not to have been checked out
--no-git do not use git to update gnulib. Requires that
\$GNULIB_SRCDIR or the --gnulib-srcdir option
points to a gnulib repository with the correct
revision
--skip-po do not download po files
EOF
bootstrap_print_option_usage_hook
cat <<EOF
If the file bootstrap.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap.
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored.
Gnulib sources can be fetched in various ways:
* If the environment variable GNULIB_SRCDIR is set (either as an
environment variable or via the --gnulib-srcdir option), then sources
are fetched from that local directory. If it is a git repository and
the configuration variable GNULIB_REVISION is set in bootstrap.conf,
then that revision is checked out.
* Otherwise, if this package is in a git repository with a 'gnulib'
submodule configured, then that submodule is initialized and updated
and sources are fetched from there. If GNULIB_REFDIR is set (either
as an environment variable or via the --gnulib-refdir option) and is
a git repository, then it is used as a reference.
* Otherwise, if the 'gnulib' directory does not exist, Gnulib sources
are cloned into that directory using git from \$GNULIB_URL, defaulting
to $default_gnulib_url.
If the configuration variable GNULIB_REVISION is set in bootstrap.conf,
then that revision is checked out.
* Otherwise, the existing Gnulib sources in the 'gnulib' directory are
used. If it is a git repository and the configuration variable
GNULIB_REVISION is set in bootstrap.conf, then that revision is
checked out.
If you maintain a package and want to pin a particular revision of the
Gnulib sources that has been tested with your package, then there are
two possible approaches: either configure a 'gnulib' submodule with the
appropriate revision, or set GNULIB_REVISION (and if necessary
GNULIB_URL) in bootstrap.conf.
Running without arguments will suffice in most cases.
EOF
}
# Fetch auxiliary files that are omitted from the version control
# repository of this package.
autopull()
{
# Ensure that CDPATH is not set. Otherwise, the output from cd
# would cause trouble in at least one use below.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Parse options.
# Use git to update gnulib sources
use_git=true
for option
do
case $option in
--help)
autopull_usage
return;;
--version)
set -e
echo "autopull.sh $scriptlibversion"
echo "$copyright"
return 0
;;
--skip-po)
SKIP_PO=t;;
--force)
checkout_only_file=;;
--bootstrap-sync)
bootstrap_sync=true;;
--no-bootstrap-sync)
bootstrap_sync=false;;
--no-git)
use_git=false;;
*)
bootstrap_option_hook $option || die "$option: unknown option";;
esac
done
$use_git || test -n "$GNULIB_SRCDIR" \
|| die "Error: --no-git requires \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option"
test -z "$GNULIB_SRCDIR" || test -d "$GNULIB_SRCDIR" \
|| die "Error: \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option is specified, but does not denote a directory"
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
die "Running this script from a non-checked-out distribution is risky."
fi
check_build_prerequisites $use_git
if $use_gnulib || $bootstrap_sync; then
prepare_GNULIB_SRCDIR
if $bootstrap_sync; then
upgrade_bootstrap
fi
fi
# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
# Also find the compatible sha1 utility on the BSDs
if test x"$SKIP_PO" = x; then
find_tool SHA1SUM sha1sum gsha1sum shasum sha1
fi
# See if we can use gnulib's git-merge-changelog merge driver.
if $use_git && test -d .git && check_exists git; then
if git config merge.merge-changelog.driver >/dev/null ; then
:
elif check_exists git-merge-changelog; then
echo "$0: initializing git-merge-changelog driver"
git config merge.merge-changelog.name 'GNU-style ChangeLog merge driver'
git config merge.merge-changelog.driver 'git-merge-changelog %O %A %B'
else
echo "$0: consider installing git-merge-changelog from gnulib"
fi
fi
case $SKIP_PO in
'')
if test -d po; then
update_po_files po $package || return
fi
if test -d runtime-po; then
update_po_files runtime-po $package-runtime || return
fi;;
esac
# ---------------------------------------------------------------------------
bootstrap_post_pull_hook \
|| die "bootstrap_post_pull_hook failed"
# Don't proceed if there are uninitialized submodules. In particular,
# autogen.sh will remove dangling links, which might be links into
# uninitialized submodules.
# But it's OK if the 'gnulib' submodule is uninitialized, as long as
# GNULIB_SRCDIR is set.
if $use_git; then
# Uninitialized submodules are listed with an initial dash.
uninitialized=`git submodule | grep '^-' | awk '{ print $2 }'`
if test -n "$GNULIB_SRCDIR"; then
uninitialized=`echo "$uninitialized" | grep -v '^gnulib$'`
fi
if test -n "$uninitialized"; then
die "Some git submodules are not initialized: "`echo "$uninitialized" | tr '\n' ',' | sed -e 's|,$|.|'`" Either use option '--no-git', or run 'git submodule update --init' and bootstrap again."
fi
fi
echo "$0: done. Now you can run './autogen.sh'."
}
# ----------------------------- Get translations. -----------------------------
download_po_files() {
subdir=$1
domain=$2
echo "$me: getting translations into $subdir for $domain..."
cmd=$(printf "$po_download_command_format" "$subdir" "$domain")
eval "$cmd"
}
# Mirror .po files to $po_dir/.reference and copy only the new
# or modified ones into $po_dir. Also update $po_dir/LINGUAS.
# Note po files that exist locally only are left in $po_dir but will
# not be included in LINGUAS and hence will not be distributed.
update_po_files() {
# Directory containing primary .po files.
# Overwrite them only when we're sure a .po file is new.
po_dir=$1
domain=$2
# Mirror *.po files into this dir.
# Usually contains *.s1 checksum files.
ref_po_dir="$po_dir/.reference"
test -d $ref_po_dir || mkdir $ref_po_dir || return
download_po_files $ref_po_dir $domain \
&& ls "$ref_po_dir"/*.po 2>/dev/null |
sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
test "$langs" = '*' && langs=x
for po in $langs; do
case $po in x) continue;; esac
new_po="$ref_po_dir/$po.po"
cksum_file="$ref_po_dir/$po.s1"
if ! test -f "$cksum_file" ||
! test -f "$po_dir/$po.po" ||
! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
echo "$me: updated $po_dir/$po.po..."
cp "$new_po" "$po_dir/$po.po" \
&& $SHA1SUM < "$new_po" > "$cksum_file" || return
fi
done
}
# -------- Generate files automatically from existing sources. --------------
autogen_usage() {
cat <<EOF
Usage: $me [OPTION]...
Bootstrap this package from the checked-out sources.
Optional environment variables:
GNULIB_SRCDIR Specifies the local directory where gnulib
sources reside. Use this if you already
have gnulib sources on your machine, and
you want to use these sources.
Options:
--copy copy files instead of creating symbolic links
--force attempt to bootstrap even if the sources seem
not to have been checked out
EOF
bootstrap_print_option_usage_hook
cat <<EOF
If the file bootstrap.conf exists in the same directory as this script, its
contents are read as shell variables to configure the bootstrap.
For build prerequisites, environment variables like \$AUTOCONF and \$AMTAR
are honored.
Gnulib sources are assumed to be present:
* in \$GNULIB_SRCDIR, if that environment variable is set,
* otherwise, in the 'gnulib' submodule, if such a submodule is configured,
* otherwise, in the 'gnulib' subdirectory.
Running without arguments will suffice in most cases.
EOF
}
version_controlled_file() {
parent=$1
file=$2
if test -d .git; then
git rm -n "$file" > /dev/null 2>&1
elif test -d .svn; then
svn log -r HEAD "$file" > /dev/null 2>&1
elif test -d CVS; then
grep -F "/${file##*/}/" "$parent/CVS/Entries" 2>/dev/null |
grep '^/[^/]*/[0-9]' > /dev/null
else
warn_ "no version control for $file?"
false
fi
}
# Strip blank and comment lines to leave significant entries.
gitignore_entries() {
sed '/^#/d; /^$/d' "$@"
}
# If $STR is not already on a line by itself in $FILE, insert it at the start.
# Entries are inserted at the start of the ignore list to ensure existing
# entries starting with ! are not overridden. Such entries support
# whitelisting exceptions after a more generic blacklist pattern.
insert_if_absent() {
file=$1
str=$2
test -f $file || touch $file
test -r $file || die "Error: failed to read ignore file: $file"
duplicate_entries=$(gitignore_entries $file | sort | uniq -d)
if [ "$duplicate_entries" ] ; then
die "Error: Duplicate entries in $file: " $duplicate_entries
fi
linesold=$(gitignore_entries $file | wc -l)
linesnew=$( { echo "$str"; cat $file; } | gitignore_entries | sort -u | wc -l)
if [ $linesold != $linesnew ] ; then
{ echo "$str" | cat - $file > $file.bak && mv $file.bak $file; } \
|| die "insert_if_absent $file $str: failed"
fi
}
# Adjust $PATTERN for $VC_IGNORE_FILE and insert it with
# insert_if_absent.
insert_vc_ignore() {
vc_ignore_file="$1"
pattern="$2"
case $vc_ignore_file in
*.gitignore)
# A .gitignore entry that does not start with '/' applies
# recursively to subdirectories, so prepend '/' to every
# .gitignore entry.
pattern=$(echo "$pattern" | sed s,^,/,);;
esac
insert_if_absent "$vc_ignore_file" "$pattern"
}
symlink_to_dir()
{
src=$1/$2
dst=${3-$2}
test -f "$src" && {
# If the destination directory doesn't exist, create it.
# This is required at least for "lib/uniwidth/cjk.h".
dst_dir=$(dirname "$dst")
if ! test -d "$dst_dir"; then
mkdir -p "$dst_dir"
# If we've just created a directory like lib/uniwidth,
# tell version control system(s) it's ignorable.
# FIXME: for now, this does only one level
parent=$(dirname "$dst_dir")
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
ig=$parent/$dot_ig
insert_vc_ignore $ig "${dst_dir##*/}"
done
fi
if $copy; then
{
test ! -h "$dst" || {
echo "$me: rm -f $dst" &&
rm -f "$dst"
}
} &&
test -f "$dst" &&
cmp -s "$src" "$dst" || {
echo "$me: cp -fp $src $dst" &&
cp -fp "$src" "$dst"
}
else
# Leave any existing symlink alone, if it already points to the source,
# so that broken build tools that care about symlink times
# aren't confused into doing unnecessary builds. Conversely, if the
# existing symlink's timestamp is older than the source, make it afresh,
# so that broken tools aren't confused into skipping needed builds. See
# <https://lists.gnu.org/r/bug-gnulib/2011-05/msg00326.html>.
test -h "$dst" &&
src_ls=$(ls -diL "$src" 2>/dev/null) && set $src_ls && src_i=$1 &&
dst_ls=$(ls -diL "$dst" 2>/dev/null) && set $dst_ls && dst_i=$1 &&
test "$src_i" = "$dst_i" &&
both_ls=$(ls -dt "$src" "$dst") &&
test "X$both_ls" = "X$dst$nl$src" || {
dot_dots=
case $src in
/*) ;;
*)
case /$dst/ in
*//* | */../* | */./* | /*/*/*/*/*/)
die "invalid symlink calculation: $src -> $dst";;
/*/*/*/*/) dot_dots=../../../;;
/*/*/*/) dot_dots=../../;;
/*/*/) dot_dots=../;;
esac;;
esac
echo "$me: ln -fs $dot_dots$src $dst" &&
ln -fs "$dot_dots$src" "$dst"
}
fi
}
}
# Regenerate all autogeneratable files that are omitted from the
# version control repository. In particular, regenerate all
# aclocal.m4, config.h.in, Makefile.in, configure files with new
# versions of autoconf or automake.
autogen()
{
# Ensure that CDPATH is not set. Otherwise, the output from cd
# would cause trouble in at least one use below.
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
# Environment variables that may be set by the user.
: "${AUTOPOINT=autopoint}"
: "${AUTORECONF=autoreconf}"
if test "$vc_ignore" = auto; then
vc_ignore=
test -d .git && vc_ignore=.gitignore
test -d CVS && vc_ignore="$vc_ignore .cvsignore"
fi
# Parse options.
# Whether to use copies instead of symlinks.
copy=false
for option
do
case $option in
--help)
autogen_usage
return;;
--version)
set -e
echo "autogen.sh $scriptlibversion"
echo "$copyright"
return 0
;;
--force)
checkout_only_file=;;
--copy)
copy=true;;
*)
bootstrap_option_hook $option || die "$option: unknown option";;
esac
done
test -z "$GNULIB_SRCDIR" || test -d "$GNULIB_SRCDIR" \
|| die "Error: \$GNULIB_SRCDIR environment variable or --gnulib-srcdir option is specified, but does not denote a directory"
if test -n "$checkout_only_file" && test ! -r "$checkout_only_file"; then
die "Running this script from a non-checked-out distribution is risky."
fi
if $use_gnulib; then
if test -z "$GNULIB_SRCDIR"; then
gnulib_path=$(test -f .gitmodules && git config --file .gitmodules submodule.gnulib.path)
test -z "$gnulib_path" && gnulib_path=gnulib
GNULIB_SRCDIR=$gnulib_path
fi
fi
# Die if there is no AC_CONFIG_AUX_DIR($build_aux) line in configure.ac.
found_aux_dir=no
grep '^[ ]*AC_CONFIG_AUX_DIR(\['"$build_aux"'])' configure.ac \
>/dev/null && found_aux_dir=yes
grep '^[ ]*AC_CONFIG_AUX_DIR('"$build_aux"')' configure.ac \
>/dev/null && found_aux_dir=yes
test $found_aux_dir = yes \
|| die "configure.ac lacks 'AC_CONFIG_AUX_DIR([$build_aux])'; add it"
# If $build_aux doesn't exist, create it now, otherwise some bits
# below will malfunction. If creating it, also mark it as ignored.
if test ! -d $build_aux; then
mkdir $build_aux
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
insert_vc_ignore $dot_ig $build_aux
done
fi
check_build_prerequisites false
use_libtool=0
# We'd like to use grep -E, to see if any of LT_INIT,
# AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
# but that's not portable enough (e.g., for Solaris).
grep '^[ ]*A[CM]_PROG_LIBTOOL' configure.ac >/dev/null \
&& use_libtool=1
grep '^[ ]*LT_INIT' configure.ac >/dev/null \
&& use_libtool=1
if test $use_libtool = 1; then
find_tool LIBTOOLIZE glibtoolize libtoolize
fi
if $use_gnulib; then
gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
<$gnulib_tool || return
fi
# NOTE: we have to be careful to run both autopoint and libtoolize
# before gnulib-tool, since gnulib-tool is likely to provide newer
# versions of files "installed" by these two programs.
# Then, *after* gnulib-tool (see below), we have to be careful to
# run autoreconf in such a way that it does not run either of these
# two just-pre-run programs.
# Import from gettext.
with_gettext=yes
grep '^[ ]*AM_GNU_GETTEXT_VERSION(' configure.ac >/dev/null || \
with_gettext=no
if test $with_gettext = yes || test $use_libtool = 1; then
tempbase=.bootstrap$$
trap "rm -f $tempbase.0 $tempbase.1" HUP INT PIPE TERM
> $tempbase.0 > $tempbase.1 &&
find . ! -type d -print | sort > $tempbase.0 || return
if test $with_gettext = yes; then
# Released autopoint has the tendency to install macros that have been
# obsoleted in current gnulib, so run this before gnulib-tool.
echo "$0: $AUTOPOINT --force"
$AUTOPOINT --force || return
fi
# Autoreconf runs aclocal before libtoolize, which causes spurious
# warnings if the initial aclocal is confused by the libtoolized
# (or worse out-of-date) macro directory.
# libtoolize 1.9b added the --install option; but we support back
# to libtoolize 1.5.22, where the install action was default.
if test $use_libtool = 1; then
install=
case $($LIBTOOLIZE --help) in
*--install*) install=--install ;;
esac
echo "running: $LIBTOOLIZE $install --copy"
$LIBTOOLIZE $install --copy
fi
find . ! -type d -print | sort >$tempbase.1
old_IFS=$IFS
IFS=$nl
for file in $(comm -13 $tempbase.0 $tempbase.1); do
IFS=$old_IFS
parent=${file%/*}
version_controlled_file "$parent" "$file" || {
for dot_ig in x $vc_ignore; do
test $dot_ig = x && continue
ig=$parent/$dot_ig
insert_vc_ignore "$ig" "${file##*/}"
done
}
done
IFS=$old_IFS
rm -f $tempbase.0 $tempbase.1
trap - HUP INT PIPE TERM
fi
# Import from gnulib.
if $use_gnulib; then
gnulib_tool_options="\
--no-changelog\
--aux-dir=$build_aux\
--doc-base=$doc_base\
--lib=$gnulib_name\
--m4-base=$m4_base/\
--source-base=$source_base/\
--tests-base=$tests_base\
--local-dir=$local_gl_dir\
$gnulib_tool_option_extras\
"
if test $use_libtool = 1; then
case "$gnulib_tool_options " in
*' --libtool '*) ;;
*) gnulib_tool_options="$gnulib_tool_options --libtool" ;;
esac
fi
echo "$0: $gnulib_tool $gnulib_tool_options --import ..."
$gnulib_tool $gnulib_tool_options --import $gnulib_modules \
|| die "gnulib-tool failed"
for file in $gnulib_files; do
symlink_to_dir "$GNULIB_SRCDIR" $file \
|| die "failed to symlink $file"
done
fi
bootstrap_post_import_hook \
|| die "bootstrap_post_import_hook failed"
# Remove any dangling symlink matching "*.m4" or "*.[ch]" in some
# gnulib-populated directories. Such .m4 files would cause aclocal to fail.
# The following requires GNU find 4.2.3 or newer. Considering the usual
# portability constraints of this script, that may seem a very demanding
# requirement, but it should be ok. Ignore any failure, which is fine,
# since this is only a convenience to help developers avoid the relatively
# unusual case in which a symlinked-to .m4 file is git-removed from gnulib
# between successive runs of this script.
find "$m4_base" "$source_base" \
-depth \( -name '*.m4' -o -name '*.[ch]' \) \
-type l -xtype l -delete > /dev/null 2>&1
# Invoke autoreconf with --force --install to ensure upgrades of tools
# such as ylwrap.
AUTORECONFFLAGS="--verbose --install --force -I $m4_base $ACLOCAL_FLAGS"
# Some systems (RHEL 5) are using ancient autotools, for which the
# --no-recursive option had not been invented. Detect that lack and
# omit the option when it's not supported. FIXME in 2017: remove this
# hack when RHEL 5 autotools are updated, or when they become irrelevant.
case $($AUTORECONF --help) in
*--no-recursive*) AUTORECONFFLAGS="$AUTORECONFFLAGS --no-recursive";;
esac
# Tell autoreconf not to invoke autopoint or libtoolize; they were run above.
echo "running: AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS"
AUTOPOINT=true LIBTOOLIZE=true $AUTORECONF $AUTORECONFFLAGS \
|| die "autoreconf failed"
# Get some extra files from gnulib, overriding existing files.
for file in $gnulib_extra_files; do
case $file in
*/INSTALL) dst=INSTALL;;
build-aux/*) dst=$build_aux/${file#build-aux/};;
*) dst=$file;;
esac
symlink_to_dir "$GNULIB_SRCDIR" $file $dst \
|| die "failed to symlink $file"
done
if test $with_gettext = yes; then
# Create gettext configuration.
echo "$0: Creating po/Makevars from po/Makevars.template ..."
rm -f po/Makevars
sed '
/^EXTRA_LOCALE_CATEGORIES *=/s/=.*/= '"$EXTRA_LOCALE_CATEGORIES"'/
/^COPYRIGHT_HOLDER *=/s/=.*/= '"$COPYRIGHT_HOLDER"'/
/^MSGID_BUGS_ADDRESS *=/s|=.*|= '"$MSGID_BUGS_ADDRESS"'|
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS"' $${end_of_xgettext_options+}
}
' po/Makevars.template >po/Makevars \
|| die 'cannot generate po/Makevars'
# If the 'gettext' module is in use, grab the latest Makefile.in.in.
# If only the 'gettext-h' module is in use, assume autopoint already
# put the correct version of this file into place.
case $gnulib_modules in
*gettext-h*) ;;
*gettext*)
cp $GNULIB_SRCDIR/build-aux/po/Makefile.in.in po/Makefile.in.in \
|| die "cannot create po/Makefile.in.in"
;;
esac
if test -d runtime-po; then
# Similarly for runtime-po/Makevars, but not quite the same.
rm -f runtime-po/Makevars
sed '
/^DOMAIN *=.*/s/=.*/= '"$package"'-runtime/
/^subdir *=.*/s/=.*/= runtime-po/
/^MSGID_BUGS_ADDRESS *=/s/=.*/= bug-'"$package"'@gnu.org/
/^XGETTEXT_OPTIONS *=/{
s/$/ \\/
a\
'"$XGETTEXT_OPTIONS_RUNTIME"' $${end_of_xgettext_options+}
}
' po/Makevars.template >runtime-po/Makevars \
|| die 'cannot generate runtime-po/Makevars'
# Copy identical files from po to runtime-po.
(cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
fi
fi
bootstrap_epilogue
echo "$0: done. Now you can run './configure'."
}
# ----------------------------------------------------------------------------
# Local Variables:
# eval: (add-hook 'before-save-hook 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-start: "scriptlibversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-time-zone: "UTC0"
# time-stamp-end: "; # UTC"

View File

@@ -1,5 +1,5 @@
@echo off
:: Copyright (C) 2018-2022 Free Software Foundation, Inc.
:: Copyright (C) 2018-2023 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
@@ -13,7 +13,7 @@
:: 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/>.
:: with this program. If not, see <https://www.gnu.org/licenses/>.
setlocal
set "svurl=https://git.savannah.gnu.org/cgit"
@@ -45,30 +45,62 @@ call :Download lib intprops-internal.h
echo -- Configuring the workspace
copy /Y gl\lib\*.* lib > nul
:: In general it's tricky to use special characters as arguments to a program
:: in Windows batch files; the quoting rules are obscure and have changed over
:: time which means older systems may behave differently. However, Windows
:: echo is a dumb program that just writes out its command line without much
:: interpreting: all we have to be careful of is ^ quoting. So, use echo
:: to create script files to use with sed -f rather than using sed -e.
:: Create a sed script to convert templates
if exist convert.sed del /Q convert.sed
echo s,%%PACKAGE%%,make,g > convert.sed
echo s,@PACKAGE@,make,g > convert.sed
if ERRORLEVEL 1 goto Failed
sed -n "s/^AC_INIT(\[GNU.make\],\[\([0-9.]*\)\].*/s,%%VERSION%%,\1,g/p" configure.ac >> convert.sed
echo s,@PACKAGE_BUGREPORT@,bug-make@gnu.org,g >> convert.sed
if ERRORLEVEL 1 goto Failed
sed -z -e s/\\\n//g -e "s/[ \t][ \t]*/ /g" -e "s, [^ ]*\.h,,g" -e "s,src/,$(src),g" -e "s,lib/,$(lib),g" Makefile.am | sed -n "s/^\([A-Za-z0-9]*\)_SRCS *= *\(.*\)/s,%%\1_SOURCES%%,\2,/p" >> convert.sed
echo s,@PACKAGE_NAME@,GNU Make,g >> convert.sed
if ERRORLEVEL 1 goto Failed
echo s,@PACKAGE_TARNAME@,make,g >> convert.sed
if ERRORLEVEL 1 goto Failed
echo s,@PACKAGE_URL@,https://www.gnu.org/software/make/,g >> convert.sed
echo s/^^AC_INIT^(\[GNU.Make\],\[\^([0-9.]*\^)\].*/s,@PACKAGE_VERSION@,\1,g/p > cac.sed
sed -n -f cac.sed configure.ac >> convert.sed
if ERRORLEVEL 1 goto Failed
:: Get the list of sources from Makefile.am
echo s,\\\n,,g > mam.sed
echo s,[ \t][ \t]*, ,g >> mam.sed
echo s, [^^ ]*\.h,,g >> mam.sed
echo s,src/,$^(src^),g >> mam.sed
echo s,lib/,$^(lib^),g >> mam.sed
echo s/^^\^([A-Za-z0-9]*\^)_SRCS *= *\^(.*\^)/s,%%\1_SOURCES%%,\2,/p > mam2.sed
sed -z -f mam.sed Makefile.am | sed -n -f mam2.sed >> convert.sed
if ERRORLEVEL 1 goto Failed
echo - Creating Basic.mk
call sed -f convert.sed Basic.mk.template > Basic.mk
sed -f convert.sed Basic.mk.template > Basic.mk
if ERRORLEVEL 1 goto Failed
echo - Creating src\config.h.W32
call sed -f convert.sed src\config.h.W32.template > src\config.h.W32
echo - Creating src\mkconfig.h
sed -f convert.sed src\mkconfig.h.in > src\mkconfig.h
if ERRORLEVEL 1 goto Failed
echo - Creating src\gmk-default.h
echo static const char *const GUILE_module_defn = ^" \ > src\gmk-default.h
call sed -e "s/;.*//" -e "/^[ \t]*$/d" -e "s/\"/\\\\\"/g" -e "s/$/ \\\/" src\gmk-default.scm >> src\gmk-default.h
echo s/;.*// > gmk.sed
echo /^^[ \t]*$/d >> gmk.sed
echo s/"/\\"/g >> gmk.sed
echo s/$/ \\/ >> gmk.sed
sed -f gmk.sed src\gmk-default.scm >> src\gmk-default.h
if ERRORLEVEL 1 goto Failed
echo ^";>> src\gmk-default.h
:: These files would be created by bootstrap; they are not needed on Windows
:: but our makefile depends on them
echo >> lib\alloca.in.h
del /Q convert.sed cac.sed mam.sed mam2.sed gmk.sed
echo.
echo Done. Run build_w32.bat to build GNU make.
echo Done. Run build_w32.bat to build GNU Make.
goto :EOF
:Download

View File

@@ -1,6 +1,6 @@
# Bootstrap configuration. -*-shell-script-*-
# Copyright (C) 2018-2022 Free Software Foundation, Inc.
# Copyright (C) 2018-2023 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
@@ -19,7 +19,7 @@
checkout_only_file=README.git
# Choose a specific version of gnulib, when checking out
GNULIB_REVISION=stable-202207
GNULIB_REVISION=stable-202301
# Always copy files rather than symlink
copy=true
@@ -47,7 +47,7 @@ automake 1.16.1
"
gnulib_name=libgnu
gnulib_files=doc/make-stds.texi
gnulib_files="doc/make-stds.texi m4/sig_atomic_t.m4"
# Using the full strtoll module pulls in a lot of stuff. But, it's pretty
# simple to use just the base source file, so pull that. We'll use it in
@@ -60,5 +60,6 @@ fdl
findprog-in
getloadavg
host-cpu-c-abi
largefile
make-glob
make-macros"

View File

@@ -1,7 +1,7 @@
# Configuration for building GNU Make in the absence of any 'make' program.
# @configure_input@
# Copyright (C) 1993-2022 Free Software Foundation, Inc.
# Copyright (C) 1993-2023 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
@@ -15,7 +15,7 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
# See Makefile.in for comments describing these variables.

View File

@@ -1,7 +1,7 @@
#!/bin/sh
# Shell script to build GNU Make in the absence of any 'make' program.
# Copyright (C) 1993-2022 Free Software Foundation, Inc.
# Copyright (C) 1993-2023 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
@@ -15,11 +15,16 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
# Get configure-generated values
. ./build.cfg
die () { echo "$*" 1>&2; exit 1; }
usage () { echo "$0 [-k]"; exit $1; }
keep_going=false
: ${OUTDIR:=.}
OUTLIB="$OUTDIR/lib"
@@ -37,24 +42,19 @@ defines="-DLOCALEDIR=\"$localedir\" -DLIBDIR=\"$libdir\" -DINCLUDEDIR=\"$include
# 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")
v=$(sed -e :a -e '/\\$/N; s/\\\n//; ta' "$1" | sed -n "s=^ *$2 *\= *==p")
for w in $v; do
case $w in
(\$[\(\{]*[\)\}]) w=${w#\$[\(\{]}; w=$(get_mk_var "$file" "${w%[\)\}]}") ;;
(\$[\(\{]*[\)\}]) w=${w#\$[\(\{]}; (get_mk_var "$1" "${w%[\)\}]}") ;;
(*) echo "$w" ;;
esac
val="${val:+$val }$w"
done
printf '%s\n' "$val"
}
# Compile source files. Object files are put into $objs.
compile ()
{
success=true
objs=
for ofile in "$@"; do
# We should try to use a Makefile variable like libgnu_a_SOURCES or
@@ -65,10 +65,18 @@ compile ()
esac
echo "compiling $file..."
of="$OUTDIR/$ofile"
mkdir -p "${of%/*}"
$CC $cflags $CPPFLAGS $CFLAGS -c -o "$of" "$top_srcdir/$file"
mkdir -p "${of%/*}" || exit 1
if $CC $cflags $CPPFLAGS $CFLAGS -c -o "$of" "$top_srcdir/$file"; then
: worked
else
$keep_going || die "Compilation failed."
success=false
fi
objs="${objs:+$objs }$of"
done
$success
}
# Use config.status to convert a .in file. Output file is put into $out.
@@ -130,28 +138,39 @@ 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
while test -n "$1"; do
case $1 in
(-k) keep_going=true; shift ;;
(--) shift; break ;;
(-[h?]) usage 0 ;;
(-*) echo "Unknown option: $1"; usage 1 ;;
esac
done
test -z "$1" || die "Unknown argument: $*"
# Generate gnulib header files that would normally be created by make
set -e
for b in $(get_mk_var lib/Makefile BUILT_SOURCES); do
convert $b
done
set +e
# Build the gnulib library
cflags="$DEFS -I$OUTLIB -Ilib -I$top_srcdir/lib -I$OUTDIR/src -Isrc -I$top_srcdir/src"
compile $LIBOBJS
compile $LIBOBJS || die "Compilation failed."
echo "creating libgnu.a..."
$AR $ARFLAGS "$OUTLIB"/libgnu.a $objs
$AR $ARFLAGS "$OUTLIB"/libgnu.a $objs || die "Archive of libgnu failed."
# 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
compile $OBJS || die "Compilation failed."
# 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"
$CC $CFLAGS $LDFLAGS -L"$OUTLIB" -o "$OUTDIR/makenew$EXEEXT" $objs -lgnu $LOADLIBES || die "Link failed."
mv -f "$OUTDIR/makenew$EXEEXT" "$OUTDIR/make$EXEEXT" || exit 1
echo done.

View File

@@ -1,5 +1,5 @@
@echo off
:: Copyright (C) 1996-2022 Free Software Foundation, Inc.
:: Copyright (C) 1996-2023 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
@@ -13,7 +13,7 @@
:: 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/>.
:: with this program. If not, see <https://www.gnu.org/licenses/>.
setlocal
if not "%RECURSEME%"=="%~0" (
@@ -28,7 +28,7 @@ if "%1" == "-h" goto Usage
if "%1" == "--help" goto Usage
echo.
echo Creating GNU Make for Windows 9X/NT/2K/XP/Vista/7/8/10
echo Creating GNU Make for Windows 9X/NT/2K/XP/Vista/7/8/10/11
echo.
set MAKE=gnumake
@@ -313,21 +313,21 @@ if "%COMPILER%" == "tcc" goto TccCompile
:: MSVC Compile
if "%VERBOSE%" == "Y" echo on
call %COMPILER% /nologo /MT /W4 /EHsc %OPTS% /I %OUTDIR%/src /I src /I %OUTDIR%/lib /I lib /I src/w32/include /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR%OUTDIR% /Fp%OUTDIR%\%MAKE%.pch /Fo%OUTDIR%\%1.%O% /Fd%OUTDIR%\%MAKE%.pdb %EXTRAS% /c %1.c
call %COMPILER% /nologo /MT /W4 /EHsc %OPTS% /I %OUTDIR%/src /I src /I %OUTDIR%/lib /I lib /I src/w32/include /D _CONSOLE /D HAVE_CONFIG_H /FR%OUTDIR% /Fp%OUTDIR%\%MAKE%.pch /Fo%OUTDIR%\%1.%O% /Fd%OUTDIR%\%MAKE%.pdb %EXTRAS% /c %1.c
@echo off
goto CompileDone
:GccCompile
:: GCC Compile
if "%VERBOSE%" == "Y" echo on
call %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
call %COMPILER% -mthreads -Wall -std=gnu99 -gdwarf-2 -g3 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
@echo off
goto CompileDone
:TccCompile
:: TCC Compile
if "%VERBOSE%" == "Y" echo on
call %COMPILER% -mthreads -Wall -std=c11 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -D_cdecl= -D_MSC_VER -DWINDOWS32 -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
call %COMPILER% -mthreads -Wall -std=c11 %OPTS% -I%OUTDIR%/src -I./src -I%OUTDIR%/lib -I./lib -I./src/w32/include -D_cdecl= -D_MSC_VER -DHAVE_CONFIG_H %EXTRAS% -o %OUTDIR%/%1.%O% -c %1.c
@echo off
goto CompileDone

View File

@@ -1,5 +1,5 @@
@echo off
rem Copyright (C) 1998-2022 Free Software Foundation, Inc.
rem Copyright (C) 1998-2023 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
@@ -13,7 +13,7 @@ rem FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
rem more details.
rem
rem You should have received a copy of the GNU General Public License along
rem with this program. If not, see <http://www.gnu.org/licenses/>.
rem with this program. If not, see <https://www.gnu.org/licenses/>.
echo Building Make for MSDOS with DJGPP
@@ -49,14 +49,14 @@ gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/s
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/dir.c -o dir.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/file.c -o file.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/misc.c -o misc.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/main.c -o main.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -DINCLUDEDIR=\"c:/djgpp/include\" -O2 -g %XSRC%/src/read.c -o read.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -DLIBDIR=\"c:/djgpp/lib\" -O2 -g %XSRC%/src/remake.c -o remake.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -DLOCALEDIR=\"/dev/env/DJDIR/share/locale\" -O2 -g %XSRC%/src/main.c -o main.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -DINCLUDEDIR=\"/dev/env/DJDIR/include\" -O2 -g %XSRC%/src/read.c -o read.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -DLIBDIR=\"/dev/env/DJDIR/lib\" -O2 -g %XSRC%/src/remake.c -o remake.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/rule.c -o rule.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/implicit.c -o implicit.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/default.c -o default.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/variable.c -o variable.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/expand.c -o eyxpand.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/expand.c -o expand.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/function.c -o function.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/vpath.c -o vpath.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/hash.c -o hash.o
@@ -69,15 +69,16 @@ gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/s
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/getopt.c -o getopt.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/getopt1.c -o getopt1.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/shuffle.c -o shuffle.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/load.c -o load.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/lib/glob.c -o lib/glob.o
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/lib/fnmatch.c -o lib/fnmatch.o
@echo off
echo commands.o > respf.$$$
for %%f in (job output dir file misc main read remake rule implicit default variable) do echo %%f.o >> respf.$$$
for %%f in (job output dir file misc main read remake rule implicit default variable load) do echo %%f.o >> respf.$$$
for %%f in (expand function vpath hash strcache version ar arscan signame remote-stub getopt getopt1 shuffle) do echo %%f.o >> respf.$$$
for %%f in (lib\glob lib\fnmatch) do echo %%f.o >> respf.$$$
rem gcc -c -I./src -I%XSRC% -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/guile.c -o guile.o
rem echo guile.o >> respf.$$$
gcc -c -I./src -I%XSRC%/src -I./lib -I%XSRC%/lib -DHAVE_CONFIG_H -O2 -g %XSRC%/src/guile.c -o guile.o
echo guile.o >> respf.$$$
@echo Linking...
@echo on
gcc -o make.exe @respf.$$$
@@ -85,7 +86,7 @@ gcc -o make.exe @respf.$$$
if not exist make.exe echo Make.exe build failed...
if exist make.exe echo make.exe is now built!
if exist make.exe del respf.$$$
if exist make.exe copy /Y Basic.mk Makefile
if exist make.exe copy /Y %XSRC%\Basic.mk Makefile
goto End
:SmallEnv

View File

@@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script.
#
# Copyright (C) 1993-2022 Free Software Foundation, Inc.
# Copyright (C) 1993-2023 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
@@ -14,9 +14,9 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
AC_INIT([GNU make],[4.3.90],[bug-make@gnu.org])
AC_INIT([GNU Make],[4.4.1],[bug-make@gnu.org])
AC_PREREQ([2.69])
@@ -31,12 +31,14 @@ AC_CONFIG_LIBOBJ_DIR([lib])
# We have to enable "foreign" because ChangeLog is auto-generated
# Automake 1.15 and gnulib don't get along: gnulib has some strange error
# in the way it handles getloadavg.c which causes make distcheck to fail.
# http://lists.gnu.org/archive/html/bug-gnulib/2018-06/msg00024.html
# https://lists.gnu.org/archive/html/bug-gnulib/2018-06/msg00024.html
AM_INIT_AUTOMAKE([1.16.1 foreign -Werror -Wall])
# Checks for programs.
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AC_PROG_CXX
AC_DEFINE_UNQUOTED(MAKE_CXX, ["$CXX"], [Default C++ compiler.])
# Configure gnulib
gl_EARLY
@@ -57,11 +59,6 @@ AC_C_BIGENDIAN
AM_GNU_GETTEXT_VERSION([0.19.4])
AM_GNU_GETTEXT([external])
# This test must come as early as possible after the compiler configuration
# tests, because the choice of the file model can (in principle) affect
# whether functions and headers are available, whether they work, etc.
AC_SYS_LARGEFILE
# Checks for libraries.
AC_SEARCH_LIBS([strerror],[cposix])
AC_SEARCH_LIBS([getpwnam], [sun])
@@ -69,9 +66,9 @@ AC_SEARCH_LIBS([getpwnam], [sun])
AC_HEADER_DIRENT
AC_HEADER_STAT
AC_CHECK_HEADERS([stdlib.h locale.h unistd.h limits.h fcntl.h string.h \
AC_CHECK_HEADERS([stdlib.h string.h strings.h locale.h unistd.h limits.h \
memory.h sys/param.h sys/resource.h sys/timeb.h sys/time.h \
sys/select.h sys/file.h spawn.h])
sys/select.h sys/file.h fcntl.h spawn.h])
AM_PROG_CC_C_O
AC_C_CONST
@@ -80,8 +77,12 @@ AC_TYPE_PID_T
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_INTMAX_T
AC_TYPE_UINTMAX_T
# Check for sig_atomic_t
gt_TYPE_SIG_ATOMIC_T
# Find out whether our struct stat returns nanosecond resolution timestamps.
AC_STRUCT_ST_MTIM_NSEC
@@ -176,18 +177,40 @@ AS_IF([test "x$with_guile" != xno],
AC_MSG_RESULT([$guile_version])
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.
# Unfortunately pkg doesn't help in multi-arch environments where the
# package is installed for some architectures but not others; we need
# to try to link.
keep_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $pkg_cv_GUILE_CFLAGS"
keep_LIBS="$LIBS"
CPPFLAGS="$CPPFLAGS $GUILE_CFLAGS"
LIBS="$LIBS $GUILE_LIBS"
AC_CHECK_HEADER([libguile.h],
[AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])],
[have_guile=yes],
[have_guile=no],
[/* Avoid configuration error warnings. */])
AS_IF([test "$have_guile" = yes],
[ AC_MSG_CHECKING([whether we can link GNU Guile])
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
#include <libguile.h>
static void *
guile_init (void *arg)
{
(void) arg;
return 0;
}
]], [[
scm_with_guile (guile_init, 0);
]])],
[have_guile=yes],
[have_guile=no])
AC_MSG_RESULT([$have_guile])])
CPPFLAGS="$keep_CPPFLAGS"
LIBS="$keep_LIBS"
])
])
AS_IF([test "$have_guile" = yes],
[AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])])
AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = "yes"])
AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
@@ -299,7 +322,7 @@ AS_CASE([$host_os], [os2*|mingw*], [make_cv_job_server=yes])
AS_CASE([/$make_cv_job_server/$user_job_server/],
[*/no/*], [: no jobserver],
[AC_DEFINE(MAKE_JOBSERVER, 1,
[Define to 1 to enable job server support in GNU make.])
[Define to 1 to enable job server support in GNU Make.])
])
# If dl*() functions are supported we can enable the load operation
@@ -322,7 +345,7 @@ AS_IF([test "$make_cv_load" = yes], [
AS_CASE([/$make_cv_load/$user_load/],
[*/no/*], [make_cv_load=no],
[AC_DEFINE(MAKE_LOAD, 1,
[Define to 1 to enable 'load' support in GNU make.])
[Define to 1 to enable 'load' support in GNU Make.])
])
# If we want load support, we might need to link with export-dynamic.
@@ -330,14 +353,14 @@ AS_CASE([/$make_cv_load/$user_load/],
# For example passing -rdynamic to the SunPRO linker gives a warning
# but succeeds and creates a shared object, not an executable!
AS_IF([test "$make_cv_load" = yes], [
AC_MSG_CHECKING([If the linker accepts -Wl,--export-dynamic])
AC_MSG_CHECKING([if the linker accepts -Wl,--export-dynamic])
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])],
[AC_MSG_RESULT([yes])
AC_SUBST([AM_LDFLAGS], [-Wl,--export-dynamic])],
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([If the linker accepts -rdynamic])
AC_MSG_CHECKING([if the linker accepts -rdynamic])
LDFLAGS="$old_LDFLAGS -rdynamic"
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])],
[AC_MSG_RESULT([yes])
@@ -369,20 +392,16 @@ AS_IF([test "$make_cv_posix_spawn" = yes],
[make_cv_synchronous_posix_spawn],
[make_cv_synchronous_posix_spawn=no
AC_RUN_IFELSE([AC_LANG_SOURCE([[
#include <errno.h>
#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);
int main () {
char path[[]] = "./xxx-non-existent";
char *argv[[]] = {path, 0};
return posix_spawn (0, path, 0, 0, argv, environ) == ENOENT ? 0 : 1;
}]])],
[make_cv_synchronous_posix_spawn=no],
[make_cv_synchronous_posix_spawn=yes],
[make_cv_synchronous_posix_spawn=no],
[make_cv_synchronous_posix_spawn="no (cross-compiling)"])]))
AS_CASE([/$user_posix_spawn/$make_cv_posix_spawn/$make_cv_synchronous_posix_spawn/],
@@ -430,8 +449,8 @@ AS_CASE([$host],
[*-*-mingw32],
[AM_CONDITIONAL([WINDOWSENV], [true])
w32_target_env=yes
AC_DEFINE([WINDOWS32], [1], [Use platform specific coding])
AC_DEFINE([HAVE_DOS_PATHS], [1], [Use platform specific coding])
AC_DEFINE([WINDOWS32], [1], [Build for the WINDOWS32 API.])
AC_DEFINE([HAVE_DOS_PATHS], [1], [Support DOS-style pathnames.])
])
AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
@@ -440,6 +459,11 @@ AC_DEFINE_UNQUOTED([PATH_SEPARATOR_CHAR],['$PATH_SEPARATOR'],
AC_DEFINE_UNQUOTED([HAVE_DECL_GETLOADAVG],[$HAVE_DECL_GETLOADAVG],
[Define to 1 if you have the declaration of 'getloadavg'.])
# Remember that we ran configure to generate config.h
AC_DEFINE([MK_CONFIGURE], [1],
[Define to 1 if config.h is generated by running the configure script.])
# Include the Maintainer's Makefile section, if it's here.
MAINT_MAKEFILE=/dev/null
@@ -451,6 +475,10 @@ AC_SUBST_FILE([MAINT_MAKEFILE])
# Allow building with dmalloc
AM_WITH_DMALLOC
# Add custom header to config.h
AH_BOTTOM([/* Include customized declarations. */
#include "../src/mkcustom.h"])
# Forcibly disable SET_MAKE. If it's set it breaks things like the test
# scripts, etc.
SET_MAKE=
@@ -470,7 +498,7 @@ AS_CASE([$with_customs],
[ echo
echo "WARNING: '$with_customs/lib' does not appear to contain the"
echo " Customs library. You must build and install Customs"
echo " before compiling GNU make."
echo " before compiling GNU Make."
echo
])])
@@ -478,7 +506,7 @@ AS_IF([test "x$has_wait_nohang" = xno],
[ echo
echo "WARNING: Your system has neither waitpid() nor wait3()."
echo " Without one of these, signal handling is unreliable."
echo " You should be aware that running GNU make with -j"
echo " You should be aware that running GNU Make with -j"
echo " could result in erratic behavior."
echo
])
@@ -514,8 +542,8 @@ AM_CONDITIONAL([KNOWN_PREFIX],
-o "x$prefix" = x/usr/gnu -o "x$prefix" = x/usr])
# Specify what files are to be created.
AC_CONFIG_FILES([Makefile build.cfg lib/Makefile po/Makefile.in doc/Makefile \
tests/config-flags.pm])
AC_CONFIG_FILES([build.cfg tests/config-flags.pm \
Makefile lib/Makefile doc/Makefile po/Makefile.in])
# We don't need this: the standard automake output suffices for POSIX systems.
#mk/Posix.mk

View File

@@ -1,5 +1,5 @@
# -*-Makefile-*-, or close enough
# Copyright (C) 2000-2022 Free Software Foundation, Inc.
# Copyright (C) 2000-2023 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
@@ -13,7 +13,7 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
TEXI2HTML = texi2html
TEXI2HTML_FLAGS = -split_chapter

View File

@@ -1,6 +1,6 @@
.TH MAKE 1 "31 May 2022" "GNU" "User Commands"
.TH MAKE 1 "26 May 2023" "GNU" "User Commands"
.SH NAME
make \- GNU make utility to maintain groups of programs
make \- GNU Make utility to maintain groups of programs
.SH SYNOPSIS
.B make
[\fIOPTION\fR]... [\fITARGET\fR]...
@@ -76,9 +76,8 @@ listing, right near other important files such as
The first name checked,
.IR GNUmakefile ,
is not recommended for most makefiles. You should use this name if you have a
makefile that is specific to GNU
.BR make ,
and will not be understood by other versions of
makefile that is specific to GNU Make, and will not be understood by other
versions of
.BR make .
If
.I makefile
@@ -368,9 +367,7 @@ except that the modification time is changed only in the imagination of
.B \-\-warn\-undefined\-variables
Warn when an undefined variable is referenced.
.SH "EXIT STATUS"
GNU
.B make
exits with a status of zero if all makefiles were successfully parsed
GNU Make exits with a status of zero if all makefiles were successfully parsed
and no targets that were built failed. A status of one will be returned
if the
.B \-q
@@ -398,9 +395,9 @@ 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-2022 Free Software Foundation, Inc.
Copyright \(co 1992-1993, 1996-2023 Free Software Foundation, Inc.
This file is part of
.IR "GNU make" .
.IR "GNU Make" .
.LP
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

@@ -3,7 +3,7 @@
@setfilename make.info
@include version.texi
@set EDITION 0.75
@set EDITION 0.77
@settitle GNU @code{make}
@setchapternewpage odd
@@ -27,7 +27,7 @@ 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,
2020, 2021, 2022 Free Software Foundation, Inc.
2020, 2021, 2022, 2023 Free Software Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -1279,19 +1279,16 @@ makefile as has been traditionally done with other versions of
@findex /usr/gnu/include
@findex /usr/local/include
@findex /usr/include
If the specified name does not start with a slash, and the file is not
found in the current directory, several other directories are searched.
If the specified name does not start with a slash (or a drive letter and colon
when GNU Make is compiled with MS-DOS / MS-Windows path support), and the file
is not found in the current directory, several other directories are searched.
First, any directories you have specified with the @samp{-I} or
@samp{--include-dir} options are searched
(@pxref{Options Summary, ,Summary of Options}).
Then the following directories (if they exist)
are searched, in this order:
@file{@var{prefix}/include} (normally @file{/usr/local/include}
@samp{--include-dir} options are searched (@pxref{Options Summary, ,Summary of
Options}). Then the following directories (if they exist) are searched, in
this order: @file{@var{prefix}/include} (normally @file{/usr/local/include}
@footnote{GNU Make compiled for MS-DOS and MS-Windows behaves as if
@var{prefix} has been defined to be the root of the DJGPP tree
hierarchy.})
@file{/usr/gnu/include},
@file{/usr/local/include}, @file{/usr/include}.
@var{prefix} has been defined to be the root of the DJGPP tree hierarchy.})
@file{/usr/gnu/include}, @file{/usr/local/include}, @file{/usr/include}.
The @code{.INCLUDE_DIRS} variable will contain the current list of
directories that make will search for included files. @xref{Special
@@ -1712,7 +1709,7 @@ the results of the expanded macro (@pxref{Eval Function}).
@findex .SECONDEXPANSION
Previously we learned that GNU @code{make} works in two distinct
phases: a read-in phase and a target-update phase (@pxref{Reading
Makefiles, , How @code{make} Reads a Makefile}). GNU make also has
Makefiles, , How @code{make} Reads a Makefile}). GNU Make also has
the ability to enable a @emph{second expansion} of the prerequisites
(only) for some or all targets defined in the makefile. In order for
this second expansion to occur, the special target
@@ -2075,26 +2072,25 @@ extra features (@pxref{Recipes, ,Writing Recipes in Rules}).
@cindex normal prerequisites
@cindex prerequisites, order-only
@cindex order-only prerequisites
There are actually two different types of prerequisites understood by
GNU @code{make}: normal prerequisites such as described in the
previous section, and @dfn{order-only} prerequisites. A normal
prerequisite makes two statements: first, it imposes an order in which
recipes will be invoked: the recipes for all prerequisites of a target
will be completed before the recipe for the target is run. Second, it
imposes a dependency relationship: if any prerequisite is newer than
the target, then the target is considered out-of-date and must be
There are two different types of prerequisites understood by GNU @code{make}:
normal prerequisites, described in the previous section, and @dfn{order-only}
prerequisites. A normal prerequisite makes two statements: first, it imposes
an order in which recipes will be invoked: the recipes for all prerequisites
of a target will be completed before the recipe for the target is started.
Second, it imposes a dependency relationship: if any prerequisite is newer
than the target, then the target is considered out-of-date and must be
rebuilt.
Normally, this is exactly what you want: if a target's prerequisite is
updated, then the target should also be updated.
Occasionally, however, you have a situation where you want to impose a
specific ordering on the rules to be invoked @emph{without} forcing
the target to be updated if one of those rules is executed. In that
case, you want to define @dfn{order-only} prerequisites. Order-only
prerequisites can be specified by placing a pipe symbol (@code{|})
in the prerequisites list: any prerequisites to the left of the pipe
symbol are normal; any prerequisites to the right are order-only:
Occasionally you may want to ensure that a prerequisite is built before a
target, but @emph{without} forcing the target to be updated if the
prerequisite is updated. @dfn{Order-only} prerequisites are used to create
this type of relationship. Order-only prerequisites can be specified by
placing a pipe symbol (@code{|}) in the prerequisites list: any prerequisites
to the left of the pipe symbol are normal; any prerequisites to the right are
order-only:
@example
@var{targets} : @var{normal-prerequisites} | @var{order-only-prerequisites}
@@ -2157,7 +2153,7 @@ The wildcard characters in @code{make} are @samp{*}, @samp{?} and
specifies a list of all the files (in the working directory) whose names
end in @samp{.c}.
If an expression matches multiple files than the results will be
If an expression matches multiple files then the results will be
sorted.@footnote{Some older versions of GNU @code{make} did not sort the
results of wildcard expansion.} However multiple expressions will not be
globally sorted. For example, @file{*.c *.h} will list all the files whose
@@ -3078,7 +3074,7 @@ Suppose @file{hello.bin} is up to date in regards to the source files,
@code{.SECONDARY} make would rebuild @file{hello.o} then rebuild
@file{hello.bin} even though the source files had not changed. By declaring
@file{hello.o} as @code{.SECONDARY} @code{make} will not need to rebuild it
and won't need to rebuild @file{hello.bin} either. Of course, of one of the
and won't need to rebuild @file{hello.bin} either. Of course, if one of the
source files @emph{were} updated then all object files would be rebuilt so
that the creation of @file{hello.bin} could succeed.
@@ -3307,17 +3303,17 @@ can do it with a @dfn{static pattern rule}. @xref{Static Pattern,
@cindex grouped targets
@cindex targets, grouped
If instead of independent targets you have a recipe that generates
multiple files from a single invocation, you can express that
relationship by declaring your rule to use @emph{grouped targets}. A
grouped target rule uses the separator @code{&:} (the @samp{&} here is
used to imply ``all'').
If instead of independent targets you have a recipe that generates multiple
files from a single invocation, you can express that relationship by declaring
your rule to use @emph{grouped targets}. A grouped target rule uses the
separator @code{&:} (the @samp{&} here is used to imply ``all'').
When @code{make} builds any one of the grouped targets, it understands
that all the other targets in the group are also created as a result
of the invocation of the recipe. Furthermore, if only some of the
grouped targets are out of date or missing @code{make} will realize
that running the recipe will update all of the targets.
When @code{make} builds any one of the grouped targets, it understands that
all the other targets in the group are also updated as a result of the
invocation of the recipe. Furthermore, if only some of the grouped targets
are out of date or missing @code{make} will realize that running the recipe
will update all of the targets. Finally, if any of the grouped targets are
out of date, all the grouped targets are considered out of date.
As an example, this rule defines a grouped target:
@@ -5074,10 +5070,12 @@ set up automatically by @code{make} to contain the flag letters that
@code{make} received. Thus, if you do @w{@samp{make -ks}} then
@code{MAKEFLAGS} gets the value @samp{ks}.
As a consequence, every sub-@code{make} gets a value for @code{MAKEFLAGS}
in its environment. In response, it takes the flags from that value and
processes them as if they had been given as arguments.
@xref{Options Summary, ,Summary of Options}.
As a consequence, every sub-@code{make} gets a value for @code{MAKEFLAGS} in
its environment. In response, it takes the flags from that value and
processes them as if they had been given as arguments. @xref{Options Summary,
,Summary of Options}. This means that, unlike other environment variables,
@code{MAKEFLAGS} specified in the environment take precedence over
@code{MAKEFLAGS} specified in the makefile.
The value of @code{MAKEFLAGS} is a possibly empty group of characters
representing single-letter options that take no argument, followed by a space
@@ -5227,7 +5225,7 @@ string to avoid duplicating flags during recursion.
It's best to use @code{GNUMAKEFLAGS} only with flags which won't
materially change the behavior of your makefiles. If your makefiles
require GNU make anyway then simply use @code{MAKEFLAGS}. Flags such
require GNU Make anyway then simply use @code{MAKEFLAGS}. Flags such
as @samp{--no-print-directory} or @samp{--output-sync} may be
appropriate for @code{GNUMAKEFLAGS}.
@@ -7353,7 +7351,7 @@ marking an archive file up to date:
@example
archive.a: @dots{}
ifneq (,$(findstring t,$(word 1,-$(MAKEFLAGS))))
ifneq (,$(findstring t,$(firstword -$(MAKEFLAGS))))
+touch archive.a
+ranlib -t archive.a
else
@@ -10618,12 +10616,21 @@ More than one pattern rule may match a target. In this case
@cindex multiple targets, in pattern rule
@cindex target, multiple in pattern rule
Pattern rules may have more than one target; however, every target
must contain a @code{%} character. Pattern rules are always treated
as grouped targets (@pxref{Multiple Targets, , Multiple Targets in a
Rule}) regardless of whether they use the @code{:} or @code{&:}
Pattern rules may have more than one target; however, every target must
contain a @code{%} character. Multiple target patterns in pattern rules are
always treated as grouped targets (@pxref{Multiple Targets, , Multiple Targets
in a Rule}) regardless of whether they use the @code{:} or @code{&:}
separator.
There is one exception: if a pattern target is out of date or does
not exist and the makefile does not need to build it, then it will not cause
the other targets to be considered out of date. Note that this historical
exception will be removed in future versions of GNU @code{make} and should not
be relied on. If this situation is detected @code{make} will generate a
warning @emph{pattern recipe did not update peer target}; however, @code{make}
cannot detect all such situations. Please be sure that your recipe updates
@emph{all} the target patterns when it runs.
@node Pattern Examples, Automatic Variables, Pattern Intro, Pattern Rules
@subsection Pattern Rule Examples
@@ -11325,7 +11332,7 @@ If no pattern rule has been found then try step 5 and step 6 again with a
modified definition of ``ought to exist'': if a filename is mentioned as a
target or as an explicit prerequisite of @emph{any} target, then it ought to
exist. This check is only present for backward-compatibility with older
versions of GNU make: we don't recommend relying on it.
versions of GNU Make: we don't recommend relying on it.
@item
If no implicit rule applies, the rule for @code{.DEFAULT}, if any,
@@ -11490,7 +11497,7 @@ and make all the members of the archive file prerequisites of that rule.
For example,
@example
libfoo.a: libfoo.a(x.o) libfoo.a(y.o) @dots{}
libfoo.a: libfoo.a(x.o y.o @dots{})
ranlib libfoo.a
@end example
@@ -11511,15 +11518,38 @@ updates the @file{__.SYMDEF} member automatically.
@cindex archive, and @code{-j}
@cindex @code{-j}, and archive update
It is important to be careful when using parallel execution (the
@code{-j} switch; @pxref{Parallel, ,Parallel Execution}) and archives.
If multiple @code{ar} commands run at the same time on the same archive
file, they will not know about each other and can corrupt the file.
The built-in rules for updating archives are incompatible with parallel
builds. These rules (required by the POSIX standard) add each object file
into the archive as it's compiled. When parallel builds are enabled this
allows multiple @code{ar} commands to be updating the same archive
simultaneously, which is not supported.
Possibly a future version of @code{make} will provide a mechanism to
circumvent this problem by serializing all recipes that operate on the
same archive file. But for the time being, you must either write your
makefiles to avoid this problem in some other way, or not use @code{-j}.
If you want to use parallel builds with archives you can override the default
rules by adding these lines to your makefile:
@example
(%) : % ;
%.a : ; $(AR) $(ARFLAGS) $@@ $?
@end example
The first line changes the rule that updates an individual object in the
archive to do nothing, and the second line changes the default rule for
building an archive to update all the outdated objects (@code{$?}) in one
command.
Of course you will still need to declare the prerequisites of your library
using the archive syntax:
@example
libfoo.a: libfoo.a(x.o y.o @dots{})
@end example
If you prefer to write an explicit rule you can use:
@example
libfoo.a: libfoo.a(x.o y.o @dots{})
$(AR) $(ARFLAGS) $@@ $?
@end example
@node Archive Suffix Rules, , Archive Pitfalls, Archives
@section Suffix Rules for Archive Files
@@ -11746,7 +11776,7 @@ internalize it:
@example
@group
define GUILEIO
;; A simple Guile IO library for GNU make
;; A simple Guile IO library for GNU Make
(define MKPORT #f)
@@ -11812,10 +11842,10 @@ symbol to be stored in a @code{make} variable.
@cartouche
@quotation Warning
The @code{load} directive and extension capability is considered a
``technology preview'' in this release of GNU make. We encourage you
``technology preview'' in this release of GNU Make. We encourage you
to experiment with this feature and we appreciate any feedback on it.
However we cannot guarantee to maintain backward-compatibility in the
next release. Consider using GNU Guile instead for extending GNU make
next release. Consider using GNU Guile instead for extending GNU Make
(@pxref{Guile Function, ,The @code{guile} Function}).
@end quotation
@end cartouche
@@ -11885,7 +11915,7 @@ The initializing function will be provided the file name and line
number of the invocation of the @code{load} operation. It should
return a value of type @code{int}, which must be @code{0} on failure
and non-@code{0} on success. If the return value is @code{-1}, then
GNU make will @emph{not} attempt to rebuild the object file
GNU Make will @emph{not} attempt to rebuild the object file
(@pxref{Remaking Loaded Objects, ,How Loaded Objects Are Remade}).
For example:
@@ -12031,7 +12061,7 @@ arguments.
@item max_args
The maximum number of arguments the function will accept. Must be
between 0 and 255. GNU @code{make} will check this and fail before
invoking @code{func_ptr} if the function was invoked with too few
invoking @code{func_ptr} if the function was invoked with too many
arguments. If the value is 0, then any number of arguments is
accepted. If the value is greater than 0, then it must be greater
than or equal to @code{min_args}.
@@ -12109,12 +12139,13 @@ needed) using @code{gmk_free}.
@findex gmk_alloc
Return a pointer to a newly-allocated buffer. This function will
always return a valid pointer; if not enough memory is available
@code{make} will exit.
@code{make} will exit. @code{gmk_alloc} does not initialize allocated memory.
@item gmk_free
@findex gmk_free
Free a buffer returned to you by @code{make}. Once the
@code{gmk_free} function returns the string will no longer be valid.
If NULL is passed to @code{gmk_free}, no operation is performed.
@end table
@node Loaded Object Example, , Loaded Object API, Loading Objects
@@ -12130,7 +12161,6 @@ function in a file @file{mk_temp.c}:
@example
@group
#include <stdlib.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -12167,8 +12197,9 @@ gen_tmpfile(const char *nm, int argc, char **argv)
@}
int
mk_temp_gmk_setup ()
mk_temp_gmk_setup (const gmk_floc *floc)
@{
printf ("mk_temp plugin loaded from %s:%lu\n", floc->filenm, floc->lineno);
/* Register the function with make name "mk-temp". */
gmk_add_function ("mk-temp", gen_tmpfile, 1, 1, 1);
return 1;
@@ -12176,7 +12207,7 @@ mk_temp_gmk_setup ()
@end group
@end example
Next, we will write a makefile that can build this shared object, load
Next, we will write a @file{Makefile} that can build this shared object, load
it, and use it:
@example
@@ -12187,7 +12218,7 @@ all:
load mk_temp.so
mk_temp.so: mk_temp.c
$(CC) -shared -fPIC -o $@ $<
$(CC) -shared -fPIC -o $@@ $<
@end group
@end example
@@ -12201,7 +12232,7 @@ object will look on Windows like this (assuming the API version is 1):
@example
@group
mk_temp.dll: mk_temp.c
$(CC) -shared -o $@ $< -lgnumake-1
$(CC) -shared -o $@@ $< -lgnumake-1
@end group
@end example
@@ -12209,6 +12240,7 @@ Now when you run @code{make} you'll see something like:
@example
$ make
mk_temp plugin loaded from Makefile:4
cc -shared -fPIC -o mk_temp.so mk_temp.c
Temporary filename: tmpfile.A7JEwd
@end example

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999 Free Software
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2023 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
@@ -128,48 +128,20 @@ extern char *getenv ();
extern int errno;
# endif
/* This function doesn't exist on most systems. */
# if !defined HAVE___STRCHRNUL && !defined _LIBC
static char *
__strchrnul (s, c)
const char *s;
int c;
{
char *result = strchr (s, c);
if (result == NULL)
result = strchr (s, '\0');
return result;
}
# endif
# ifndef internal_function
/* Inside GNU libc we mark some function in a special way. In other
environments simply ignore the marking. */
# define internal_function
# endif
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
static int internal_fnmatch __P ((const char *pattern, const char *string,
int no_leading_period, int flags))
internal_function;
static int
internal_function
internal_fnmatch (pattern, string, no_leading_period, flags)
const char *pattern;
const char *string;
int no_leading_period;
int flags;
internal_fnmatch (const char *pattern, const char *string,
int no_leading_period, int flags)
{
register const char *p = pattern, *n = string;
register unsigned char c;
const char *p = pattern, *n = string;
unsigned char c;
/* Note that this evaluates C many times. */
# ifdef _LIBC
# define FOLD(c) ((flags & FNM_CASEFOLD) ? tolower (c) : (c))
# define FOLD(c) (unsigned char)((flags & FNM_CASEFOLD) ? tolower (c) : (c))
# else
# define FOLD(c) ((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
# define FOLD(c) (unsigned char)((flags & FNM_CASEFOLD) && ISUPPER (c) ? tolower (c) : (c))
# endif
while ((c = *p++) != '\0')
@@ -237,7 +209,9 @@ internal_fnmatch (pattern, string, no_leading_period, flags)
{
const char *endp;
endp = __strchrnul (n, (flags & FNM_FILE_NAME) ? '/' : '\0');
endp = strchr (n, (flags & FNM_FILE_NAME) ? '/' : '\0');
if (endp == NULL)
endp = n + strlen (n);
if (c == '[')
{
@@ -292,7 +266,7 @@ internal_fnmatch (pattern, string, no_leading_period, flags)
{
/* Nonzero if the sense of the character class is inverted. */
static int posixly_correct;
register int not;
int not;
char cold;
if (posixly_correct == 0)
@@ -478,10 +452,7 @@ internal_fnmatch (pattern, string, no_leading_period, flags)
int
fnmatch (pattern, string, flags)
const char *pattern;
const char *string;
int flags;
fnmatch (const char *pattern, const char *string, int flags)
{
return internal_fnmatch (pattern, string, flags & FNM_PERIOD, flags);
}

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999 Free Software
/* Copyright (C) 1991, 1992, 1993, 1996, 1997, 1998, 1999, 2023 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
@@ -24,27 +24,6 @@ USA. */
extern "C" {
#endif
#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
# if !defined __GLIBC__
# undef __P
# define __P(protos) protos
# endif
#else /* Not C++ or ANSI C. */
# undef __P
# define __P(protos) ()
/* We can get away without defining `const' here only because in this file
it is used only inside the prototype for `fnmatch', which is elided in
non-ANSI C where `const' is problematical. */
#endif /* C++ or ANSI C. */
#ifndef const
# if (defined __STDC__ && __STDC__) || defined __cplusplus || defined WINDOWS32
# define __const const
# else
# define __const
# endif
#endif
/* We #undef these before defining them because some losing systems
(HP-UX A.08.07 for example) define these in <unistd.h>. */
#undef FNM_PATHNAME
@@ -75,8 +54,7 @@ extern "C" {
/* Match NAME against the filename pattern PATTERN,
returning zero if it matches, FNM_NOMATCH if not. */
extern int fnmatch __P ((__const char *__pattern, __const char *__name,
int __flags));
extern int fnmatch (const char *pattern, const char *name, int flags);
#ifdef __cplusplus
}

View File

@@ -1,5 +1,5 @@
/* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999 Free
Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
2023 Free Software Foundation, Inc.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -38,9 +38,6 @@ USA. */
/* #define NDEBUG 1 */
#include <assert.h>
#include <stdio.h> /* Needed on stupid SunOS for assert. */
/* Comment out all this code if we are using the GNU C Library, and are not
actually compiling the library itself. This code is part of the GNU C
Library, but also included in many other GNU distributions. Compiling
@@ -50,7 +47,9 @@ USA. */
it is simpler to just do this in the source for each such file. */
#define GLOB_INTERFACE_VERSION 1
#if !defined _LIBC && defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
#if defined _LIBC
# define ELIDE_CODE
#elif defined __GNU_LIBRARY__ && __GNU_LIBRARY__ > 1
# include <gnu-versions.h>
# if _GNU_GLOB_INTERFACE_VERSION == GLOB_INTERFACE_VERSION
# define ELIDE_CODE
@@ -63,7 +62,7 @@ USA. */
# include <stddef.h>
#endif
#if defined HAVE_UNISTD_H || defined _LIBC
#if defined HAVE_UNISTD_H
# include <unistd.h>
# ifndef POSIX
# ifdef _POSIX_VERSION
@@ -83,11 +82,6 @@ extern int errno;
# define __set_errno(val) errno = (val)
#endif
#ifndef NULL
# define NULL 0
#endif
#if defined HAVE_DIRENT_H || defined __GNU_LIBRARY__
# include <dirent.h>
# define NAMLEN(dirent) strlen((dirent)->d_name)
@@ -108,7 +102,6 @@ extern int errno;
# endif /* HAVE_VMSDIR_H */
#endif
/* In GNU systems, <dirent.h> defines this macro for us. */
#ifdef _D_NAMLEN
# undef NAMLEN
@@ -130,49 +123,10 @@ extern int errno;
# define REAL_DIR_ENTRY(dp) (dp->d_ino != 0)
#endif /* POSIX */
#if defined STDC_HEADERS || defined __GNU_LIBRARY__
# include <stdlib.h>
# include <string.h>
# define ANSI_STRING
#else /* No standard headers. */
#include <stdlib.h>
#include <string.h>
extern char *getenv ();
# ifdef HAVE_STRING_H
# include <string.h>
# define ANSI_STRING
# else
# include <strings.h>
# endif
# ifdef HAVE_MEMORY_H
# include <memory.h>
# endif
extern char *malloc (), *realloc ();
extern void free ();
extern void qsort ();
extern void abort (), exit ();
#endif /* Standard headers. */
#ifndef ANSI_STRING
# ifndef bzero
extern void bzero ();
# endif
# ifndef bcopy
extern void bcopy ();
# endif
# define memcpy(d, s, n) bcopy ((s), (d), (n))
# define strrchr rindex
/* memset is only used for zero here, but let's be paranoid. */
# define memset(s, better_be_zero, n) \
((void) ((better_be_zero) == 0 ? (bzero((s), (n)), 0) : (abort(), 0)))
#endif /* Not ANSI_STRING. */
#if !defined HAVE_STRCOLL && !defined _LIBC
#if !defined HAVE_STRCOLL
# define strcoll strcmp
#endif
@@ -182,32 +136,6 @@ extern void bcopy ();
# define mempcpy(Dest, Src, Len) __mempcpy (Dest, Src, Len)
#endif
#if !defined __GNU_LIBRARY__ && !defined __DJGPP__
# ifdef __GNUC__
__inline
# endif
# ifndef __SASC
# ifdef WINDOWS32
static void *
my_realloc (void *p, unsigned int n)
# else
static char *
my_realloc (p, n)
char *p;
unsigned int n;
# endif
{
/* These casts are the for sake of the broken Ultrix compiler,
which warns of illegal pointer combinations otherwise. */
if (p == NULL)
return (char *) malloc (n);
return (char *) realloc (p, n);
}
# define realloc my_realloc
# endif /* __SASC */
#endif /* __GNU_LIBRARY__ || __DJGPP__ */
#if !defined __alloca && !defined __GNU_LIBRARY__
# ifdef __GNUC__
@@ -229,7 +157,6 @@ extern char *alloca ();
#endif
#ifndef __GNU_LIBRARY__
# define __stat stat
# ifdef STAT_MACROS_BROKEN
# undef S_ISDIR
# endif
@@ -238,25 +165,6 @@ extern char *alloca ();
# endif
#endif
#ifdef _LIBC
# undef strdup
# define strdup(str) __strdup (str)
# define sysconf(id) __sysconf (id)
# define closedir(dir) __closedir (dir)
# define opendir(name) __opendir (name)
# define readdir(str) __readdir (str)
# define getpwnam_r(name, bufp, buf, len, res) \
__getpwnam_r (name, bufp, buf, len, res)
# ifndef __stat
# define __stat(fname, buf) __xstat (_STAT_VER, fname, buf)
# endif
#endif
#if !(defined STDC_HEADERS || defined __GNU_LIBRARY__)
# undef size_t
# define size_t unsigned int
#endif
/* Some system header files erroneously define these.
We want our own definitions from <fnmatch.h> to take precedence. */
#ifndef __GNU_LIBRARY__
@@ -284,30 +192,26 @@ extern char *alloca ();
# define __alloca alloca
#endif
#if !defined __stat
# define __stat stat
#endif
#ifdef HAVE_GETLOGIN_R
extern int getlogin_r __P ((char *, size_t));
extern int getlogin_r (char *, size_t);
#else
extern char *getlogin __P ((void));
extern char *getlogin (void);
#endif
static
#if __GNUC__ - 0 >= 2
inline
#endif
const char *next_brace_sub __P ((const char *begin));
static int glob_in_dir __P ((const char *pattern, const char *directory,
int flags,
int (*errfunc) (const char *, int),
glob_t *pglob));
static int prefix_array __P ((const char *prefix, char **array, size_t n));
static int collated_compare __P ((const __ptr_t, const __ptr_t));
const char *next_brace_sub (const char *begin);
static int glob_in_dir (const char *pattern, const char *directory,
int flags,
int (*errfunc) (const char *, int),
glob_t *pglob);
static int prefix_array (const char *prefix, char **array, size_t n);
static int collated_compare (const void *, const void *);
#if !defined _LIBC || !defined NO_GLOB_PATTERN_P
int __glob_pattern_p __P ((const char *pattern, int quote));
#if !defined NO_GLOB_PATTERN_P
int __glob_pattern_p (const char *pattern, int quote);
#endif
/* Find the end of the sub-pattern in a brace expression. We define
@@ -317,8 +221,7 @@ static
inline
#endif
const char *
next_brace_sub (begin)
const char *begin;
next_brace_sub (const char *begin)
{
unsigned int depth = 0;
const char *cp = begin;
@@ -364,11 +267,8 @@ next_brace_sub (begin)
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
Otherwise, `glob' returns zero. */
int
glob (pattern, flags, errfunc, pglob)
const char *pattern;
int flags;
int (*errfunc) __P ((const char *, int));
glob_t *pglob;
glob (const char *pattern, int flags,
int (*errfunc) (const char *, int), glob_t *pglob)
{
const char *filename;
const char *dirname;
@@ -647,7 +547,7 @@ glob (pattern, flags, errfunc, pglob)
{
int success;
char *name;
# if defined HAVE_GETLOGIN_R || defined _LIBC
# if defined HAVE_GETLOGIN_R
size_t buflen = sysconf (_SC_LOGIN_NAME_MAX) + 1;
if (buflen == 0)
@@ -663,7 +563,7 @@ glob (pattern, flags, errfunc, pglob)
if (success)
{
struct passwd *p;
# if defined HAVE_GETPWNAM_R || defined _LIBC
# if defined HAVE_GETPWNAM_R
size_t pwbuflen = sysconf (_SC_GETPW_R_SIZE_MAX);
char *pwtmpbuf;
struct passwd pwbuf;
@@ -748,7 +648,7 @@ glob (pattern, flags, errfunc, pglob)
/* Look up specific user's home directory. */
{
struct passwd *p;
# if defined HAVE_GETPWNAM_R || defined _LIBC
# if defined HAVE_GETPWNAM_R
size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
char *pwtmpbuf;
struct passwd pwbuf;
@@ -816,7 +716,7 @@ glob (pattern, flags, errfunc, pglob)
if ((flags & GLOB_NOCHECK)
|| (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (dirname, &st)
: __stat (dirname, &st)) == 0
: stat (dirname, &st)) == 0
&& S_ISDIR (st.st_mode)))
{
pglob->gl_pathv
@@ -833,7 +733,7 @@ glob (pattern, flags, errfunc, pglob)
while (pglob->gl_pathc < pglob->gl_offs)
pglob->gl_pathv[pglob->gl_pathc++] = NULL;
#if defined HAVE_STRDUP || defined _LIBC
#if defined HAVE_STRDUP
pglob->gl_pathv[pglob->gl_pathc] = strdup (dirname);
#else
{
@@ -865,7 +765,7 @@ glob (pattern, flags, errfunc, pglob)
have to glob for the directory, and then glob for
the pattern in each directory found. */
glob_t dirs;
register size_t i;
size_t i;
status = glob (dirname,
((flags & (GLOB_ERR | GLOB_NOCHECK | GLOB_NOESCAPE))
@@ -879,7 +779,7 @@ glob (pattern, flags, errfunc, pglob)
appending the results to PGLOB. */
for (i = 0; i < dirs.gl_pathc; ++i)
{
int old_pathc;
size_t old_pathc;
#ifdef SHELL
{
@@ -962,7 +862,7 @@ glob (pattern, flags, errfunc, pglob)
/* First check whether this really is a directory. */
if (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (dir, &st) : __stat (dir, &st)) != 0
? (*pglob->gl_stat) (dir, &st) : stat (dir, &st)) != 0
|| !S_ISDIR (st.st_mode))
/* No directory, ignore this entry. */
continue;
@@ -1038,7 +938,7 @@ glob (pattern, flags, errfunc, pglob)
for (i = oldcount; i < pglob->gl_pathc; ++i)
if (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (pglob->gl_pathv[i], &st)
: __stat (pglob->gl_pathv[i], &st)) == 0
: stat (pglob->gl_pathv[i], &st)) == 0
&& S_ISDIR (st.st_mode))
{
size_t len = strlen (pglob->gl_pathv[i]) + 2;
@@ -1056,12 +956,12 @@ glob (pattern, flags, errfunc, pglob)
if (!(flags & GLOB_NOSORT))
{
/* Sort the vector. */
int non_sort = oldcount;
size_t non_sort = oldcount;
if ((flags & GLOB_DOOFFS) && pglob->gl_offs > oldcount)
non_sort = pglob->gl_offs;
qsort ((__ptr_t) &pglob->gl_pathv[non_sort],
qsort ((void *) &pglob->gl_pathv[non_sort],
pglob->gl_pathc - non_sort,
sizeof (char *), collated_compare);
}
@@ -1072,25 +972,22 @@ glob (pattern, flags, errfunc, pglob)
/* Free storage allocated in PGLOB by a previous `glob' call. */
void
globfree (pglob)
register glob_t *pglob;
globfree (glob_t *pglob)
{
if (pglob->gl_pathv != NULL)
{
register size_t i;
size_t i;
for (i = 0; i < pglob->gl_pathc; ++i)
if (pglob->gl_pathv[i] != NULL)
free ((__ptr_t) pglob->gl_pathv[i]);
free ((__ptr_t) pglob->gl_pathv);
free (pglob->gl_pathv[i]);
free (pglob->gl_pathv);
}
}
/* Do a collated comparison of A and B. */
static int
collated_compare (a, b)
const __ptr_t a;
const __ptr_t b;
collated_compare (const void *a, const void *b)
{
const char *const s1 = *(const char *const * const) a;
const char *const s2 = *(const char *const * const) b;
@@ -1110,15 +1007,12 @@ collated_compare (a, b)
A slash is inserted between DIRNAME and each elt of ARRAY,
unless DIRNAME is just "/". Each old element of ARRAY is freed. */
static int
prefix_array (dirname, array, n)
const char *dirname;
char **array;
size_t n;
prefix_array (const char *dirname, char **array, size_t n)
{
register size_t i;
size_t i;
size_t dirlen = strlen (dirname);
#if defined __MSDOS__ || defined WINDOWS32
int sep_char = '/';
char sep_char = '/';
# define DIRSEP_CHAR sep_char
#else
# define DIRSEP_CHAR '/'
@@ -1150,7 +1044,7 @@ prefix_array (dirname, array, n)
if (new == NULL)
{
while (i > 0)
free ((__ptr_t) array[--i]);
free (array[--i]);
return 1;
}
@@ -1165,7 +1059,7 @@ prefix_array (dirname, array, n)
new[dirlen] = DIRSEP_CHAR;
memcpy (&new[dirlen + 1], array[i], eltlen);
#endif
free ((__ptr_t) array[i]);
free (array[i]);
array[i] = new;
}
@@ -1174,15 +1068,13 @@ prefix_array (dirname, array, n)
/* We must not compile this function twice. */
#if !defined _LIBC || !defined NO_GLOB_PATTERN_P
#if !defined NO_GLOB_PATTERN_P
/* Return nonzero if PATTERN contains any metacharacters.
Metacharacters can be quoted with backslashes if QUOTE is nonzero. */
int
__glob_pattern_p (pattern, quote)
const char *pattern;
int quote;
__glob_pattern_p (const char *pattern, int quote)
{
register const char *p;
const char *p;
int open = 0;
for (p = pattern; *p != '\0'; ++p)
@@ -1209,9 +1101,6 @@ __glob_pattern_p (pattern, quote)
return 0;
}
# ifdef _LIBC
weak_alias (__glob_pattern_p, glob_pattern_p)
# endif
#endif
@@ -1220,14 +1109,10 @@ weak_alias (__glob_pattern_p, glob_pattern_p)
The GLOB_NOSORT bit in FLAGS is ignored. No sorting is ever done.
The GLOB_APPEND flag is assumed to be set (always appends). */
static int
glob_in_dir (pattern, directory, flags, errfunc, pglob)
const char *pattern;
const char *directory;
int flags;
int (*errfunc) __P ((const char *, int));
glob_t *pglob;
glob_in_dir (const char *pattern, const char *directory, int flags,
int (*errfunc) (const char *, int), glob_t *pglob)
{
__ptr_t stream = NULL;
void *stream = NULL;
struct globlink
{
@@ -1271,7 +1156,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
# endif
if (((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_stat) (fullname, &st)
: __stat (fullname, &st)) == 0)
: stat (fullname, &st)) == 0)
/* We found this file to be existing. Now tell the rest
of the function to copy this name into the result. */
flags |= GLOB_NOCHECK;
@@ -1298,7 +1183,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
{
stream = ((flags & GLOB_ALTDIRFUNC)
? (*pglob->gl_opendir) (directory)
: (__ptr_t) opendir (directory));
: (void *) opendir (directory));
if (stream == NULL)
{
if (errno != ENOTDIR
@@ -1350,10 +1235,9 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
if (new->name == NULL)
goto memory_error;
#ifdef HAVE_MEMPCPY
*((char *) mempcpy ((__ptr_t) new->name, name, len))
= '\0';
*((char *) mempcpy (new->name, name, len)) = '\0';
#else
memcpy ((__ptr_t) new->name, name, len);
memcpy (new->name, name, len);
new->name[len] = '\0';
#endif
new->next = names;
@@ -1428,7 +1312,7 @@ glob_in_dir (pattern, directory, flags, errfunc, pglob)
while (names != NULL)
{
if (names->name != NULL)
free ((__ptr_t) names->name);
free (names->name);
names = names->next;
}
return GLOB_NOSPACE;

View File

@@ -1,5 +1,5 @@
/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 1998 Free Software Foundation,
Inc.
/* Copyright (C) 1991, 1992, 1995, 1996, 1997, 1998, 2023 Free Software
Foundation, Inc.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
@@ -19,60 +19,12 @@ USA. */
#ifndef _GLOB_H
#define _GLOB_H 1
#include <stddef.h>
#ifdef __cplusplus
extern "C" {
#endif
#undef __ptr_t
#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
# if !defined __GLIBC__
# undef __P
# undef __PMT
# define __P(protos) protos
# define __PMT(protos) protos
# if !defined __GNUC__ || __GNUC__ < 2
# undef __const
# define __const const
# endif
# endif
# define __ptr_t void *
#else /* Not C++ or ANSI C. */
# undef __P
# undef __PMT
# define __P(protos) ()
# define __PMT(protos) ()
# undef __const
# define __const
# define __ptr_t char *
#endif /* C++ or ANSI C. */
/* We need `size_t' for the following definitions. */
#ifndef __size_t
# if defined __FreeBSD__
# define __size_t size_t
# else
# if defined __GNUC__ && __GNUC__ >= 2
typedef __SIZE_TYPE__ __size_t;
# else
/* This is a guess. */
/*hb
* Conflicts with DECCs already defined type __size_t.
* Defining an own type with a name beginning with '__' is no good.
* Anyway if DECC is used and __SIZE_T is defined then __size_t is
* already defined (and I hope it's exactly the one we need here).
*/
# if !(defined __DECC && defined __SIZE_T)
typedef unsigned long int __size_t;
# endif
# endif
# endif
#else
/* The GNU CC stddef.h version defines __size_t as empty. We need a real
definition. */
# undef __size_t
# define __size_t size_t
#endif
/* Bits set in the FLAGS argument to `glob'. */
#define GLOB_ERR (1 << 0)/* Return on read errors. */
#define GLOB_MARK (1 << 1)/* Append a slash to each name. */
@@ -120,21 +72,21 @@ struct stat;
#endif
typedef struct
{
__size_t gl_pathc; /* Count of paths matched by the pattern. */
size_t gl_pathc; /* Count of paths matched by the pattern. */
char **gl_pathv; /* List of matched pathnames. */
__size_t gl_offs; /* Slots to reserve in `gl_pathv'. */
size_t gl_offs; /* Slots to reserve in `gl_pathv'. */
int gl_flags; /* Set to FLAGS, maybe | GLOB_MAGCHAR. */
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
are used instead of the normal file access functions. */
void (*gl_closedir) __PMT ((void *));
struct dirent *(*gl_readdir) __PMT ((void *));
__ptr_t (*gl_opendir) __PMT ((__const char *));
int (*gl_lstat) __PMT ((__const char *, struct stat *));
void (*gl_closedir) (void *);
struct dirent *(*gl_readdir) (void *);
void * (*gl_opendir) (const char *);
int (*gl_lstat) (const char *, struct stat *);
#if defined(VMS) && defined(__DECC) && !defined(_POSIX_C_SOURCE)
int (*gl_stat) __PMT ((__const char *, struct stat *, ...));
int (*gl_stat) (const char *, struct stat *, ...);
#else
int (*gl_stat) __PMT ((__const char *, struct stat *));
int (*gl_stat) (const char *, struct stat *);
#endif
} glob_t;
@@ -142,18 +94,18 @@ typedef struct
struct stat64;
typedef struct
{
__size_t gl_pathc;
size_t gl_pathc;
char **gl_pathv;
__size_t gl_offs;
size_t gl_offs;
int gl_flags;
/* If the GLOB_ALTDIRFUNC flag is set, the following functions
are used instead of the normal file access functions. */
void (*gl_closedir) __PMT ((void *));
struct dirent64 *(*gl_readdir) __PMT ((void *));
__ptr_t (*gl_opendir) __PMT ((__const char *));
int (*gl_lstat) __PMT ((__const char *, struct stat64 *));
int (*gl_stat) __PMT ((__const char *, struct stat64 *));
void (*gl_closedir) (void *);
struct dirent64 *(*gl_readdir) (void *);
void * (*gl_opendir) (const char *);
int (*gl_lstat) (const char *, struct stat64 *);
int (*gl_stat) (const char *, struct stat64 *);
} glob64_t;
#endif
@@ -162,11 +114,11 @@ typedef struct
# define globfree globfree64
#else
# ifdef _LARGEFILE64_SOURCE
extern int glob64 __P ((__const char *__pattern, int __flags,
int (*__errfunc) (__const char *, int),
glob64_t *__pglob));
extern int glob64 (const char *pattern, int flags,
int (*errfunc) (const char *, int),
glob64_t *pglob);
extern void globfree64 __P ((glob64_t *__pglob));
extern void globfree64 (glob64_t *pglob);
# endif
#endif
@@ -179,18 +131,18 @@ extern void globfree64 __P ((glob64_t *__pglob));
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
Otherwise, `glob' returns zero. */
#if _FILE_OFFSET_BITS != 64 || __GNUC__ < 2
extern int glob __P ((__const char *__pattern, int __flags,
int (*__errfunc) (__const char *, int),
glob_t *__pglob));
extern int glob (const char *pattern, int flags,
int (*errfunc) (const char *, int),
glob_t *pglob);
/* Free storage allocated in PGLOB by a previous `glob' call. */
extern void globfree __P ((glob_t *__pglob));
extern void globfree (glob_t *pglob);
#else
extern int glob __P ((__const char *__pattern, int __flags,
int (*__errfunc) (__const char *, int),
glob_t *__pglob)) __asm__ ("glob64");
extern int glob (const char *pattern, int flags,
int (*errfunc) (const char *, int),
glob_t *pglob) __asm__ ("glob64");
extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64");
extern void globfree (glob_t *pglob) __asm__ ("globfree64");
#endif
@@ -200,7 +152,7 @@ extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64");
This function is not part of the interface specified by POSIX.2
but several programs want to use it. */
extern int glob_pattern_p __P ((__const char *__pattern, int __quote));
extern int glob_pattern_p (const char *pattern, int quote);
#endif
#ifdef __cplusplus

View File

@@ -1,7 +1,7 @@
dnl acinclude.m4 -- Extra macros needed for GNU make.
dnl acinclude.m4 -- Extra macros needed for GNU Make.
dnl
dnl Automake will incorporate this into its generated aclocal.m4.
dnl Copyright (C) 1998-2022 Free Software Foundation, Inc.
dnl Copyright (C) 1998-2023 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
@@ -15,7 +15,7 @@ dnl FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for.
dnl more details.
dnl
dnl You should have received a copy of the GNU General Public License along
dnl with this program. If not, see <http://www.gnu.org/licenses/>.
dnl with this program. If not, see <https://www.gnu.org/licenses/>.
dnl ---------------------------------------------------------------------------
dnl Got this from the lynx 2.8 distribution.
@@ -43,8 +43,8 @@ AC_MSG_RESULT(working...)
cf_cv_netlibs=""
cf_test_netlibs=yes
AC_CHECK_FUNCS(gethostname,,[
CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
CF_RECHECK_FUNC(gethostname,nsl,cf_cv_netlibs,[
CF_RECHECK_FUNC(gethostname,socket,cf_cv_netlibs)])])
#
# FIXME: sequent needs this library (i.e., -lsocket -linet -lnsl), but
# I don't know the entrypoints - 97/7/22 TD
@@ -52,12 +52,12 @@ AC_CHECK_LIB(inet,main,cf_cv_netlibs="-linet $cf_cv_netlibs")
#
if test "$ac_cv_func_lsocket" != no ; then
AC_CHECK_FUNCS(socket,,[
CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
CF_RECHECK_FUNC(socket,socket,cf_cv_netlibs,[
CF_RECHECK_FUNC(socket,bsd,cf_cv_netlibs)])])
fi
#
AC_CHECK_FUNCS(gethostbyname,,[
CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
CF_RECHECK_FUNC(gethostbyname,nsl,cf_cv_netlibs)])
])
LIBS="$LIBS $cf_cv_netlibs"
test $cf_test_netlibs = no && echo "$cf_cv_netlibs" >&AC_FD_MSG
@@ -77,14 +77,14 @@ dnl used (autoconf does not distinguish between a null token and one that is
dnl set to 'no').
AC_DEFUN([CF_RECHECK_FUNC],[
AC_CHECK_LIB($2,$1,[
CF_UPPER(cf_tr_func,$1)
AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func,1,[Define if you have function $1])
ac_cv_func_$1=yes
$3="-l$2 [$]$3"],[
ac_cv_func_$1=unknown
unset ac_cv_func_$1 2>/dev/null
$4],
[[$]$3])
CF_UPPER(cf_tr_func,$1)
AC_DEFINE_UNQUOTED(HAVE_$cf_tr_func,1,[Define if you have function $1])
ac_cv_func_$1=yes
$3="-l$2 [$]$3"],[
ac_cv_func_$1=unknown
unset ac_cv_func_$1 2>/dev/null
$4],
[[$]$3])
])dnl
dnl ---------------------------------------------------------------------------
dnl Make an uppercase version of a variable
@@ -118,7 +118,7 @@ AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
CPPFLAGS="$ac_save_CPPFLAGS -DST_MTIM_NSEC=$ac_val"
AC_TRY_COMPILE([#include <sys/types.h>
#include <sys/stat.h>
], [struct stat s; s.ST_MTIM_NSEC;],
], [struct stat s; s.ST_MTIM_NSEC;],
[ac_cv_struct_st_mtim_nsec=$ac_val; break])
done
CPPFLAGS="$ac_save_CPPFLAGS"
@@ -126,7 +126,7 @@ AC_DEFUN([AC_STRUCT_ST_MTIM_NSEC],
if test $ac_cv_struct_st_mtim_nsec != no; then
AC_DEFINE_UNQUOTED([ST_MTIM_NSEC], [$ac_cv_struct_st_mtim_nsec],
[Define if struct stat contains a nanoseconds field])
[Define if struct stat contains a nanoseconds field])
fi
]
)

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-2022 Free Software Foundation, Inc.
# Copyright (C) 1993-2023 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
@@ -15,7 +15,7 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
AC_DEFUN([pds_AC_DOS_PATHS], [
AC_CACHE_CHECK([whether system uses MSDOS-style paths], [ac_cv_dos_paths], [

View File

@@ -1,7 +1,7 @@
# Check for getloadavg.
# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2022 Free Software
# Foundation, Inc.
# Copyright (C) 1992-1996, 1999-2000, 2002-2003, 2006, 2008-2023 Free
# Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -160,7 +160,7 @@ AC_CHECK_HEADERS([nlist.h],
])dnl
])# gl_PREREQ_GETLOADAVG
# ---- GNU make
# ---- GNU Make
# These macros are imported from stdlib which we don't want to include
# Only the getloadavg content is imported.

View File

@@ -1,5 +1,5 @@
Description:
GNU make version of fnmatch()/glob() functions. This is a holdover from
GNU Make version of fnmatch()/glob() functions. This is a holdover from
a very old version of the globbing library.
Files:
@@ -10,21 +10,59 @@ lib/glob.in.h
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])])
# local version. Also avoid versions of glibc which have symlink bug
# https://sourceware.org/bugzilla/show_bug.cgi?id=866 (test from gnulib)
AC_CACHE_CHECK([if system libc has working GNU glob], [make_cv_sys_gnu_glob],[
if ln -s conf-doesntexist conf$$-globtest 2>/dev/null; then
make_check_symlink=yes
else
make_check_symlink=no
fi
if test $cross_compiling = yes || test $make_check_symlink = no; then
# When cross-compiling or without symlink support, check the version
AC_COMPILE_IFELSE(
[AC_LANG_PROGRAM(
[[#include <features.h>
#include <gnu-versions.h>
#include <glob.h>
#include <fnmatch.h>
]],
[[
#if _GNU_GLOB_INTERFACE_VERSION == 0
GNU glob not available in libc
#elif __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 27)
GNU glob in libc has dangling symlink bug
#endif
]])],
[make_cv_sys_gnu_glob=yes],
[make_cv_sys_gnu_glob=no])
else
# Check for GNU glob, and that it handles dangling symlinks properly
AC_RUN_IFELSE(
[AC_LANG_PROGRAM(
[[#include <features.h>
#include <gnu-versions.h>
#include <glob.h>
#include <fnmatch.h>
]],
[[
#if _GNU_GLOB_INTERFACE_VERSION == 0
return 1;
#else
glob_t found;
if (glob ("conf*-globtest", 0, 0, &found) == GLOB_NOMATCH)
return 1;
globfree (&found);
#endif
]])],
[make_cv_sys_gnu_glob=yes],
[make_cv_sys_gnu_glob=no],
[dnl We don't get here.
:
])
fi
test $make_check_symlink = no || rm -f conf$$-globtest
])
# Tell automake about this, so it can build the right .c files.
AM_CONDITIONAL([USE_SYSTEM_GLOB], [test "$make_cv_sys_gnu_glob" = yes])

View File

@@ -1,5 +1,5 @@
Description:
Install m4 macros for GNU make.
Install m4 macros for GNU Make.
Files:
m4/acinclude.m4

View File

@@ -1,5 +1,5 @@
# Maintainer-only makefile segment. This contains things that are relevant
# only if you have the full copy of the GNU make sources from the Git
# only if you have the full copy of the GNU Make sources from the Git
# tree, not a dist copy.
# --------------------- #
@@ -20,7 +20,7 @@ SRCROOTDIR ?= $(HOME)/src
# Where to put the CVS checkout of the GNU web repository
GNUWEBDIR ?= $(SRCROOTDIR)/gnu-www
# Where to put the CVS checkout of the GNU make web repository
# Where to put the CVS checkout of the GNU Make web repository
MAKEWEBDIR ?= $(SRCROOTDIR)/make/make-web
# Enable Perl warnings for the test suite
@@ -43,31 +43,28 @@ GUILE_CFLAGS := $(patsubst -I%,-isystem %,$(GUILE_CFLAGS))
MAKE_MAINTAINER_MODE := -DMAKE_MAINTAINER_MODE
AM_CPPFLAGS += $(MAKE_MAINTAINER_MODE)
TEMPLATES = README README.DOS README.W32 README.OS2 \
src/config.ami src/configh.dos src/config.h.W32 src/config.h-vms
all: $(TEMPLATES)
# Create preprocessor output files--GCC specific!
%.i : %.c
$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) -E -dD -o $@ $<
# General rule for turning a .template into a regular file.
#
$(TEMPLATES) : % : %.template Makefile
rm -f $@
sed -e 's@%VERSION%@$(VERSION)@g' \
-e 's@%PACKAGE%@$(PACKAGE)@g' \
$< > $@
chmod a-w $@
# Create the mkconfig.h file for non-POSIX config headers
all: src/mkconfig.h
src/mkconfig.h: src/mkconfig.h.in config.status
./config.status --header=$@
# Build the README
all: README
README : README.in config.status
./config.status --file=$@
# Construct Makefiles by adding on dependencies, etc.
#
cvt = $(patsubst $1/%,$$($1)%,$(filter %.c,$2))
Basic.mk: Basic.mk.template .dep_segment Makefile
rm -f $@
sed -e 's@%VERSION%@$(VERSION)@g' \
-e 's@%make_SOURCES%@$(call cvt,src,$(make_SRCS))@g' \
sed -e 's@%make_SOURCES%@$(call cvt,src,$(make_SRCS))@g' \
-e 's@%w32_SOURCES%@$(call cvt,src,$(w32_SRCS))@g' \
-e 's@%vms_SOURCES%@$(call cvt,src,$(vms_SRCS))@g' \
-e 's@%amiga_SOURCES%@$(call cvt,src,$(amiga_SRCS))@g' \
@@ -76,6 +73,7 @@ Basic.mk: Basic.mk.template .dep_segment Makefile
-e 's@%glob_SOURCES%@$(call cvt,lib,$(glob_SRCS))@g' \
$< > $@
echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
echo >>$@; echo '$$(OBJECTS): $$(SRCDIR)/src/mkconfig.h' >>$@; \
sed -e 's@^\([^ ]*\)\.o:@$$(OUTDIR)\1.$$(OBJEXT):@' \
-e 's@\([^ ]*\.[ch]\)@$$(SRCDIR)/\1@g' \
-e 's@$$(SRCDIR)/src/config.h@$$(OUTDIR)src/config.h@g' \
@@ -176,7 +174,7 @@ po_sync = translationproject.org::tp/latest/$(PACKAGE)/
.PHONY: do-po-update po-update
do-po-update:
tmppo="/tmp/po-$(PACKAGE)-$(VERSION).$$$$" \
tmppo="/tmp/po-$(PACKAGE)-$(PACKAGE_VERSION).$$$$" \
&& rm -rf "$$tmppo" \
&& mkdir "$$tmppo" \
&& $(RSYNC) $(po_sync) "$$tmppo" \
@@ -238,18 +236,28 @@ export TAR_OPTIONS := --mode=u+w,go-w --owner=0 --group=0 --numeric-owner --sort
# When I released 4.3 somehow the INSTALL file was missing.
# When I tried to build it again, it was there. I have no idea what happened
# but add a new check to be sure it doesn't happen again.
mk_dist_files = AUTHORS ChangeLog COPYING INSTALL README
mk_dist_files = AUTHORS ChangeLog COPYING INSTALL README src/mkconfig.h
dist: mk-distcheck
dist: mk-dist mk-distcheck
.PHONY: mk-distcheck
mk-distcheck: distdir
@echo "Checking for extra installed files..."
for fn in $(mk_dist_files); do \
@for fn in $(mk_dist_files); do \
test -f '$(distdir)'/"$$fn" \
|| { echo "Missing dist file: $$fn"; exit 1; }; \
done; true
# Make sure that the files in lib/ have been updated from the files in gl/lib/
GL_LIB_FILES := $(wildcard gl/lib/*)
mk-dist:
@echo "Checking gl/lib files..."
@for fn in $(GL_LIB_FILES); do \
cmp $$fn $${fn##gl/} \
|| { echo "Run ./bootstrap --gen ?"; exit 1; }; \
done; true
# ---------------------------------- #
# Alternative configuration checks. #
@@ -261,10 +269,12 @@ CFGCHECK_BUILDFLAGS =
# as well, and that will fail.
CFGCHECK_MAKEFLAGS = # CFLAGS='$(AM_CFLAGS)'
# This test can no longer be run: now that we rely on gnulib we must use C99+
# We don't support C90 anymore, strictly, but this test still works (with lots
# of warnings) and it helps us avoid egregious incompatibilities.
checkcfg.strict-c90: CFGCHECK_CONFIGFLAGS = CFLAGS='-std=c90 -pedantic'
checkcfg.strict-c90: CFGCHECK_MAKEFLAGS =
checkcfg.job-pipe: CFGCHECK_CONFIGFLAGS = CPPFLAGS=-DJOBSERVER_USE_FIFO=0
checkcfg.no-jobserver:CFGCHECK_CONFIGFLAGS = --disable-job-server
checkcfg.no-load: CFGCHECK_CONFIGFLAGS = --disable-load
checkcfg.no-guile: CFGCHECK_CONFIGFLAGS = --without-guile
@@ -279,6 +289,8 @@ checkcfg.no-sync: CFGCHECK_CONFIGFLAGS = CPPFLAGS=-DNO_OUTPUT_SYNC
checkcfg.no-archives: CFGCHECK_CONFIGFLAGS = CPPFLAGS=-DNO_ARCHIVES
CONFIG_CHECKS := \
checkcfg.strict-c90 \
checkcfg.job-pipe \
checkcfg.no-jobserver \
checkcfg.no-load \
checkcfg.no-guile \
@@ -290,14 +302,15 @@ CONFIG_CHECKS := \
.PHONY: check-alt-config
check-alt-config: $(CONFIG_CHECKS)
@echo --- $@ SUCCESS
# Trick GNU make so it doesn't run the submake as a recursive make.
# Trick GNU Make so it doesn't run the submake as a recursive make.
NR_MAKE = $(MAKE)
# Check builds both with build.sh and with make
build.sh_SCRIPT = exec >>'checkcfg.$*.log' 2>&1; set -x; \
cd $(distdir)/_build \
&& OUTDIR=_bld ../build.sh $(CFGCHECK_BUILD_FLAGS) \
&& OUTDIR=_bld ../build.sh -k $(CFGCHECK_BUILD_FLAGS) \
&& _bld/make GMK_OUTDIR=../_bld $(AM_MAKEFLAGS) check-local \
&& _bld/make GMK_OUTDIR=../_bld $(AM_MAKEFLAGS) clean
@@ -342,7 +355,7 @@ checkcfg.basicmk: checkcfg.% : distdir
&& cd $(distdir) \
&& ./configure \
$(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS) \
&& $(NR_MAKE) $(AM_MAKEFLAGS) -f Basic.mk $(CFGCHECK_MAKEFLAGS)' \
&& $(NR_MAKE) $(AM_MAKEFLAGS) -f Basic.mk '$(CFGCHECK_MAKEFLAGS)' \
&& ./make $(AM_MAKEFLAGS) -f Basic.mk check \
&& ./make $(AM_MAKEFLAGS) -f Basic.mk clean
@@ -363,10 +376,10 @@ local-check: po-check changelog-check
# copyright-check writable-files
changelog-check:
if head $(top_srcdir)/ChangeLog | grep 'Version $(VERSION)' >/dev/null; then \
if head $(top_srcdir)/ChangeLog | grep 'Version $(PACKAGE_VERSION)' >/dev/null; then \
:; \
else \
echo "$(VERSION) not in ChangeLog" 1>&2; \
echo "$(PACKAGE_VERSION) not in ChangeLog" 1>&2; \
exit 1; \
fi
@@ -393,7 +406,7 @@ makeweb-repo = $(USER)@cvs.sv.gnu.org:/web/make
gnuweb-repo = :pserver:anonymous@cvs.sv.gnu.org:/web/www
gnuweb-dir = www/server/standards
# Get the GNU make web page boilerplate etc.
# Get the GNU Make web page boilerplate etc.
update-makeweb:
test -d '$(MAKEWEBDIR)' || mkdir -p '$(MAKEWEBDIR)'
test -d '$(MAKEWEBDIR)'/CVS \
@@ -413,7 +426,7 @@ gendocs: update-gnuweb update-makeweb
cd doc \
&& rm -rf doc/manual \
&& $(GNULIBDIR)/build-aux/gendocs.sh --email '$(BUGLIST)' \
make 'GNU Make Manual'
make '$(PACKAGE_NAME) Manual'
find '$(MAKEWEBDIR)'/manual \( -name CVS -prune \) -o \( -name '[!.]*' -type f -exec rm -f '{}' \; \)
cp -r doc/manual '$(MAKEWEBDIR)'
@echo 'Status of $(MAKEWEBDIR) repo:' && cd '$(MAKEWEBDIR)' \
@@ -421,7 +434,7 @@ gendocs: update-gnuweb update-makeweb
@echo '- cvs add <new files>' \
&& echo '- cvs remove <deleted files>' \
&& echo '- cvs commit' \
&& echo '- cvs tag make-$(subst .,-,$(VERSION))'
&& echo '- cvs tag make-$(subst .,-,$(PACKAGE_VERSION))'
## --------------------------------------------- ##
@@ -459,15 +472,15 @@ $(COV_BUILD_FILE)-submitted: $(COV_BUILD_FILE)
@test -n "$(COVERITY_TOKEN)" || { echo 'COVERITY_TOKEN not set'; exit 1; }
@test -n "$(COVERITY_EMAIL)" || { echo 'COVERITY_EMAIL not set'; exit 1; }
rm -f '$@'
case '$(VERSION)' in \
case '$(PACKAGE_VERSION)' in \
(*.*.9*) type="daily build"; ext=".$$(date +%Y%m%d)" ;; \
(*) type="release"; ext= ;; \
esac; \
curl --form token='$(COVERITY_TOKEN)' \
--form email='$(COVERITY_EMAIL)' \
--form file='@$<' \
--form version="$(VERSION)$$ext" \
--form description="GNU make $$type" \
--form version="$(PACKAGE_VERSION)$$ext" \
--form description="$(PACKAGE_NAME) $$type" \
'https://scan.coverity.com/builds?project=gmake'
cp '$<' '$@'
@@ -478,11 +491,11 @@ $(COV_BUILD_FILE)-submitted: $(COV_BUILD_FILE)
.PHONY: tag-release
tag-release:
case '$(VERSION)' in \
case '$(PACKAGE_VERSION)' in \
(*.*.9*) message=" candidate" ;; \
(*) message= ;; \
esac; \
$(GIT) tag -m "GNU Make release$$message $(VERSION)" -u '$(GPG_KEYID)' '$(VERSION)'
$(GIT) tag -m "$(PACKAGE_NAME) release$$message $(PACKAGE_VERSION)" -u '$(GPG_KEYID)' '$(PACKAGE_VERSION)'
## ------------------------- ##
@@ -493,48 +506,18 @@ tag-release:
# Sign it with my key. If you don't have my key/passphrase then sorry,
# you're SOL! :)
GPG = gpg
GPGFLAGS = -u $(GPG_KEYID)
DIST_ARCHIVES_SIG = $(addsuffix .sig,$(DIST_ARCHIVES))
DIST_ARCHIVES_DIRECTIVE = $(addsuffix .directive.asc,$(DIST_ARCHIVES))
# A simple rule to test signing, etc.
.PHONY: distsign
distsign: $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
%.sig : %
@echo "Signing file '$<':"
$(GPG) $(GPGFLAGS) -o "$@" -b "$<"
%.directive.asc: %
@echo "Creating signed directive file '$@':"
@( \
echo 'version: 1.2'; \
echo 'directory: make'; \
echo 'filename: $*'; \
echo 'comment: Official upload of GNU make version $(VERSION)'; \
) > "$*.directive"
$(GPG) $(GPGFLAGS) -o "$@" --clearsign "$*.directive"
@rm -f "$*.directive"
# Upload the artifacts
FTPPUT = ncftpput
gnu-upload-host = ftp-upload.gnu.org
gnu-upload-dir = /incoming
GNUPLOAD := $(GNULIBDIR)/build-aux/gnupload
UPLOADS = upload-alpha upload-ftp
.PHONY: $(UPLOADS)
$(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
$(FTPPUT) "$(gnu-upload-host)" "$(gnu-upload-dir)/$(@:upload-%=%)" $^
$(UPLOADS): upload-%: $(DIST_ARCHIVES)
$(GNUPLOAD) --user "$(GPG_KEYID)" --to "$*.gnu.org:make" -- $^
# Rebuild Makefile.in if this file is modifed.
# Rebuild Makefile.in if this file is modified.
Makefile.in: maintMakefile
# Copyright (C) 1997-2022 Free Software Foundation, Inc.
# Copyright (C) 1997-2023 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
@@ -548,4 +531,4 @@ Makefile.in: maintMakefile
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1,4 +1,4 @@
"""GDB pretty-printer macros for GNU make."""
"""GDB pretty-printer macros for GNU Make."""
import gdb # pylint: disable=import-error
import gdb.printing # pylint: disable=import-error

View File

@@ -154,7 +154,7 @@ $ exit
$ endsubroutine : compileit
$!
$!-----------------------------------------------------------------------------
$!Copyright (C) 1996-2022 Free Software Foundation, Inc.
$!Copyright (C) 1996-2023 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
@@ -168,4 +168,4 @@ $!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/>.
$!this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1,8 +1,8 @@
# GNU -*-Makefile-*- to build GNU make on Amiga
# GNU -*-Makefile-*- to build GNU Make on Amiga
#
# Amiga overrides for use with Basic.mk.
#
# Copyright (C) 2017-2022 Free Software Foundation, Inc.
# Copyright (C) 2017-2023 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 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
CC = sc
LD = $(CC) Link

View File

@@ -1,8 +1,8 @@
# GNU -*-Makefile-*- to build GNU make on POSIX systems
# GNU -*-Makefile-*- to build GNU Make on POSIX systems
#
# POSIX overrides for use with Basic.mk.
#
# Copyright (C) 2017-2022 Free Software Foundation, Inc.
# Copyright (C) 2017-2023 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,11 +16,11 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
# Very little is needed here since the default Basic.mk assumes POSIX
prog_SOURCES += $(posix_SOURCES)
prog_SOURCES += $(src)/posixos.c
extra_CPPFLAGS += @GUILE_CFLAGS@
extra_LDFLAGS += @AM_LDFLAGS@

View File

@@ -1,8 +1,8 @@
# GNU -*-Makefile-*- to build GNU make on VMS
# GNU -*-Makefile-*- to build GNU Make on VMS
#
# VMS overrides for use with Basic.mk.
#
# Copyright (C) 2017-2022 Free Software Foundation, Inc.
# Copyright (C) 2017-2023 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 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
src = [.src]
lib = [.lib]
@@ -93,5 +93,5 @@ define CLEANSPACE
endef
$(OUTDIR)$(src)config.h: $(SRCDIR)$(src)config.h.W32
$(OUTDIR)$(src)config.h: $(SRCDIR)$(src)config.h-vms
$(call CP.cmd,$<,$@)

View File

@@ -1,8 +1,8 @@
# GNU -*-Makefile-*- to build GNU make on Windows
# GNU -*-Makefile-*- to build GNU Make on Windows
#
# Windows overrides for use with Basic.mk.
#
# Copyright (C) 2017-2022 Free Software Foundation, Inc.
# Copyright (C) 2017-2023 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 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
# TARGET_TYPE can be either "release" or "debug"
TARGET_TYPE = release

View File

@@ -1,8 +1,8 @@
# GNU -*-Makefile-*- to build GNU make on MS-DOS with DJGPP
# GNU -*-Makefile-*- to build GNU Make on MS-DOS with DJGPP
#
# MS-DOS overrides for use with Basic.mk.
#
# Copyright (C) 2017-2022 Free Software Foundation, Inc.
# Copyright (C) 2017-2023 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 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
OBJEXT = o
EXEEXT = .exe

View File

@@ -1,5 +1,5 @@
# List of source files containing translatable strings.
# Copyright (C) 2000-2022 Free Software Foundation, Inc.
# Copyright (C) 2000-2023 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
@@ -13,7 +13,7 @@
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.
src/ar.c
src/arscan.c

View File

@@ -4,28 +4,27 @@ $!
$! This is used for building off the master instead of a release tarball.
$!
$!
$!
$! First try ODS-5, Pathworks V6 or UNZIP name.
$!
$ config_template = f$search("sys$disk:[]config*h-vms.template")
$ config_template = f$search("sys$disk:[.src]mkconfig*h.in")
$ if config_template .eqs. ""
$ then
$!
$! Try NFS, VMStar, or Pathworks V5 ODS-2 encoded name.
$!
$ config_template = f$search("sys$disk:[]config.h-vms*template")
$ config_template = f$search("sys$disk:[.src]mkconfig.h*in")
$ if config_template .eqs. ""
$ then
$ write sys$output "Could not find config.h-vms*template!"
$ write sys$output "Could not find mkconfig.h.in!"
$ exit 44
$ endif
$ endif
$ config_template_file = f$parse(config_template,,,"name")
$ config_template_type = f$parse(config_template,,,"type")
$ config_template = "sys$disk:[]" + config_template_file + config_template_type
$ config_template = "sys$disk:[.src]" + config_template_file + config_template_type
$!
$!
$! Pull the package and version from configure.ac
$! Pull the version from configure.ac
$!
$ open/read ac_file sys$disk:[]configure.ac
$ac_read_loop:
@@ -39,21 +38,26 @@ $ version = f$element (0,"]",version)
$ac_read_loop_end:
$ close ac_file
$!
$ if (package .eqs. "") .or. (version .eqs. "")
$ if (version .eqs. "")
$ then
$ write sys$output "Unable to determine package and/or version!"
$ write sys$output "Unable to determine version!"
$ exit 44
$ endif
$!
$!
$ outfile = "sys$disk:[]config.h-vms"
$ outfile = "sys$disk:[.src]mkconfig.h"
$!
$! Note the pipe command is close to the length of 255, which is the
$! maximum token length prior to VMS V8.2:
$! %DCL-W-TKNOVF, command element is too long - shorten
$ pipe (write sys$output "sub/%PACKAGE%/''package'/WHOLE/NOTYPE" ;-
write sys$output "sub/%VERSION%/''version'/WHOLE/NOTYPE" ;-
$! PDS: Blown out; someone else will have to figure this out
$ pipe (write sys$output "sub,@PACKAGE@,make,WHOLE/NOTYPE" ;-
write sys$output "sub,@PACKAGE_BUGREPORT@,bug-make@gnu.org,WHOLE/NOTYPE" ;-
write sys$output "sub,@PACKAGE_NAME@,GNU Make,WHOLE/NOTYPE" ;-
write sys$output "sub,@PACKAGE_TARNAME@,make,WHOLE/NOTYPE" ;-
write sys$output "sub,@PACKAGE_URL@,https://www.gnu.org/software/make/,WHOLE/NOTYPE" ;-
write sys$output "sub,@PACKAGE_VERSION@,''version',WHOLE/NOTYPE" ;-
write sys$output "exit") |-
edit/edt 'config_template'/out='outfile'/command=sys$pipe >nla0:
$!
$ write sys$output package, ", version: ", version, " prepared for VMS"
$ write sys$output "GNU Make version: ", version, " prepared for VMS"

View File

@@ -1,9 +1,9 @@
#!/bin/sh
#
# Copyright (C) 2014-2022 Free Software Foundation, Inc.
# Copyright (C) 2014-2023 Free Software Foundation, Inc.
# This file is part of GNU Make.
#
# Update GNU make copyrights using gnulib update-copyright
# Update GNU Make copyrights using gnulib update-copyright
EXCLUDE='^\(\.[a-z].*\|.*/\.[a-z].*\|.*COPYING\|src/hash\.[ch]\|ChangeLog.*\|.*/ChangeLog.*\|INSTALL\|doc/make\.texi\|bootstrap\)$'
@@ -31,7 +31,7 @@ run () {
if $force; then
: just do it
elif test ! -f src/makeint.h; then
die "Run in the root of the GNU make workspace"
die "Run in the root of the GNU Make workspace"
elif test -f configure; then
die "Run in a clean workspace (git clean -fdX)"
fi
@@ -60,4 +60,4 @@ run "$@"
# 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/>.
# this program. If not, see <https://www.gnu.org/licenses/>.

View File

@@ -1,5 +1,5 @@
/* Running commands on Amiga
Copyright (C) 1995-2022 Free Software Foundation, Inc.
Copyright (C) 1995-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "variable.h"

View File

@@ -1,5 +1,5 @@
/* Definitions for amiga specific things
Copyright (C) 1995-2022 Free Software Foundation, Inc.
Copyright (C) 1995-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
int MyExecute (char ** argv);
char * wildcard_expansion (char * wc, char * o);

View File

@@ -1,5 +1,5 @@
/* Interface to 'ar' archives for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 Free Software Foundation, Inc.
This file is part of GNU Make.
@@ -13,7 +13,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
@@ -22,6 +22,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "filedef.h"
#include "dep.h"
#include <fnmatch.h>
#include <intprops.h>
/* Return nonzero if NAME is an archive-member reference, zero if not. An
archive-member reference is a name like 'lib(member)' where member is a
@@ -35,7 +36,7 @@ ar_name (const char *name)
const char *p = strchr (name, '(');
const char *end;
if (p == 0 || p == name)
if (p == NULL || p == name)
return 0;
end = p + strlen (p) - 1;
@@ -60,6 +61,9 @@ ar_parse_name (const char *name, char **arname_p, char **memname_p)
*arname_p = xstrdup (name);
p = strchr (*arname_p, '(');
/* This is never called unless ar_name() is true so p cannot be NULL. */
if (!p)
OS (fatal, NILF, "Internal: ar_parse_name: bad name '%s'", *arname_p);
*(p++) = '\0';
p[strlen (p) - 1] = '\0';
*memname_p = p;
@@ -69,10 +73,10 @@ ar_parse_name (const char *name, char **arname_p, char **memname_p)
/* This function is called by 'ar_scan' to find which member to look at. */
/* ARGSUSED */
static long int
static intmax_t
ar_member_date_1 (int desc UNUSED, const char *mem, int truncated,
long int hdrpos UNUSED, long int datapos UNUSED,
long int size UNUSED, long int date,
long int size UNUSED, intmax_t date,
int uid UNUSED, int gid UNUSED, unsigned int mode UNUSED,
const void *name)
{
@@ -86,7 +90,7 @@ ar_member_date (const char *name)
{
char *arname;
char *memname;
long int val;
intmax_t val;
ar_parse_name (name, &arname, &memname);
@@ -111,7 +115,7 @@ ar_member_date (const char *name)
free (arname);
return (val <= 0 ? (time_t) -1 : (time_t) val);
return 0 < val && val <= TYPE_MAXIMUM (time_t) ? val : -1;
}
/* Set the archive-member NAME's modtime to now. */
@@ -194,10 +198,10 @@ struct ar_glob_state
/* This function is called by 'ar_scan' to match one archive
element against the pattern in STATE. */
static long int
static intmax_t
ar_glob_match (int desc UNUSED, const char *mem, int truncated UNUSED,
long int hdrpos UNUSED, long int datapos UNUSED,
long int size UNUSED, long int date UNUSED, int uid UNUSED,
long int size UNUSED, intmax_t date UNUSED, int uid UNUSED,
int gid UNUSED, unsigned int mode UNUSED, const void *arg)
{
struct ar_glob_state *state = (struct ar_glob_state *)arg;
@@ -218,7 +222,7 @@ ar_glob_match (int desc UNUSED, const char *mem, int truncated UNUSED,
++state->n;
}
return 0L;
return 0;
}
/* Return nonzero if PATTERN contains any metacharacters.

View File

@@ -1,5 +1,5 @@
/* Library function for scanning an archive file.
Copyright (C) 1987-2022 Free Software Foundation, Inc.
Copyright (C) 1987-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
@@ -75,9 +75,9 @@ static void *VMS_lib_idx;
static const void *VMS_saved_arg;
static long int (*VMS_function) ();
static intmax_t (*VMS_function) ();
static long int VMS_function_ret;
static intmax_t VMS_function_ret;
/* This is a callback procedure for lib$get_index */
@@ -203,7 +203,7 @@ VMS_get_member_info(struct dsc$descriptor_s *module, unsigned long *rfa)
Returns -2 if archive has invalid format.
Returns 0 if have scanned successfully. */
long int
intmax_t
ar_scan (const char *archive, ar_member_func_t function, const void *varg)
{
char *vms_archive;
@@ -331,7 +331,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *varg)
#endif
#ifndef WINDOWS32
# if !defined (__ANDROID__) && !defined (__BEOS__)
# if !defined (__ANDROID__) && !defined (__BEOS__) && !defined(MK_OS_ZOS)
# include <ar.h>
# else
/* These platforms don't have <ar.h> but have archives in the same format
@@ -376,16 +376,18 @@ struct ar_hdr
# define AR_HDR_SIZE (sizeof (struct ar_hdr))
#endif
#include "intprops.h"
#include "output.h"
static unsigned long int
parse_int (const char *ptr, const size_t len, const int base,
static uintmax_t
parse_int (const char *ptr, const size_t len, const int base, uintmax_t max,
const char *type, const char *archive, const char *name)
{
const char *const ep = ptr + len;
const char max = '0' + base - 1;
long int val = 0;
const int maxchar = '0' + base - 1;
uintmax_t val = 0;
/* In all the versions I know of the spaces come last, but be safe. */
while (ptr < ep && *ptr == ' ')
@@ -393,10 +395,16 @@ parse_int (const char *ptr, const size_t len, const int base,
while (ptr < ep && *ptr != ' ')
{
if (*ptr < '0' || *ptr > max)
OSSS (fatal, NILF, _("Invalid %s for archive %s member %s"),
type, archive, name);
val = (val * base) + (*ptr - '0');
uintmax_t nv;
if (*ptr < '0' || *ptr > maxchar)
OSSS (fatal, NILF,
_("Invalid %s for archive %s member %s"), type, archive, name);
nv = (val * base) + (*ptr - '0');
if (nv < val || nv > max)
OSSS (fatal, NILF,
_("Invalid %s for archive %s member %s"), type, archive, name);
val = nv;
++ptr;
}
@@ -430,7 +438,7 @@ parse_int (const char *ptr, const size_t len, const int base,
Returns -2 if archive has invalid format.
Returns 0 if have scanned successfully. */
long int
intmax_t
ar_scan (const char *archive, ar_member_func_t function, const void *arg)
{
#ifdef AIAMAG
@@ -550,7 +558,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
# define ARNAME_MAX 255
char name[ARNAME_MAX + 1];
int name_len;
long int dateval;
intmax_t dateval;
int uidval, gidval;
long int data_offset;
#else
@@ -562,7 +570,9 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
#endif
long int eltsize;
unsigned int eltmode;
long int fnval;
intmax_t eltdate;
int eltuid, eltgid;
intmax_t fnval;
off_t o;
memset(&member_header, '\0', sizeof (member_header));
@@ -593,7 +603,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
name[name_len] = '\0';
sscanf (member_header_big.ar_date, "%12ld", &dateval);
sscanf (member_header_big.ar_date, "%12" SCNdMAX, &dateval);
sscanf (member_header_big.ar_uid, "%12d", &uidval);
sscanf (member_header_big.ar_gid, "%12d", &gidval);
sscanf (member_header_big.ar_mode, "%12o", &eltmode);
@@ -621,7 +631,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
name[name_len] = '\0';
sscanf (member_header.ar_date, "%12ld", &dateval);
sscanf (member_header.ar_date, "%12" SCNdMAX, &dateval);
sscanf (member_header.ar_uid, "%12d", &uidval);
sscanf (member_header.ar_gid, "%12d", &gidval);
sscanf (member_header.ar_mode, "%12o", &eltmode);
@@ -716,12 +726,12 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
const char* err;
unsigned int name_len = make_toui (name + 3, &err);
if (err || name_len == 0 || name_len > PATH_MAX)
if (err || name_len == 0 || name_len >= MIN (PATH_MAX, INT_MAX))
goto invalid;
name = alloca (name_len + 1);
nread = readbuf (desc, name, name_len);
if (nread != name_len)
if (nread < 0 || (unsigned int) nread != name_len)
goto invalid;
name[name_len] = '\0';
@@ -732,8 +742,16 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
}
#ifndef M_XENIX
eltmode = parse_int (TOCHAR (member_header.ar_mode), sizeof (member_header.ar_mode), 8, "mode", archive, name);
eltsize = parse_int (TOCHAR (member_header.ar_size), sizeof (member_header.ar_size), 10, "size", archive, name);
#define PARSE_INT(_m, _t, _b, _n) \
(_t) parse_int (TOCHAR (member_header._m), sizeof (member_header._m), \
_b, TYPE_MAXIMUM (_t), _n, archive, name)
eltmode = PARSE_INT (ar_mode, unsigned int, 8, "mode");
eltsize = PARSE_INT (ar_size, long, 10, "size");
eltdate = PARSE_INT (ar_date, intmax_t, 10, "date");
eltuid = PARSE_INT (ar_uid, int, 10, "uid");
eltgid = PARSE_INT (ar_gid, int, 10, "gid");
#undef PARSE_INT
#else /* Xenix. */
eltmode = (unsigned short int) member_header.ar_mode;
eltsize = member_header.ar_size;
@@ -743,9 +761,7 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
(*function) (desc, name, ! long_name, member_offset,
member_offset + AR_HDR_SIZE, eltsize,
#ifndef M_XENIX
parse_int (TOCHAR (member_header.ar_date), sizeof (member_header.ar_date), 10, "date", archive, name),
parse_int (TOCHAR (member_header.ar_uid), sizeof (member_header.ar_uid), 10, "uid", archive, name),
parse_int (TOCHAR (member_header.ar_gid), sizeof (member_header.ar_gid), 10, "gid", archive, name),
eltdate, eltuid, eltgid,
#else /* Xenix. */
member_header.ar_date,
member_header.ar_uid,
@@ -885,10 +901,10 @@ ar_name_equal (const char *name, const char *mem, int truncated)
#ifndef VMS
/* ARGSUSED */
static long int
static intmax_t
ar_member_pos (int desc UNUSED, const char *mem, int truncated,
long int hdrpos, long int datapos UNUSED, long int size UNUSED,
long int date UNUSED, int uid UNUSED, int gid UNUSED,
intmax_t date UNUSED, int uid UNUSED, int gid UNUSED,
unsigned int mode UNUSED, const void *name)
{
if (!ar_name_equal (name, mem, truncated))
@@ -906,12 +922,13 @@ ar_member_pos (int desc UNUSED, const char *mem, int truncated,
int
ar_member_touch (const char *arname, const char *memname)
{
long int pos = ar_scan (arname, ar_member_pos, memname);
intmax_t pos = ar_scan (arname, ar_member_pos, memname);
off_t opos;
int fd;
struct ar_hdr ar_hdr;
off_t o;
int r;
unsigned int ui;
int datelen;
struct stat statbuf;
if (pos < 0)
@@ -919,11 +936,13 @@ ar_member_touch (const char *arname, const char *memname)
if (!pos)
return 1;
opos = (off_t) pos;
EINTRLOOP (fd, open (arname, O_RDWR, 0666));
if (fd < 0)
return -3;
/* Read in this member's header */
EINTRLOOP (o, lseek (fd, pos, 0));
EINTRLOOP (o, lseek (fd, opos, 0));
if (o < 0)
goto lose;
r = readbuf (fd, &ar_hdr, AR_HDR_SIZE);
@@ -935,15 +954,16 @@ ar_member_touch (const char *arname, const char *memname)
goto lose;
/* Advance member's time to that time */
#if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || defined(WINDOWS32)
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 ((char *) ar_hdr.ar_date)] = ' ';
datelen = snprintf (TOCHAR (ar_hdr.ar_date), sizeof ar_hdr.ar_date,
"%" PRIdMAX, (intmax_t) statbuf.st_mtime);
if (! (0 <= datelen && datelen < (int) sizeof ar_hdr.ar_date))
goto lose;
memset (ar_hdr.ar_date + datelen, ' ', sizeof ar_hdr.ar_date - datelen);
#else
ar_hdr.ar_date = statbuf.st_mtime;
#endif
/* Write back this member's header */
EINTRLOOP (o, lseek (fd, pos, 0));
EINTRLOOP (o, lseek (fd, opos, 0));
if (o < 0)
goto lose;
r = writebuf (fd, &ar_hdr, AR_HDR_SIZE);
@@ -962,18 +982,21 @@ ar_member_touch (const char *arname, const char *memname)
#ifdef TEST
long int
intmax_t
describe_member (int desc, const char *name, int truncated,
long int hdrpos, long int datapos, long int size,
long int date, int uid, int gid, unsigned int mode,
intmax_t date, int uid, int gid, unsigned int mode,
const void *arg)
{
extern char *ctime ();
time_t d = date;
char const *ds;
printf (_("Member '%s'%s: %ld bytes at %ld (%ld).\n"),
name, truncated ? _(" (name might be truncated)") : "",
size, hdrpos, datapos);
printf (_(" Date %s"), ctime (&date));
ds = ctime (&d);
printf (_(" Date %s"), ds ? ds : "?");
printf (_(" uid = %d, gid = %d, mode = 0%o.\n"), uid, gid, mode);
return 0;

View File

@@ -1,5 +1,5 @@
/* Command processing for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,10 +12,11 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "filedef.h"
#include "os.h"
#include "dep.h"
#include "variable.h"
#include "job.h"
@@ -321,14 +322,12 @@ set_file_variables (struct file *file, const char *stem)
void
chop_commands (struct commands *cmds)
{
unsigned int nlines;
unsigned short idx;
unsigned short nlines;
unsigned short i;
char **lines;
/* If we don't have any commands,
or we already parsed them, never mind. */
if (!cmds || cmds->command_lines != 0)
/* If we don't have any commands, or we already parsed them, never mind. */
if (!cmds || cmds->command_lines != NULL)
return;
/* Chop CMDS->commands up into lines in CMDS->command_lines. */
@@ -347,25 +346,27 @@ chop_commands (struct commands *cmds)
}
else
{
const char *p;
const char *p = cmds->commands;
size_t max = 5;
nlines = 5;
lines = xmalloc (nlines * sizeof (char *));
idx = 0;
p = cmds->commands;
nlines = 0;
lines = xmalloc (max * sizeof (char *));
while (*p != '\0')
{
const char *end = p;
find_end:;
end = strchr (end, '\n');
if (end == 0)
if (end == NULL)
end = p + strlen (p);
else if (end > p && end[-1] == '\\')
{
int backslash = 1;
const char *b;
for (b = end - 2; b >= p && *b == '\\'; --b)
backslash = !backslash;
if (end > p + 1)
{
const char *b;
for (b = end - 2; b >= p && *b == '\\'; --b)
backslash = !backslash;
}
if (backslash)
{
++end;
@@ -373,40 +374,36 @@ chop_commands (struct commands *cmds)
}
}
if (idx == nlines)
if (nlines == USHRT_MAX)
ON (fatal, &cmds->fileinfo,
_("Recipe has too many lines (limit %hu)"), nlines);
if (nlines == max)
{
nlines += 2;
lines = xrealloc (lines, nlines * sizeof (char *));
max += 2;
lines = xrealloc (lines, max * sizeof (char *));
}
lines[idx++] = xstrndup (p, (size_t) (end - p));
lines[nlines++] = xstrndup (p, (size_t) (end - p));
p = end;
if (*p != '\0')
++p;
}
if (idx != nlines)
{
nlines = idx;
lines = xrealloc (lines, nlines * sizeof (char *));
}
}
/* Finally, set the corresponding CMDS->lines_flags elements and the
CMDS->any_recurse flag. */
if (nlines > USHRT_MAX)
ON (fatal, &cmds->fileinfo, _("Recipe has too many lines (%ud)"), nlines);
cmds->ncommand_lines = (unsigned short)nlines;
cmds->ncommand_lines = nlines;
cmds->command_lines = lines;
cmds->any_recurse = 0;
cmds->lines_flags = xmalloc (nlines);
for (idx = 0; idx < nlines; ++idx)
for (i = 0; i < nlines; ++i)
{
unsigned char flags = 0;
const char *p = lines[idx];
const char *p = lines[i];
while (ISBLANK (*p) || *p == '-' || *p == '@' || *p == '+')
switch (*(p++))
@@ -423,12 +420,12 @@ chop_commands (struct commands *cmds)
}
/* If no explicit '+' was given, look for MAKE variable references. */
if (!(flags & COMMANDS_RECURSE)
if (! ANY_SET (flags, COMMANDS_RECURSE)
&& (strstr (p, "$(MAKE)") != 0 || strstr (p, "${MAKE}") != 0))
flags |= COMMANDS_RECURSE;
cmds->lines_flags[idx] = flags;
cmds->any_recurse |= flags & COMMANDS_RECURSE ? 1 : 0;
cmds->lines_flags[i] = flags;
cmds->any_recurse |= ANY_SET (flags, COMMANDS_RECURSE) ? 1 : 0;
}
}
@@ -479,7 +476,7 @@ execute_file_commands (struct file *file)
/* This is set while we are inside fatal_error_signal,
so things can avoid nonreentrant operations. */
int handling_fatal_signal = 0;
volatile sig_atomic_t handling_fatal_signal = 0;
/* Handle fatal signals. */
@@ -532,6 +529,10 @@ fatal_error_signal (int sig)
It is blocked now while we run this handler. */
signal (sig, SIG_DFL);
temp_stdin_unlink ();
osync_clear ();
jobserver_clear ();
/* A termination signal won't be sent to the entire
process group, but it means we want to kill the children. */

View File

@@ -1,5 +1,5 @@
/* Definition of data structures describing shell commands for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
/* Structure that gives the commands to make a file
and information about where these commands came from. */

View File

@@ -1,5 +1,5 @@
/* config.h -- hand-massaged for Amiga -*-C-*-
Copyright (C) 1995-2022 Free Software Foundation, Inc.
Copyright (C) 1995-2023 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
@@ -12,7 +12,11 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "mkconfig.h"
#define MK_AMIGAOS 1
/* Define if on AIX 3.
System headers sometimes define this.
@@ -37,6 +41,10 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define for DGUX with <sys/dg_sys_info.h>. */
/* #undef DGUX */
/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
not define. */
#define intmax_t long
/* Define to 'unsigned long' or 'unsigned long long'
if <inttypes.h> doesn't define. */
#define uintmax_t unsigned long
@@ -162,19 +170,13 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
instead of <sys/cpustats.h>. */
/* #undef UMAX4_3 */
/* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%"
/* Version of this package (needed by automake) */
#define VERSION "%VERSION%"
/* Define to the name of the SCCS 'get' command. */
#define SCCS_GET "get"
/* Define this if the SCCS 'get' command understands the '-G<file>' option. */
/* #undef SCCS_GET_MINUS_G */
/* Define this to enable job server support in GNU make. */
/* Define this to enable job server support in GNU Make. */
/* #undef MAKE_JOBSERVER */
/* Define to be the nanoseconds member of struct stat's st_mtim,
@@ -327,3 +329,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define to `int' if <sys/types.h> does not define. */
#define ssize_t int
/* Include customized declarations. */
#include "../src/mkcustom.h"

View File

@@ -1,6 +1,6 @@
/* config.h-vms. Generated by hand by Klaus Kämpf <kkaempf@rmi.de> -*-C-*-
Copyright (C) 1996-2022 Free Software Foundation, Inc.
Copyright (C) 1996-2023 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
@@ -13,10 +13,11 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
/* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.ac by autoheader. */
#include "mkconfig.h"
#define MK_VMS 1
/* Pull in types.h here to get __CRTL_VER defined for old versions of the
compiler which don't define it. */
@@ -65,6 +66,10 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define for DGUX with <sys/dg_sys_info.h>. */
/* #undef DGUX */
/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
not define. */
#define intmax_t unsigned long
/* Define to 'unsigned long' or 'unsigned long long'
if <inttypes.h> doesn't define. */
#define uintmax_t unsigned long
@@ -202,31 +207,13 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
instead of <sys/cpustats.h>. */
/* #undef UMAX4_3 */
/* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "bug-make@gnu.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "GNU make"
/* Define to the home page for this package. */
#define PACKAGE_URL "https://www.gnu.org/software/make/"
/* Define to the version of this package. */
#define PACKAGE_VERSION "%VERSION%"
/* Version of this package (needed by automake) */
#define VERSION "%VERSION%"
/* Define to the name of the SCCS 'get' command. */
/* #undef SCCS_GET */
/* Define this if the SCCS 'get' command understands the '-G<file>' option. */
/* #undef SCCS_GET_MINUS_G */
/* Define this to enable job server support in GNU make. */
/* Define this to enable job server support in GNU Make. */
/* #undef MAKE_JOBSERVER */
/* Define to be the nanoseconds member of struct stat's st_mtim,
@@ -441,3 +428,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Build host information. */
#define MAKE_HOST "VMS"
/* Include customized declarations. */
#include "../src/mkcustom.h"

View File

@@ -1,6 +1,6 @@
/* config.h.W32 -- hand-massaged config.h file for Windows builds -*-C-*-
Copyright (C) 1996-2022 Free Software Foundation, Inc.
Copyright (C) 1996-2023 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
@@ -13,7 +13,14 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "mkconfig.h"
#define MK_W32 1
/* Build for the WINDOWS32 API. */
#define WINDOWS32 1
/* Suppress some Visual C++ warnings.
Maybe after the code cleanup for ISO C we can remove some/all of these. */
@@ -104,7 +111,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
# define HAVE_DIRECT_H 1
#endif
/* Use platform specific coding */
/* Support DOS-style pathnames. */
#define HAVE_DOS_PATHS 1
/* Define to 1 if you have the 'dup' function. */
@@ -177,6 +184,9 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the <locale.h> header file. */
/* #undef HAVE_LOCALE_H */
/* Define to 1 if the system has the type 'long long int'. */
#define HAVE_LONG_LONG_INT 1
/* Define to 1 if you have the 'lstat' function. */
/* #undef HAVE_LSTAT */
@@ -334,6 +344,14 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1
#ifdef __TINYC__
# ifndef strtoll
# define strtoll _strtoi64
# endif
# ifndef strtoull
# define strtoull _strtoui64
# endif
#endif
/* Define to 1 if `d_type' is a member of `struct dirent'. */
/* SV 57152: MinGW64 version of dirent doesn't support d_type. */
@@ -390,6 +408,9 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#define HAVE_TTYNAME 1
char *ttyname (int);
/* Define to 1 if the system has the type `intmax_t'. */
#define HAVE_INTMAX_T 1
/* Define to 1 if the system has the type `uintmax_t'. */
#define HAVE_UINTMAX_T 1
@@ -436,10 +457,10 @@ char *ttyname (int);
/* Build host information. */
#define MAKE_HOST "Windows32"
/* Define to 1 to enable job server support in GNU make. */
/* Define to 1 to enable job server support in GNU Make. */
#define MAKE_JOBSERVER 1
/* Define to 1 to enable 'load' support in GNU make. */
/* Define to 1 to enable 'load' support in GNU Make. */
#define MAKE_LOAD 1
/* Define to 1 to enable symbolic link timestamp checking. */
@@ -455,21 +476,6 @@ char *ttyname (int);
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
/* Name of this package (needed by automake) */
#define PACKAGE "%PACKAGE%"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "bug-make@gnu.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "GNU make"
/* Define to the home page for this package. */
#define PACKAGE_URL "https://www.gnu.org/software/make/"
/* Define to the version of this package. */
#define PACKAGE_VERSION "%VERSION%"
/* Define to the character that separates directories in PATH. */
#define PATH_SEPARATOR_CHAR ';'
@@ -506,9 +512,6 @@ char *ttyname (int);
<sys/cpustats.h>. */
/* #undef UMAX4_3 */
/* Version number of package */
#define VERSION "%VERSION%"
/* Define if using the dmalloc debugging malloc package */
/* #undef WITH_DMALLOC */
@@ -547,6 +550,14 @@ char *ttyname (int);
# define __USE_MINGW_ANSI_STDIO 1
#endif
/* Number of bits in a timestamp, on hosts where this is settable. */
/* #undef _TIME_BITS */
/* For 64-bit time_t on 32-bit mingw. */
#ifdef __MINGW32__
# define __MINGW_USE_VC2005_COMPAT 1
#endif
#include <sys/types.h>
/* Define to 'int' if <sys/types.h> doesn't define. */
@@ -568,9 +579,10 @@ char *ttyname (int);
/* Define to 'int' if <sys/types.h> doesn't define. */
#define uid_t int
/* Define uintmax_t if not defined in <stdint.h> or <inttypes.h>. */
/* Define {u,}intmax_t if not defined in <stdint.h> or <inttypes.h>. */
#if !HAVE_STDINT_H && !HAVE_INTTYPES_H
#define uintmax_t unsigned long
#define intmax_t long long
#define uintmax_t unsigned long long
#endif
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
@@ -617,3 +629,6 @@ char *ttyname (int);
#ifdef HAVE_CYGWIN_SHELL
#undef BATCH_MODE_ONLY_SHELL
#endif
/* Include customized declarations. */
#include "../src/mkcustom.h"

View File

@@ -1,6 +1,6 @@
/* configh.dos -- hand-massaged config.h file for MS-DOS builds -*-C-*-
Copyright (C) 1994-2022 Free Software Foundation, Inc.
Copyright (C) 1994-2023 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
@@ -13,7 +13,11 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "mkconfig.h"
#define MK_DJGPP 1
/* Include this header to make __DJGPP_MINOR__ available because DJGPP ports
of GCC 4.3.0 and later no longer do it automatically. */
@@ -49,6 +53,9 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'getgroups' function. */
#define HAVE_GETGROUPS 1
/* Define to 1 if the system has the type 'long long int'. */
#define HAVE_LONG_LONG_INT 1
/* Define to 1 if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
@@ -66,13 +73,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#define SCCS_GET "get"
/* Define to 'unsigned long' or 'unsigned long long'
if <inttypes.h> doesn't define. */
#define uintmax_t unsigned long long
/* Define the type of the first arg to select(). */
#define fd_set_size_t int
/* Define to 1 if you have the select function. */
#define HAVE_SELECT 1
@@ -82,35 +82,33 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'strncasecmp' function. */
#define HAVE_STRNCASECMP 1
/* Name of the package */
#define PACKAGE "%PACKAGE%"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "bug-%PACKAGE%@gnu.org"
/* Define to the full name of this package. */
#define PACKAGE_NAME "GNU %PACKAGE%"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "GNU %PACKAGE% %VERSION%"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "%PACKAGE%"
/* Define to the version of this package. */
#define PACKAGE_VERSION "%VERSION%"
/* Define to 1 if you have the `strtoll' function. */
#define HAVE_STRTOLL 1
/* Output sync support */
#define NO_OUTPUT_SYNC
/* Version number of package */
#define VERSION "%VERSION%"
#define NO_OUTPUT_SYNC 1
/* Build host information. */
#define MAKE_HOST "i386-pc-msdosdjgpp"
/* Grok DOS paths (drive specs and backslash path element separators) */
#define HAVE_DOS_PATHS
#define HAVE_DOS_PATHS 1
/* Define the type of the first arg to select(). */
#define fd_set_size_t int
/* Define to the widest signed integer type if <stdint.h> and <inttypes.h> do
not define. */
#define intmax_t long long
/* Define to `int' if <sys/types.h> does not define. */
#if __DJGPP__ == 2 && __DJGPP_MINOR__ < 5
#define ssize_t int
#endif
/* Define to 'unsigned long' or 'unsigned long long'
if <inttypes.h> doesn't define. */
#define uintmax_t unsigned long long
/* Include customized declarations. */
#include "../src/mkcustom.h"

View File

@@ -1,5 +1,5 @@
/* Debugging macros and interface.
Copyright (C) 1999-2022 Free Software Foundation, Inc.
Copyright (C) 1999-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#define DB_NONE (0x000)
#define DB_BASIC (0x001)

View File

@@ -1,5 +1,5 @@
/* Data base of default implicit rules for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
@@ -527,18 +527,24 @@ static const char *default_variables[] =
"AS", "as",
#ifdef GCC_IS_NATIVE
"CC", "gcc",
# ifdef __MSDOS__
"CXX", "gpp", /* g++ is an invalid name on MSDOS */
# else
"CXX", "gcc",
# endif /* __MSDOS__ */
"OBJC", "gcc",
#else
"CC", "cc",
"CXX", "g++",
"OBJC", "cc",
#endif
#ifdef MAKE_CXX
"CXX", MAKE_CXX,
#else
# ifdef GCC_IS_NATIVE
# ifdef __MSDOS__
"CXX", "gpp", /* g++ is an invalid name on MSDOS */
# else
"CXX", "gcc",
# endif /* __MSDOS__ */
# else
"CXX", "g++",
# endif
#endif
/* This expands to $(CO) $(COFLAGS) $< $@ if $@ does not exist,
and to the empty string if $@ does exist. */
"CHECKOUT,v", "+$(if $(wildcard $@),,$(CO) $(COFLAGS) $< $@)",
@@ -701,7 +707,7 @@ set_default_suffixes (void)
installed after. */
void
install_default_suffix_rules (void)
install_default_suffix_rules ()
{
const char **s;
@@ -711,14 +717,16 @@ install_default_suffix_rules (void)
for (s = default_suffix_rules; *s != 0; s += 2)
{
struct file *f = enter_file (strcache_add (s[0]));
/* This function should run before any makefile is parsed. */
assert (f->cmds == 0);
f->cmds = xmalloc (sizeof (struct commands));
f->cmds->fileinfo.filenm = 0;
f->cmds->commands = xstrdup (s[1]);
f->cmds->command_lines = 0;
f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
f->builtin = 1;
/* Install the default rule only if there is no user defined rule. */
if (!f->cmds)
{
f->cmds = xmalloc (sizeof (struct commands));
f->cmds->fileinfo.filenm = NULL;
f->cmds->commands = xstrdup (s[1]);
f->cmds->command_lines = NULL;
f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
f->builtin = 1;
}
}
}

View File

@@ -1,5 +1,5 @@
/* Definitions of dependency data structures for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
/* Structure used in chains of names, for parsing and globbing. */
@@ -102,24 +102,23 @@ char *tilde_expand (const char *name);
struct nameseq *ar_glob (const char *arname, const char *member_pattern, size_t size);
#endif
#define dep_name(d) ((d)->name ? (d)->name : (d)->file->name)
#define dep_name(d) ((d)->name ? (d)->name : (d)->file->name)
#define alloc_seq_elt(_t) xcalloc (sizeof (_t))
#define alloc_seq_elt(_t) xcalloc (sizeof (_t))
void free_ns_chain (struct nameseq *n);
#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); }
SI struct dep *alloc_dep() { return alloc_seq_elt (struct dep); }
SI struct goaldep *alloc_goaldep() { return alloc_seq_elt (struct goaldep); }
SI struct nameseq *alloc_ns (void) { return alloc_seq_elt (struct nameseq); }
SI struct dep *alloc_dep (void) { return alloc_seq_elt (struct dep); }
SI struct goaldep *alloc_goaldep (void) { return alloc_seq_elt (struct goaldep); }
SI void free_ns(struct nameseq *n) { free (n); }
SI void free_dep(struct dep *d) { free_ns ((struct nameseq *)d); }
SI void free_goaldep(struct goaldep *g) { free_dep ((struct dep *)g); }
SI void free_dep_chain(struct dep *d) { free_ns_chain((struct nameseq *)d); }
SI void free_goal_chain(struct goaldep *g) { free_dep_chain((struct dep *)g); }
SI void free_ns (struct nameseq *n) { free (n); }
SI void free_dep (struct dep *d) { free_ns ((struct nameseq *)d); }
SI void free_goaldep (struct goaldep *g) { free_dep ((struct dep *)g); }
SI void free_dep_chain (struct dep *d) { free_ns_chain((struct nameseq *)d); }
SI void free_goal_chain (struct goaldep *g) { free_dep_chain((struct dep *)g); }
#else
# define alloc_ns() alloc_seq_elt (struct nameseq)
# define alloc_dep() alloc_seq_elt (struct dep)

211
src/dir.c
View File

@@ -1,5 +1,5 @@
/* Directory hashing for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "hash.h"
@@ -76,12 +76,12 @@ dosify (const char *filename)
char *df;
int i;
if (filename == 0 || _USE_LFN)
if (filename == NULL || _USE_LFN)
return filename;
/* FIXME: what about filenames which violate
8+3 constraints, like "config.h.in", or ".emacs"? */
if (strpbrk (filename, "\"*+,;<=>?[\\]|") != 0)
if (strpbrk (filename, "\"*+,;<=>?[\\]|") != NULL)
return filename;
df = dos_filename;
@@ -105,7 +105,7 @@ dosify (const char *filename)
++filename;
if (*filename == '.')
return filename;
*df = 0;
*df = '\0';
return dos_filename;
}
#endif /* __MSDOS__ */
@@ -125,8 +125,8 @@ downcase (const char *filename)
static PATH_VAR (new_filename);
char *df;
if (filename == 0)
return 0;
if (filename == NULL)
return NULL;
df = new_filename;
while (*filename != '\0')
@@ -135,7 +135,7 @@ downcase (const char *filename)
++filename;
}
*df = 0;
*df = '\0';
return new_filename;
}
@@ -203,14 +203,14 @@ vmsstat_dir (const char *name, struct stat *st)
DIR *dir;
dir = opendir (name);
if (dir == 0)
if (dir == NULL)
return -1;
closedir (dir);
s = strchr (name, ':'); /* find device */
if (s)
{
/* to keep the compiler happy we said "const char *name", now we cheat */
*s++ = 0;
*s++ = '\0';
st->st_dev = (char *)vms_hash (name);
h = vms_hash (s);
*(s-1) = ':';
@@ -281,9 +281,10 @@ clear_directory_contents (struct directory_contents *dc)
{
--open_directories;
closedir (dc->dirstream);
dc->dirstream = 0;
dc->dirstream = NULL;
}
hash_free (&dc->dirfiles, 1);
if (dc->dirfiles.ht_vec != NULL)
hash_free (&dc->dirfiles, 1);
return NULL;
}
@@ -456,7 +457,7 @@ dirfile_hash_cmp (const void *xv, const void *yv)
#define DIRFILE_BUCKETS 107
#endif
static int dir_contents_file_exists_p (struct directory_contents *dir,
static int dir_contents_file_exists_p (struct directory *dir,
const char *filename);
static struct directory *find_directory (const char *name);
@@ -521,7 +522,7 @@ find_directory (const char *name)
/* See if the directory exists. */
#if defined(WINDOWS32)
{
char tem[MAXPATHLEN], *tstart, *tend;
char tem[MAX_PATH+1], *tstart, *tend;
size_t len = strlen (name);
/* Remove any trailing slashes. Windows32 stat fails even on
@@ -530,9 +531,7 @@ find_directory (const char *name)
tstart = tem;
if (tstart[1] == ':')
tstart += 2;
for (tend = tem + (len - 1);
tend > tstart && (*tend == '/' || *tend == '\\');
tend--)
for (tend = tem + (len - 1); tend > tstart && ISDIRSEP (*tend); tend--)
*tend = '\0';
r = stat (tem, &st);
@@ -603,7 +602,7 @@ find_directory (const char *name)
/* Point the name-hashed entry for DIR at its contents data. */
dir->contents = dc;
/* If the contents have changed, we need to reseet. */
/* If the contents have changed, we need to reseed. */
if (dc->counter != command_count)
{
if (dc->counter)
@@ -612,10 +611,9 @@ find_directory (const char *name)
dc->counter = command_count;
ENULLLOOP (dc->dirstream, opendir (name));
if (dc->dirstream == 0)
/* Couldn't open the directory. Mark this by setting the
'files' member to a nil pointer. */
dc->dirfiles.ht_vec = 0;
if (dc->dirstream == NULL)
/* Couldn't open the directory: mark this by setting files to NULL. */
dc->dirfiles.ht_vec = NULL;
else
{
hash_init (&dc->dirfiles, DIRFILE_BUCKETS,
@@ -625,7 +623,7 @@ find_directory (const char *name)
if (open_directories == MAX_OPEN_DIRECTORIES)
/* We have too many directories open already.
Read the entire directory and then close it. */
dir_contents_file_exists_p (dc, 0);
dir_contents_file_exists_p (dir, NULL);
}
}
@@ -636,17 +634,18 @@ find_directory (const char *name)
FILENAME must contain no slashes. */
static int
dir_contents_file_exists_p (struct directory_contents *dir,
dir_contents_file_exists_p (struct directory *dir,
const char *filename)
{
struct dirfile *df;
struct dirent *d;
struct directory_contents *dc = dir->contents;
#ifdef WINDOWS32
struct stat st;
int rehash = 0;
#endif
if (dir == 0 || dir->dirfiles.ht_vec == 0)
if (dc == NULL || dc->dirfiles.ht_vec == NULL)
/* The directory could not be stat'd or opened. */
return 0;
@@ -659,10 +658,16 @@ dir_contents_file_exists_p (struct directory_contents *dir,
#endif
#ifdef __EMX__
if (filename != 0)
_fnlwr (filename); /* lower case for FAT drives */
if (filename != NULL)
{
size_t len = strlen (filename);
char *fname = alloca (len + 1);
memcpy (fname, filename, len + 1);
_fnlwr (fname); /* lower case for FAT drives */
filename = fname;
}
#endif
if (filename != 0)
if (filename != NULL)
{
struct dirfile dirfile_key;
@@ -673,7 +678,7 @@ dir_contents_file_exists_p (struct directory_contents *dir,
}
dirfile_key.name = filename;
dirfile_key.length = strlen (filename);
df = hash_find_item (&dir->dirfiles, &dirfile_key);
df = hash_find_item (&dc->dirfiles, &dirfile_key);
if (df)
return !df->impossible;
}
@@ -681,7 +686,7 @@ dir_contents_file_exists_p (struct directory_contents *dir,
/* The file was not found in the hashed list.
Try to read the directory further. */
if (dir->dirstream == 0)
if (dc->dirstream == NULL)
{
#ifdef WINDOWS32
/*
@@ -689,17 +694,17 @@ dir_contents_file_exists_p (struct directory_contents *dir,
* filesystems force a rehash always as mtime does not change
* on directories (ugh!).
*/
if (dir->path_key)
if (dc->path_key)
{
if ((dir->fs_flags & FS_FAT) != 0)
if ((dc->fs_flags & FS_FAT) != 0)
{
dir->mtime = time ((time_t *) 0);
dc->mtime = time (NULL);
rehash = 1;
}
else if (stat (dir->path_key, &st) == 0 && st.st_mtime > dir->mtime)
else if (stat (dc->path_key, &st) == 0 && st.st_mtime > dc->mtime)
{
/* reset date stamp to show most recent re-process. */
dir->mtime = st.st_mtime;
dc->mtime = st.st_mtime;
rehash = 1;
}
@@ -708,8 +713,8 @@ dir_contents_file_exists_p (struct directory_contents *dir,
return 0;
/* make sure directory can still be opened; if not return. */
dir->dirstream = opendir (dir->path_key);
if (!dir->dirstream)
dc->dirstream = opendir (dc->path_key);
if (!dc->dirstream)
return 0;
}
else
@@ -725,11 +730,11 @@ dir_contents_file_exists_p (struct directory_contents *dir,
struct dirfile dirfile_key;
struct dirfile **dirfile_slot;
ENULLLOOP (d, readdir (dir->dirstream));
if (d == 0)
ENULLLOOP (d, readdir (dc->dirstream));
if (d == NULL)
{
if (errno)
pfatal_with_name ("INTERNAL: readdir");
OSS (fatal, NILF, "readdir %s: %s", dir->name, strerror (errno));
break;
}
@@ -749,7 +754,7 @@ dir_contents_file_exists_p (struct directory_contents *dir,
len = NAMLEN (d);
dirfile_key.name = d->d_name;
dirfile_key.length = len;
dirfile_slot = (struct dirfile **) hash_find_slot (&dir->dirfiles, &dirfile_key);
dirfile_slot = (struct dirfile **) hash_find_slot (&dc->dirfiles, &dirfile_key);
#ifdef WINDOWS32
/*
* If re-reading a directory, don't cache files that have
@@ -770,21 +775,22 @@ dir_contents_file_exists_p (struct directory_contents *dir,
#endif
df->length = len;
df->impossible = 0;
hash_insert_at (&dir->dirfiles, df, dirfile_slot);
hash_insert_at (&dc->dirfiles, df, dirfile_slot);
}
/* Check if the name matches the one we're searching for. */
if (filename != 0 && patheq (d->d_name, filename))
if (filename != NULL && patheq (d->d_name, filename))
return 1;
}
/* If the directory has been completely read in,
close the stream and reset the pointer to nil. */
if (d == 0)
if (d == NULL)
{
--open_directories;
closedir (dir->dirstream);
dir->dirstream = 0;
closedir (dc->dirstream);
dc->dirstream = NULL;
}
return 0;
}
@@ -796,15 +802,10 @@ int
dir_file_exists_p (const char *dirname, const char *filename)
{
#ifdef VMS
if ((filename != NULL) && (dirname != NULL))
{
int want_vmsify;
want_vmsify = (strpbrk (dirname, ":<[") != NULL);
if (want_vmsify)
filename = vmsify (filename, 0);
}
if (filename && dirname && strpbrk (dirname, ":<[") != NULL)
filename = vmsify (filename, 0);
#endif
return dir_contents_file_exists_p (find_directory (dirname)->contents,
return dir_contents_file_exists_p (find_directory (dirname),
filename);
}
@@ -824,17 +825,17 @@ file_exists_p (const char *name)
dirend = strrchr (name, '/');
#ifdef VMS
if (dirend == 0)
if (dirend == NULL)
{
dirend = strrchr (name, ']');
dirend == NULL ? dirend : dirend++;
}
if (dirend == 0)
if (dirend == NULL)
{
dirend = strrchr (name, '>');
dirend == NULL ? dirend : dirend++;
}
if (dirend == 0)
if (dirend == NULL)
{
dirend = strrchr (name, ':');
dirend == NULL ? dirend : dirend++;
@@ -851,7 +852,7 @@ file_exists_p (const char *name)
dirend = name + 1;
}
#endif /* HAVE_DOS_PATHS */
if (dirend == 0)
if (dirend == NULL)
#ifndef _AMIGA
return dir_file_exists_p (".", name);
#else /* !AMIGA */
@@ -867,7 +868,7 @@ file_exists_p (const char *name)
#ifdef HAVE_DOS_PATHS
/* d:/ and d: are *very* different... */
if (dirend < name + 3 && name[1] == ':' &&
(*dirend == '/' || *dirend == '\\' || *dirend == ':'))
(ISDIRSEP (*dirend) || *dirend == ':'))
dirend++;
#endif
p = alloca (dirend - name + 1);
@@ -925,7 +926,7 @@ file_impossible (const char *filename)
dirend = p + 1;
}
#endif /* HAVE_DOS_PATHS */
if (dirend == 0)
if (dirend == NULL)
#ifdef _AMIGA
dir = find_directory ("");
#else /* !AMIGA */
@@ -943,7 +944,7 @@ file_impossible (const char *filename)
#ifdef HAVE_DOS_PATHS
/* d:/ and d: are *very* different... */
if (dirend < p + 3 && p[1] == ':' &&
(*dirend == '/' || *dirend == '\\' || *dirend == ':'))
(ISDIRSEP (*dirend) || *dirend == ':'))
dirend++;
#endif
cp = alloca (dirend - p + 1);
@@ -962,16 +963,14 @@ file_impossible (const char *filename)
#endif
}
if (dir->contents == 0)
if (dir->contents == NULL)
/* The directory could not be stat'd. We allocate a contents
structure for it, but leave it out of the contents hash table. */
dir->contents = xcalloc (sizeof (struct directory_contents));
if (dir->contents->dirfiles.ht_vec == 0)
{
hash_init (&dir->contents->dirfiles, DIRFILE_BUCKETS,
dirfile_hash_1, dirfile_hash_2, dirfile_hash_cmp);
}
if (dir->contents->dirfiles.ht_vec == NULL)
hash_init (&dir->contents->dirfiles, DIRFILE_BUCKETS,
dirfile_hash_1, dirfile_hash_2, dirfile_hash_cmp);
/* Make a new entry and put it in the table. */
@@ -1023,7 +1022,7 @@ file_impossible_p (const char *filename)
dirend = filename + 1;
}
#endif /* HAVE_DOS_PATHS */
if (dirend == 0)
if (dirend == NULL)
#ifdef _AMIGA
dir = find_directory ("")->contents;
#else /* !AMIGA */
@@ -1041,7 +1040,7 @@ file_impossible_p (const char *filename)
#ifdef HAVE_DOS_PATHS
/* d:/ and d: are *very* different... */
if (dirend < filename + 3 && filename[1] == ':' &&
(*dirend == '/' || *dirend == '\\' || *dirend == ':'))
(ISDIRSEP (*dirend) || *dirend == ':'))
dirend++;
#endif
cp = alloca (dirend - filename + 1);
@@ -1060,7 +1059,7 @@ file_impossible_p (const char *filename)
#endif
}
if (dir == 0 || dir->dirfiles.ht_vec == 0)
if (dir == NULL || dir->dirfiles.ht_vec == NULL)
/* There are no files entered for this directory. */
return 0;
@@ -1102,6 +1101,9 @@ print_dir_data_base (void)
unsigned int impossible;
struct directory **dir_slot;
struct directory **dir_end;
#ifdef WINDOWS32
char buf[INTSTR_LENGTH + 1];
#endif
puts (_("\n# Directories\n"));
@@ -1114,27 +1116,22 @@ print_dir_data_base (void)
struct directory *dir = *dir_slot;
if (! HASH_VACANT (dir))
{
if (dir->contents == 0)
if (dir->contents == NULL)
printf (_("# %s: could not be stat'd.\n"), dir->name);
else if (dir->contents->dirfiles.ht_vec == 0)
{
else if (dir->contents->dirfiles.ht_vec == NULL)
#ifdef WINDOWS32
printf (_("# %s (key %s, mtime %I64u): could not be opened.\n"),
dir->name, dir->contents->path_key,
(unsigned long long)dir->contents->mtime);
#else /* WINDOWS32 */
#ifdef VMS_INO_T
printf (_("# %s (device %d, inode [%d,%d,%d]): could not be opened.\n"),
dir->name, dir->contents->dev,
dir->contents->ino[0], dir->contents->ino[1],
dir->contents->ino[2]);
printf (_("# %s (key %s, mtime %s): could not be opened.\n"),
dir->name, dir->contents->path_key,
make_ulltoa ((unsigned long long)dir->contents->mtime, buf));
#elif defined(VMS_INO_T)
printf (_("# %s (device %d, inode [%d,%d,%d]): could not be opened.\n"),
dir->name, dir->contents->dev,
dir->contents->ino[0], dir->contents->ino[1],
dir->contents->ino[2]);
#else
printf (_("# %s (device %ld, inode %ld): could not be opened.\n"),
dir->name, (long int) dir->contents->dev,
(long int) dir->contents->ino);
printf (_("# %s (device %ld, inode %ld): could not be opened.\n"),
dir->name, (long) dir->contents->dev, (long) dir->contents->ino);
#endif
#endif /* WINDOWS32 */
}
else
{
unsigned int f = 0;
@@ -1156,21 +1153,18 @@ print_dir_data_base (void)
}
}
#ifdef WINDOWS32
printf (_("# %s (key %s, mtime %I64u): "),
printf (_("# %s (key %s, mtime %s): "),
dir->name, dir->contents->path_key,
(unsigned long long)dir->contents->mtime);
#else /* WINDOWS32 */
#ifdef VMS_INO_T
make_ulltoa ((unsigned long long)dir->contents->mtime, buf));
#elif defined(VMS_INO_T)
printf (_("# %s (device %d, inode [%d,%d,%d]): "),
dir->name, dir->contents->dev,
dir->contents->ino[0], dir->contents->ino[1],
dir->contents->ino[2]);
#else
printf (_("# %s (device %ld, inode %ld): "),
dir->name,
printf (_("# %s (device %ld, inode %ld): "), dir->name,
(long)dir->contents->dev, (long)dir->contents->ino);
#endif
#endif /* WINDOWS32 */
if (f == 0)
fputs (_("No"), stdout);
else
@@ -1181,7 +1175,7 @@ print_dir_data_base (void)
else
printf ("%u", im);
fputs (_(" impossibilities"), stdout);
if (dir->contents->dirstream == 0)
if (dir->contents->dirstream == NULL)
puts (".");
else
puts (_(" so far."));
@@ -1215,34 +1209,34 @@ struct dirstream
};
/* Forward declarations. */
static __ptr_t open_dirstream (const char *);
static struct dirent *read_dirstream (__ptr_t);
static void *open_dirstream (const char *);
static struct dirent *read_dirstream (void *);
static __ptr_t
static void *
open_dirstream (const char *directory)
{
struct dirstream *new;
struct directory *dir = find_directory (directory);
if (dir->contents == 0 || dir->contents->dirfiles.ht_vec == 0)
if (dir->contents == NULL || dir->contents->dirfiles.ht_vec == NULL)
/* DIR->contents is nil if the directory could not be stat'd.
DIR->contents->dirfiles is nil if it could not be opened. */
return 0;
return NULL;
/* Read all the contents of the directory now. There is no benefit
in being lazy, since glob will want to see every file anyway. */
dir_contents_file_exists_p (dir->contents, 0);
dir_contents_file_exists_p (dir, NULL);
new = xmalloc (sizeof (struct dirstream));
new->contents = dir->contents;
new->dirfile_slot = (struct dirfile **) new->contents->dirfiles.ht_vec;
return (__ptr_t) new;
return new;
}
static struct dirent *
read_dirstream (__ptr_t stream)
read_dirstream (void *stream)
{
static char *buf;
static size_t bufsz;
@@ -1286,7 +1280,7 @@ read_dirstream (__ptr_t stream)
}
}
return 0;
return NULL;
}
/* On 64 bit ReliantUNIX (5.44 and above) in LFS mode, stat() is actually a
@@ -1319,13 +1313,12 @@ local_stat (const char *path, struct stat *buf)
/* Make sure the parent of "." exists and is a directory, not a
file. This is because 'stat' on Windows normalizes the argument
foo/. => foo without checking first that foo is a directory. */
if (plen > 2 && path[plen - 1] == '.'
&& (path[plen - 2] == '/' || path[plen - 2] == '\\'))
if (plen > 2 && path[plen - 1] == '.' && ISDIRSEP (path[plen - 2]))
{
char parent[MAXPATHLEN+1];
char parent[MAX_PATH+1];
strncpy (parent, path, MAXPATHLEN);
parent[MIN(plen - 2, MAXPATHLEN)] = '\0';
strncpy (parent, path, MAX_PATH);
parent[MIN(plen - 2, MAX_PATH)] = '\0';
if (stat (parent, buf) < 0 || !_S_ISDIR (buf->st_mode))
return -1;
}

View File

@@ -1,5 +1,5 @@
/* Variable expansion functions for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"

View File

@@ -1,5 +1,5 @@
/* Target file management for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
@@ -63,9 +63,6 @@ static struct hash_table files;
/* Whether or not .SECONDARY with no prerequisites was given. */
static int all_secondary = 0;
/* Whether or not .NOTINTERMEDIATE with no prerequisites was given. */
static int no_intermediates = 0;
/* Access the hash table of all file records.
lookup_file given a name, return the struct file * for that name,
or nil if there is none.
@@ -108,20 +105,10 @@ lookup_file (const char *name)
while (name[0] == '<' && name[1] == '>' && name[2] != '\0')
name += 2;
#endif
while (name[0] == '.'
#ifdef HAVE_DOS_PATHS
&& (name[1] == '/' || name[1] == '\\')
#else
&& name[1] == '/'
#endif
&& name[2] != '\0')
while (name[0] == '.' && ISDIRSEP (name[1]) && name[2] != '\0')
{
name += 2;
while (*name == '/'
#ifdef HAVE_DOS_PATHS
|| *name == '\\'
#endif
)
while (ISDIRSEP (*name))
/* Skip following slashes: ".//foo" is "foo", not "/foo". */
++name;
}
@@ -378,7 +365,7 @@ remove_intermediates (int sig)
int doneany = 0;
/* If there's no way we will ever remove anything anyway, punt early. */
if (question_flag || touch_flag || all_secondary)
if (question_flag || touch_flag || all_secondary || no_intermediates)
return;
if (sig && just_print_flag)
@@ -741,7 +728,7 @@ snap_file (const void *item, void *arg)
/* If .NOTINTERMEDIATE is set with no deps, mark all targets as
notintermediate, unless the target is a prereq of .INTERMEDIATE. */
if (no_intermediates && !f->intermediate && !f->secondary)
f->notintermediate = 1;
f->notintermediate = 1;
/* If .EXTRA_PREREQS is set, add them as ignored by automatic variables. */
if (f->variables)
@@ -820,7 +807,7 @@ snap_deps (void)
else
no_intermediates = 1;
/* The same file connot be both .INTERMEDIATE and .NOTINTERMEDIATE.
/* The same file cannot be both .INTERMEDIATE and .NOTINTERMEDIATE.
However, it is possible for a file to be .INTERMEDIATE and also match a
.NOTINTERMEDIATE pattern. In that case, the intermediate file has
priority over the notintermediate pattern. This priority is enforced by
@@ -1018,13 +1005,16 @@ file_timestamp_sprintf (char *p, FILE_TIMESTAMP ts)
struct tm *tm = localtime (&t);
if (tm)
sprintf (p, "%04d-%02d-%02d %02d:%02d:%02d",
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
{
intmax_t year = tm->tm_year;
sprintf (p, "%04" PRIdMAX "-%02d-%02d %02d:%02d:%02d",
year + 1900, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
}
else if (t < 0)
sprintf (p, "%ld", (long) t);
sprintf (p, "%" PRIdMAX, (intmax_t) t);
else
sprintf (p, "%lu", (unsigned long) t);
sprintf (p, "%" PRIuMAX, (uintmax_t) t);
p += strlen (p);
/* Append nanoseconds as a fraction, but remove trailing zeros. We don't

View File

@@ -1,5 +1,5 @@
/* Definition of target file data structures for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
/* Structure that represents the info on one file
@@ -212,6 +212,8 @@ FILE_TIMESTAMP f_mtime (struct file *file, int search);
<< FILE_TIMESTAMP_LO_BITS) \
+ ORDINARY_MTIME_MIN + FILE_TIMESTAMPS_PER_S - 1)
#define is_ordinary_mtime(_t) ((_t) >= ORDINARY_MTIME_MIN && (_t) <= ORDINARY_MTIME_MAX)
/* Modtime value to use for 'infinitely new'. We used to get the current time
from the system and use that whenever we wanted 'new'. But that causes
trouble when the machine running make and the machine holding a file have

View File

@@ -1,5 +1,5 @@
/* Builtin function expansion for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "filedef.h"
@@ -816,20 +816,18 @@ func_word (char *o, char **argv, const char *funcname UNUSED)
static char *
func_wordlist (char *o, char **argv, const char *funcname UNUSED)
{
char buf[INTSTR_LENGTH + 1];
long long start, stop, count;
const char* badfirst = _("invalid first argument to 'wordlist' function");
const char* badsecond = _("invalid second argument to 'wordlist' function");
start = parse_numeric (argv[0],
_("invalid first argument to 'wordlist' function"));
stop = parse_numeric (argv[1],
_("invalid second argument to 'wordlist' function"));
start = parse_numeric (argv[0], badfirst);
if (start < 1)
ON (fatal, *expanding_var,
"invalid first argument to 'wordlist' function: '%lld'", start);
OSS (fatal, *expanding_var, "%s: '%s'", badfirst, make_lltoa (start, buf));
stop = parse_numeric (argv[1], badsecond);
if (stop < 0)
ON (fatal, *expanding_var,
"invalid second argument to 'wordlist' function: '%lld'", stop);
OSS (fatal, *expanding_var, "%s: '%s'", badsecond, make_lltoa (stop, buf));
count = stop - start + 1;
@@ -987,12 +985,13 @@ a_word_hash_2 (const void *key)
static int
a_word_hash_cmp (const void *x, const void *y)
{
int result = (int) ((struct a_word const *) x)->length - ((struct a_word const *) y)->length;
if (result)
return result;
return_STRING_N_COMPARE (((struct a_word const *) x)->str,
((struct a_word const *) y)->str,
((struct a_word const *) y)->length);
const struct a_word *ax = x;
const struct a_word *ay = y;
if (ax->length != ay->length)
return ax->length > ay->length ? 1 : -1;
return_STRING_N_COMPARE (ax->str, ay->str, ax->length);
}
struct a_pattern
@@ -1011,7 +1010,7 @@ func_filter_filterout (char *o, char **argv, const char *funcname)
struct a_pattern *patterns;
struct a_pattern *pat_end;
struct a_pattern *pp;
size_t pat_count = 0, word_count = 0;
unsigned long pat_count = 0, word_count = 0;
struct hash_table a_word_table;
int is_filter = funcname[CSTRLEN ("filter")] == '\0';
@@ -2136,7 +2135,7 @@ func_not (char *o, char **argv, char *funcname UNUSED)
#ifdef HAVE_DOS_PATHS
# ifdef __CYGWIN__
# define IS_ABSOLUTE(n) ((n[0] && n[1] == ':') || STOP_SET (n[0], MAP_DIRSEP))
# define IS_ABSOLUTE(n) ((n[0] && n[1] == ':') || ISDIRSEP (n[0]))
# else
# define IS_ABSOLUTE(n) (n[0] && n[1] == ':')
# endif
@@ -2170,9 +2169,9 @@ abspath (const char *name, char *apath)
strcpy (apath, starting_directory);
#ifdef HAVE_DOS_PATHS
if (STOP_SET (name[0], MAP_DIRSEP))
if (ISDIRSEP (name[0]))
{
if (STOP_SET (name[1], MAP_DIRSEP))
if (ISDIRSEP (name[1]))
{
/* A UNC. Don't prepend a drive letter. */
apath[0] = name[0];
@@ -2192,7 +2191,7 @@ abspath (const char *name, char *apath)
else
{
#if defined(__CYGWIN__) && defined(HAVE_DOS_PATHS)
if (STOP_SET (name[0], MAP_DIRSEP))
if (ISDIRSEP (name[0]))
root_len = 1;
#endif
memcpy (apath, name, root_len);
@@ -2201,7 +2200,7 @@ abspath (const char *name, char *apath)
/* Get past the root, since we already copied it. */
name += root_len;
#ifdef HAVE_DOS_PATHS
if (! STOP_SET (apath[root_len - 1], MAP_DIRSEP))
if (! ISDIRSEP (apath[root_len - 1]))
{
/* Convert d:foo into d:./foo and increase root_len. */
apath[2] = '.';
@@ -2221,7 +2220,7 @@ abspath (const char *name, char *apath)
size_t len;
/* Skip sequence of multiple path-separators. */
while (STOP_SET (*start, MAP_DIRSEP))
while (ISDIRSEP (*start))
++start;
/* Find end of path component. */
@@ -2238,12 +2237,12 @@ abspath (const char *name, char *apath)
{
/* Back up to previous component, ignore if at root already. */
if (dest > apath + root_len)
for (--dest; ! STOP_SET (dest[-1], MAP_DIRSEP); --dest)
for (--dest; ! ISDIRSEP (dest[-1]); --dest)
;
}
else
{
if (! STOP_SET (dest[-1], MAP_DIRSEP))
if (! ISDIRSEP (dest[-1]))
*dest++ = '/';
if (dest + len >= apath_limit)
@@ -2255,7 +2254,7 @@ abspath (const char *name, char *apath)
}
/* Unless it is root strip trailing separator. */
if (dest > apath + root_len && STOP_SET (dest[-1], MAP_DIRSEP))
if (dest > apath + root_len && ISDIRSEP (dest[-1]))
--dest;
*dest = '\0';
@@ -2328,6 +2327,10 @@ func_file (char *o, char **argv, const char *funcname UNUSED)
if (fn[0] == '>')
{
size_t len;
const char *end;
const char *start;
char *nm;
FILE *fp;
const char *mode = "w";
@@ -2338,14 +2341,21 @@ func_file (char *o, char **argv, const char *funcname UNUSED)
mode = "a";
++fn;
}
NEXT_TOKEN (fn);
if (fn[0] == '\0')
start = next_token (fn);
if (start[0] == '\0')
O (fatal, *expanding_var, _("file: missing filename"));
ENULLLOOP (fp, fopen (fn, mode));
end = end_of_token (start);
len = end - start;
nm = alloca (len + 1);
memcpy (nm, start, len);
nm[len] = '\0';
ENULLLOOP (fp, fopen (nm, mode));
if (fp == NULL)
OSS (fatal, reading_file, _("open: %s: %s"), fn, strerror (errno));
OSS (fatal, reading_file, _("open: %s: %s"), nm, strerror (errno));
/* We've changed the contents of a directory, possibly.
Another option would be to look up the directory we changed and reset
@@ -2358,30 +2368,44 @@ func_file (char *o, char **argv, const char *funcname UNUSED)
int nl = l == 0 || argv[1][l-1] != '\n';
if (fputs (argv[1], fp) == EOF || (nl && fputc ('\n', fp) == EOF))
OSS (fatal, reading_file, _("write: %s: %s"), fn, strerror (errno));
OSS (fatal, reading_file, _("write: %s: %s"), nm, strerror (errno));
}
if (fclose (fp))
OSS (fatal, reading_file, _("close: %s: %s"), fn, strerror (errno));
OSS (fatal, reading_file, _("close: %s: %s"), nm, strerror (errno));
}
else if (fn[0] == '<')
{
size_t n = 0;
size_t len;
const char *end;
const char *start;
char *nm;
FILE *fp;
++fn;
NEXT_TOKEN (fn);
if (fn[0] == '\0')
start = next_token (fn + 1);
if (start[0] == '\0')
O (fatal, *expanding_var, _("file: missing filename"));
if (argv[1])
O (fatal, *expanding_var, _("file: too many arguments"));
ENULLLOOP (fp, fopen (fn, "r"));
end = end_of_token (start);
len = end - start;
nm = alloca (len + 1);
memcpy (nm, start, len);
nm[len] = '\0';
ENULLLOOP (fp, fopen (nm, "r"));
if (fp == NULL)
{
if (errno == ENOENT)
return o;
OSS (fatal, reading_file, _("open: %s: %s"), fn, strerror (errno));
{
DB (DB_VERBOSE, (_("file: Failed to open '%s': %s\n"),
nm, strerror (errno)));
return o;
}
OSS (fatal, reading_file, _("open: %s: %s"), nm, strerror (errno));
}
while (1)
@@ -2395,12 +2419,12 @@ func_file (char *o, char **argv, const char *funcname UNUSED)
}
if (ferror (fp))
if (errno != EINTR)
OSS (fatal, reading_file, _("read: %s: %s"), fn, strerror (errno));
OSS (fatal, reading_file, _("read: %s: %s"), nm, strerror (errno));
if (feof (fp))
break;
}
if (fclose (fp))
OSS (fatal, reading_file, _("close: %s: %s"), fn, strerror (errno));
OSS (fatal, reading_file, _("close: %s: %s"), nm, strerror (errno));
/* Remove trailing newline. */
if (n && o[-1] == '\n')
@@ -2518,14 +2542,14 @@ static struct function_table_entry function_table_init[] =
/* These must come after the definition of function_table. */
static char *
expand_builtin_function (char *o, int argc, char **argv,
expand_builtin_function (char *o, unsigned int argc, char **argv,
const struct function_table_entry *entry_p)
{
char *p;
if (argc < (int)entry_p->minimum_args)
if (argc < entry_p->minimum_args)
fatal (*expanding_var, strlen (entry_p->name),
_("insufficient number of arguments (%d) to function '%s'"),
_("insufficient number of arguments (%u) to function '%s'"),
argc, entry_p->name);
/* I suppose technically some function could do something with no arguments,
@@ -2574,7 +2598,7 @@ handle_function (char **op, const char **stringp)
int count = 0;
char *abeg = NULL;
char **argv, **argvp;
int nargs;
unsigned int nargs;
beg = *stringp + 1;
@@ -2686,11 +2710,11 @@ handle_function (char **op, const char **stringp)
static char *
func_call (char *o, char **argv, const char *funcname UNUSED)
{
static int max_args = 0;
static unsigned int max_args = 0;
char *fname;
char *body;
size_t flen;
int i;
unsigned int i;
int saved_args;
const struct function_table_entry *entry_p;
struct variable *v;
@@ -2741,7 +2765,7 @@ func_call (char *o, char **argv, const char *funcname UNUSED)
{
char num[INTSTR_LENGTH];
sprintf (num, "%d", i);
sprintf (num, "%u", i);
define_variable (num, strlen (num), *argv, o_automatic, 0);
}
@@ -2754,7 +2778,7 @@ func_call (char *o, char **argv, const char *funcname UNUSED)
{
char num[INTSTR_LENGTH];
sprintf (num, "%d", i);
sprintf (num, "%u", i);
define_variable (num, strlen (num), "", o_automatic, 0);
}
@@ -2802,7 +2826,7 @@ define_new_function (const floc *flocp, const char *name,
_("Invalid maximum argument count (%u) for function %s"), max, name);
ent = xmalloc (sizeof (struct function_table_entry));
ent->name = name;
ent->name = strcache_add (name);
ent->len = (unsigned char) len;
ent->minimum_args = (unsigned char) min;
ent->maximum_args = (unsigned char) max;
@@ -2812,7 +2836,8 @@ define_new_function (const floc *flocp, const char *name,
ent->adds_command = 1;
ent->fptr.alloc_func_ptr = func;
hash_insert (&function_table, ent);
ent = hash_insert (&function_table, ent);
free (ent);
}
void

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-2022 Free Software Foundation, Inc.
Copyright (C) 1987-2023 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.
@@ -18,7 +18,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
Ditto for AIX 3.2 and <stdlib.h>. */
@@ -436,6 +436,10 @@ _getopt_initialize (int argc, char *const *argv, const char *optstring)
nonoption_flags_len = 0;
#endif
/* Make the compiler happy. */
(void)argc;
(void)argv;
return optstring;
}
@@ -677,17 +681,18 @@ _getopt_internal (int argc, char *const *argv, const char *optstring,
else
{
if (opterr)
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
_("%s: option '--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
_("%s: option '%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
{
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
_("%s: option '--%s' doesn't allow an argument\n"),
argv[0], pfound->name);
else
/* +option or -option */
fprintf (stderr,
_("%s: option '%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
}
nextchar += strlen (nextchar);
optopt = pfound->val;

View File

@@ -1,5 +1,5 @@
/* Declarations for getopt.
Copyright (C) 1989-2022 Free Software Foundation, Inc.
Copyright (C) 1989-2023 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.
@@ -14,7 +14,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _GETOPT_H
#define _GETOPT_H 1

View File

@@ -1,5 +1,5 @@
/* getopt_long and getopt_long_only entry points for GNU getopt.
Copyright (C) 1987-1994, 1996-2022 Free Software Foundation, Inc.
Copyright (C) 1987-1994, 1996-2023 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.
@@ -14,7 +14,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#ifdef HAVE_CONFIG_H
#include <config.h>

View File

@@ -1,5 +1,5 @@
/* Convenience header for conditional use of GNU <libintl.h>.
Copyright (C) 1995-2022 Free Software Foundation, Inc.
Copyright (C) 1995-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _LIBGETTEXT_H
#define _LIBGETTEXT_H 1

View File

@@ -1,5 +1,5 @@
;; Contents of the (gnu make) Guile module
;; Copyright (C) 2011-2022 Free Software Foundation, Inc.
;; Contents of the (GNU Make) Guile module
;; Copyright (C) 2011-2023 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
@@ -13,11 +13,11 @@
;; 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/>.
;; with this program. If not, see <https://www.gnu.org/licenses/>.
(define (to-string-maybe x)
(cond
;; In GNU make, "false" is the empty string
;; In GNU Make, "false" is the empty string
((or (not x)
(unspecified? x)
(variable? x)
@@ -45,7 +45,7 @@
(walk x)
(string-join (reverse! acc))))
;; Return the value of the GNU make variable V
;; Return the value of the GNU Make variable V
(define (gmk-var v)
(gmk-expand (format #f "$(~a)" (obj-to-str v))))

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-2022 Free Software Foundation, Inc.
Copyright (C) 2013-2023 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
@@ -14,7 +14,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _GNUMAKE_H_
#define _GNUMAKE_H_
@@ -41,23 +41,23 @@ typedef char *(*gmk_func_ptr)(const char *nm, unsigned int argc, char **argv);
/* Free memory returned by the gmk_expand() function. */
GMK_EXPORT void gmk_free (char *str);
/* Allocate memory in GNU make's context. */
/* Allocate memory in GNU Make's context. */
GMK_EXPORT char *gmk_alloc (unsigned int len);
/* Run $(eval ...) on the provided string BUFFER. */
GMK_EXPORT void gmk_eval (const char *buffer, const gmk_floc *floc);
/* Run GNU make expansion on the provided string STR.
/* Run GNU Make expansion on the provided string STR.
Returns an allocated buffer that the caller must free with gmk_free(). */
GMK_EXPORT char *gmk_expand (const char *str);
/* Register a new GNU make function NAME (maximum of 255 chars long).
/* Register a new GNU Make function NAME (maximum of 255 chars long).
When the function is expanded in the makefile, FUNC will be invoked with
the appropriate arguments.
The return value of FUNC must be either NULL, in which case it expands to
the empty string, or a pointer to the result of the expansion in a string
created by gmk_alloc(). GNU make will free the memory when it's done.
created by gmk_alloc(). GNU Make will free the memory when it's done.
MIN_ARGS is the minimum number of arguments the function requires.
MAX_ARGS is the maximum number of arguments (or 0 if there's no maximum).

View File

@@ -1,5 +1,5 @@
/* GNU Guile interface for GNU Make.
Copyright (C) 2011-2022 Free Software Foundation, Inc.
Copyright (C) 2011-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
@@ -47,7 +47,7 @@ cvt_scm_to_str (SCM obj)
return scm_to_locale_string (scm_call_1 (obj_to_str, obj));
}
/* Perform the GNU make expansion function. */
/* Perform the GNU Make expansion function. */
static SCM
guile_expand_wrapper (SCM obj)
{
@@ -65,7 +65,7 @@ guile_expand_wrapper (SCM obj)
return ret;
}
/* Perform the GNU make eval function. */
/* Perform the GNU Make eval function. */
static SCM
guile_eval_wrapper (SCM obj)
{
@@ -77,24 +77,24 @@ guile_eval_wrapper (SCM obj)
return SCM_BOOL_F;
}
/* Invoked by scm_c_define_module(), in the context of the GNU make module. */
/* Invoked by scm_c_define_module(), in the context of the GNU Make module. */
static void
guile_define_module (void *data UNUSED)
{
/* Ingest the predefined Guile module for GNU make. */
/* Ingest the predefined Guile module for GNU Make. */
#include "gmk-default.h"
/* Register a subr for GNU make's eval capability. */
/* Register a subr for GNU Make's eval capability. */
scm_c_define_gsubr ("gmk-expand", 1, 0, 0, (GSUBR_TYPE) guile_expand_wrapper);
/* Register a subr for GNU make's eval capability. */
/* Register a subr for GNU Make's eval capability. */
scm_c_define_gsubr ("gmk-eval", 1, 0, 0, (GSUBR_TYPE) guile_eval_wrapper);
/* Define the rest of the module. */
scm_c_eval_string (GUILE_module_defn);
}
/* Initialize the GNU make Guile module. */
/* Initialize the GNU Make Guile module. */
static void *
guile_init (void *arg UNUSED)
{
@@ -104,7 +104,7 @@ guile_init (void *arg UNUSED)
/* Get a reference to the object-to-string translator, for later. */
obj_to_str = scm_variable_ref (scm_c_module_lookup (make_mod, "obj-to-str"));
/* Import the GNU make module exports into the generic space. */
/* Import the GNU Make module exports into the generic space. */
scm_c_eval_string ("(use-modules (gnu make))");
return NULL;

View File

@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "hash.h"
@@ -361,7 +361,7 @@ round_up_2 (unsigned long n)
#define sum_get_unaligned_32(r, p) \
do { \
unsigned int val; \
memcpy(&val, (p), 4); \
memcpy (&val, (p), 4); \
r += val; \
} while(0);
@@ -413,13 +413,16 @@ jhash(unsigned const char *k, int length)
#define UINTSZ sizeof (unsigned int)
#ifdef WORDS_BIGENDIAN
/* The ifs are ordered from the first byte in memory to the last. */
/* The ifs are ordered from the first byte in memory to the last.
Help the compiler optimize by using static memcpy length. */
#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); \
if (pn >= UINTSZ) \
memcpy (&val, (p), UINTSZ); \
else \
memcpy (&val, (p), pn); \
if ((val & 0xFF000000) == 0) \
flag = 1; \
else if ((val & 0xFF0000) == 0) \
@@ -432,13 +435,16 @@ jhash(unsigned const char *k, int length)
#else
/* 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. */
big endian case, from the first byte in memory to the last.
Help the compiler optimize by using static memcpy length. */
#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); \
if (pn >= UINTSZ) \
memcpy (&val, (p), UINTSZ); \
else \
memcpy (&val, (p), pn); \
flag = ((val - 0x01010101) & ~val) & 0x80808080; \
if (!flag) \
r += val; \

View File

@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#ifndef _hash_h_
#define _hash_h_

View File

@@ -1,5 +1,5 @@
/* Implicit rule searching for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "filedef.h"
@@ -234,7 +234,9 @@ pattern_search (struct file *file, int archive,
We may replace % by $(*F) for second expansion, increasing the length. */
size_t deplen = namelen + max_pattern_dep_length + 4;
char *depname = alloca (deplen);
#ifndef NDEBUG
char *dend = depname + deplen;
#endif
/* The start and length of the stem of FILENAME for the current rule. */
const char *stem = 0;
@@ -270,6 +272,8 @@ pattern_search (struct file *file, int archive,
PATH_VAR (stem_str); /* @@ Need to get rid of stem, stemlen, etc. */
++depth;
#ifndef NO_ARCHIVES
if (archive || ar_name (filename))
lastslash = 0;
@@ -891,7 +895,7 @@ pattern_search (struct file *file, int archive,
if (pattern_search (int_file,
0,
depth + 1,
depth,
recursions + 1,
allow_compat_rules))
{
@@ -1006,7 +1010,7 @@ pattern_search (struct file *file, int archive,
f->also_make = imf->also_make;
f->is_target = 1;
f->is_explicit |= imf->is_explicit || pat->is_explicit;
f->notintermediate |= imf->notintermediate;
f->notintermediate |= imf->notintermediate || no_intermediates;
f->intermediate |= !f->is_explicit && !f->notintermediate;
f->tried_implicit = 1;
@@ -1088,7 +1092,7 @@ pattern_search (struct file *file, int archive,
{
if (f->precious)
file->precious = 1;
if (f->notintermediate)
if (f->notintermediate || no_intermediates)
file->notintermediate = 1;
}
}
@@ -1121,7 +1125,7 @@ pattern_search (struct file *file, int archive,
{
if (f->precious)
new->file->precious = 1;
if (f->notintermediate)
if (f->notintermediate || no_intermediates)
new->file->notintermediate = 1;
}
@@ -1137,6 +1141,8 @@ pattern_search (struct file *file, int archive,
free (tryrules);
free (deplist);
--depth;
if (rule)
{
DBS (DB_IMPLICIT, (_("Found implicit rule '%s' for '%s'.\n"),

237
src/job.c
View File

@@ -1,5 +1,5 @@
/* Job execution and handling for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
@@ -30,9 +30,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Default shell to use. */
#ifdef WINDOWS32
# ifdef HAVE_STRINGS_H
# include <strings.h> /* for strcasecmp, strncasecmp */
# endif
# include <windows.h>
const char *default_shell = "sh.exe";
@@ -204,6 +201,14 @@ int getgid ();
# endif
#endif
#if HAVE_SYS_LOADAVG_H
# include <sys/loadavg.h>
#endif
#if HAVE_DECL_GETLOADAVG == 0
int getloadavg (double loadavg[], int nelem);
#endif
/* Different systems have different requirements for pid_t.
Plus we have to support gettext string translation... Argh. */
static const char *
@@ -220,10 +225,6 @@ pid2str (pid_t pid)
return pidstring;
}
#ifndef HAVE_DECL_GETLOADAVG
int getloadavg (double loadavg[], int nelem);
#endif
static void free_child (struct child *);
static void start_job_command (struct child *child);
static int load_too_high (void);
@@ -278,7 +279,7 @@ create_batch_file (char const *base, int unixy, int *fd)
{
const char *const ext = unixy ? "sh" : "bat";
const char *error_string = NULL;
char temp_path[MAXPATHLEN]; /* need to know its length */
char temp_path[MAX_PATH+1]; /* need to know its length */
unsigned path_size = GetTempPath (sizeof temp_path, temp_path);
int path_is_dot = 0;
/* The following variable is static so we won't try to reuse a name
@@ -411,7 +412,8 @@ _is_unixy_shell (const char *path)
else if (!name) /* name and p must be 0 */
name = path;
if (*name == '/' || *name == '\\') name++;
if (ISDIRSEP (*name))
name++;
i = 0;
while (known_os2shells[i] != NULL)
@@ -434,38 +436,30 @@ is_bourne_compatible_shell (const char *path)
static const char *unix_shells[] = {
"sh",
"bash",
"dash",
"ksh",
"rksh",
"zsh",
"ash",
"dash",
NULL
};
const char **s;
/* find the rightmost '/' or '\\' */
const char *name = strrchr (path, '/');
char *p = strrchr (path, '\\');
/* find the last directory separator, or the beginning of the string. */
const char *cp = path + strlen (path);
if (name && p) /* take the max */
name = (name > p) ? name : p;
else if (p) /* name must be 0 */
name = p;
else if (!name) /* name and p must be 0 */
name = path;
if (*name == '/' || *name == '\\')
++name;
while (cp > path && !ISDIRSEP (cp[-1]))
--cp;
/* this should be able to deal with extensions on Windows-like systems */
for (s = unix_shells; *s != NULL; ++s)
{
#if defined(WINDOWS32) || defined(__MSDOS__)
size_t len = strlen (*s);
if ((strlen (name) >= len && STOP_SET (name[len], MAP_DOT|MAP_NUL))
&& strncasecmp (name, *s, len) == 0)
if ((strlen (cp) >= len && STOP_SET (cp[len], MAP_DOT|MAP_NUL))
&& strncasecmp (cp, *s, len) == 0)
#else
if (strcmp (name, *s) == 0)
if (strcmp (cp, *s) == 0)
#endif
return 1; /* a known unix-style shell */
}
@@ -864,7 +858,7 @@ reap_children (int block, int err)
map_windows32_error_to_string from calling 'fatal',
which will then call reap_children again */
if (werr && exit_code > 0 && exit_code < WSABASEERR)
fprintf (stderr, "make (e=%d): %s", exit_code,
fprintf (stderr, "make (e=%d): %s\n", exit_code,
map_windows32_error_to_string (exit_code));
/* signal */
@@ -1199,7 +1193,7 @@ start_job_command (struct child *child)
| child->file->cmds->lines_flags[child->command_line - 1]);
p = child->command_ptr;
child->noerror = ((flags & COMMANDS_NOERROR) != 0);
child->noerror = ANY_SET (flags, COMMANDS_NOERROR);
while (*p != '\0')
{
@@ -1215,7 +1209,7 @@ start_job_command (struct child *child)
++p;
}
child->recursive = ((flags & COMMANDS_RECURSE) != 0);
child->recursive = ANY_SET (flags, COMMANDS_RECURSE);
/* Update the file's command flags with any new ones we found. We only
keep the COMMANDS_RECURSE setting. Even this isn't 100% correct; we are
@@ -1300,7 +1294,7 @@ start_job_command (struct child *child)
command line, or 'succeeded' otherwise. The exit status of 1 tells the
user that -q is saying 'something to do'; the exit status for a random
error is 2. */
if (argv != 0 && question_flag && !(flags & COMMANDS_RECURSE))
if (argv != 0 && question_flag && NONE_SET (flags, COMMANDS_RECURSE))
{
FREE_ARGV (argv);
#ifdef VMS
@@ -1316,7 +1310,7 @@ start_job_command (struct child *child)
#endif
}
if (touch_flag && !(flags & COMMANDS_RECURSE))
if (touch_flag && NONE_SET (flags, COMMANDS_RECURSE))
{
/* Go on to the next command. It might be the recursive one.
We construct ARGV only to find the end of the command line. */
@@ -1350,7 +1344,7 @@ start_job_command (struct child *child)
in SYNC_RECURSE mode or this command is not recursive. We'll also check
output_sync separately below in case it changes due to error. */
child->output.syncout = output_sync && (output_sync == OUTPUT_SYNC_RECURSE
|| !(flags & COMMANDS_RECURSE));
|| NONE_SET (flags, COMMANDS_RECURSE));
OUTPUT_SET (&child->output);
@@ -1361,7 +1355,7 @@ start_job_command (struct child *child)
/* Print the command if appropriate. */
if (just_print_flag || ISDB (DB_PRINT)
|| (!(flags & COMMANDS_SILENT) && !run_silent))
|| (NONE_SET (flags, COMMANDS_SILENT) && !run_silent))
OS (message, 0, "%s", p);
/* Tell update_goal_chain that a command has been started on behalf of
@@ -1401,7 +1395,7 @@ start_job_command (struct child *child)
/* If -n was given, recurse to get the next line in the sequence. */
if (just_print_flag && !(flags & COMMANDS_RECURSE))
if (just_print_flag && NONE_SET (flags, COMMANDS_RECURSE))
{
FREE_ARGV (argv);
goto next_command;
@@ -1426,9 +1420,16 @@ start_job_command (struct child *child)
child->deleted = 0;
#ifndef _AMIGA
/* Set up the environment for the child. */
/* Set up the environment for the child.
It's a slight inaccuracy to set the environment for recursive make even
for command lines that aren't recursive, but I don't want to have to
recompute the target environment for each command. Better would be to
keep a separate entry for MAKEFLAGS in the environment so it could be
replaced on its own. For now just set it for all lines.
*/
if (child->environment == 0)
child->environment = target_environment (child->file, child->recursive);
child->environment = target_environment (child->file,
child->file->cmds->any_recurse);
#endif
#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)
@@ -1460,9 +1461,6 @@ start_job_command (struct child *child)
#endif /* !VMS */
{
/* Fork the child process. */
char **parent_environ;
run_local:
block_sigs ();
@@ -1473,15 +1471,12 @@ start_job_command (struct child *child)
#else
parent_environ = environ;
jobserver_pre_child (flags & COMMANDS_RECURSE);
jobserver_pre_child (ANY_SET (flags, COMMANDS_RECURSE));
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);
jobserver_post_child (ANY_SET (flags, COMMANDS_RECURSE));
#endif /* !VMS */
}
@@ -1503,7 +1498,7 @@ start_job_command (struct child *child)
char *cmdline = argv[0];
/* We don't have a way to pass environment to 'system',
so we need to save and restore ours, sigh... */
char **parent_environ = environ;
char **parent_env = environ;
environ = child->environment;
@@ -1518,7 +1513,7 @@ start_job_command (struct child *child)
dos_command_running = 1;
proc_return = system (cmdline);
environ = parent_environ;
environ = parent_env;
execute_by_shell = 0; /* for the next time */
}
else
@@ -1902,7 +1897,6 @@ new_job (struct file *file)
Use message here so that changes to working directories are logged. */
if (ISDB (DB_WHY))
{
char *newer = allocated_variable_expand_for_file ("$?", c->file);
const char *nm;
if (! cmds->fileinfo.filenm)
@@ -1914,11 +1908,51 @@ new_job (struct file *file)
nm = n;
}
OSSS (message, 0,
_("%s: update target '%s' due to: %s"), nm, c->file->name,
newer[0] == '\0' ? _("target does not exist") : newer);
if (c->file->phony)
OSS (message, 0, _("%s: update target '%s' due to: target is .PHONY"),
nm, c->file->name);
else if (c->file->last_mtime == NONEXISTENT_MTIME)
OSS (message, 0,
_("%s: update target '%s' due to: target does not exist"),
nm, c->file->name);
else
{
char *newer = allocated_variable_expand_for_file ("$?", c->file);
if (newer[0] != '\0')
{
OSSS (message, 0, _("%s: update target '%s' due to: %s"),
nm, c->file->name, newer);
free (newer);
}
else
{
/* One or more files didn't exist, and didn't get created. */
size_t len = 0;
struct dep *d;
free (newer);
for (d = c->file->deps; d != NULL; d = d->next)
if (d->file->last_mtime == NONEXISTENT_MTIME)
len += strlen (d->file->name) + 1;
if (!len)
OSS (message, 0,
_("%s: update target '%s' due to: unknown reasons"),
nm, c->file->name);
else
{
char *cp = newer = alloca (len);
for (d = c->file->deps; d != NULL; d = d->next)
if (d->file->last_mtime == NONEXISTENT_MTIME)
{
if (cp > newer)
*(cp++) = ' ';
cp = stpcpy (cp, d->file->name);
}
OSSS (message, 0, _("%s: update target '%s' due to: %s"),
nm, c->file->name, newer);
}
}
}
}
/* The job is now primed. Start it running.
@@ -2100,6 +2134,7 @@ load_too_high (void)
}
/* Find the real system load average. */
errno = 0;
if (getloadavg (&load, 1) != 1)
{
static int lossage = -1;
@@ -2279,7 +2314,7 @@ 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;
int fderr = FD_STDERR;
pid_t pid;
pid_t pid = -1;
int r;
#if defined(USE_POSIX_SPAWN)
char *cmd;
@@ -2299,9 +2334,16 @@ child_execute_job (struct childbase *child, int good_stdin, char **argv)
#if !defined(USE_POSIX_SPAWN)
pid = vfork();
if (pid != 0)
return pid;
{
/* The child may clobber environ so remember ours and restore it. */
char **parent_env = environ;
pid = vfork ();
if (pid != 0)
{
environ = parent_env;
return pid;
}
}
/* We are the child. */
unblock_all_sigs ();
@@ -2514,7 +2556,7 @@ exec_command (char **argv, char **envp)
exit_code = process_exit_code (hWaitPID);
if (err)
fprintf (stderr, "make (e=%d, rc=%d): %s",
fprintf (stderr, "make (e=%d, rc=%d): %s\n",
err, exit_code, map_windows32_error_to_string (err));
/* cleanup process */
@@ -2551,8 +2593,15 @@ exec_command (char **argv, char **envp)
if (errno == ENOENT)
errno = ENOEXEC;
# elif MK_OS_ZOS
/* In z/OS we can't set environ in ASCII mode. */
environ = envp;
execvpe(argv[0], argv, envp);
# else
/* Run the program. */
/* Run the program. Don't use execvpe() as we want the search for argv[0]
to use the new PATH, but execvpe() searches before resetting PATH. */
environ = envp;
execvp (argv[0], argv);
@@ -2599,7 +2648,7 @@ exec_command (char **argv, char **envp)
# ifdef __EMX__
if (!unixy_shell)
{
new_argv[1] = "/c";
new_argv[1] = (char *)"/c";
++i;
--argc;
}
@@ -2616,6 +2665,9 @@ exec_command (char **argv, char **envp)
pid = spawnvpe (P_NOWAIT, shell, new_argv, envp);
if (pid >= 0)
break;
# elif MK_OS_ZOS
/* In z/OS we can't set environ in ASCII mode. */
execvpe(shell, new_argv, envp);
# else
execvp (shell, new_argv);
# endif
@@ -2841,7 +2893,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
return 0;
if (shellflags == 0)
shellflags = posix_pedantic ? "-ec" : "-c";
shellflags = posix_pedantic && NONE_SET (flags, COMMANDS_NOERROR) ? "-ec" : "-c";
/* See if it is safe to parse commands internally. */
if (shell == 0)
@@ -3045,8 +3097,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
}
else
#endif
if (p[1] != '\\' && p[1] != '\''
&& !ISSPACE (p[1])
if (p[1] != '\\' && p[1] != '\'' && !ISSPACE (p[1])
&& strchr (sh_chars_sh, p[1]) == 0)
/* back up one notch, to copy the backslash */
--p;
@@ -3226,7 +3277,13 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
# ifdef __EMX__ /* is this necessary? */
if (!unixy_shell && shellflags)
shellflags[0] = '/'; /* "/c" */
{
size_t len = strlen (shellflags);
char *shflags = alloca (len + 1);
memcpy (shflags, shellflags, len + 1);
shflags[0] = '/'; /* "/c" */
shellflags = shflags;
}
# endif
/* In .ONESHELL mode we are allowed to throw the entire current
@@ -3364,30 +3421,44 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
#endif /* WINDOWS32 */
/* Create an argv list for the shell command line. */
{
int n = 0;
int n = 1;
char *nextp;
new_argv = xmalloc ((4 + sflags_len/2) * sizeof (char *));
new_argv[n++] = xstrdup (shell);
nextp = new_argv[0] = xmalloc (shell_len + sflags_len + line_len + 3);
nextp = mempcpy (nextp, shell, shell_len + 1);
/* Chop up the shellflags (if any) and assign them. */
if (! shellflags)
new_argv[n++] = xstrdup ("");
{
new_argv[n++] = nextp;
*(nextp++) = '\0';
}
else
{
/* Parse shellflags using construct_command_argv_internal to
handle quotes. */
char **argv;
char *f;
f = alloca (sflags_len + 1); // +1 for null terminator.
char *f = alloca (sflags_len + 1);
memcpy (f, shellflags, sflags_len + 1);
argv = construct_command_argv_internal (f, 0, 0, 0, 0, flags, 0);
for (char **a = argv; a && *a; ++a)
new_argv[n++] = *a;
free (argv);
if (argv)
{
char **a;
for (a = argv; *a; ++a)
{
new_argv[n++] = nextp;
nextp = stpcpy (nextp, *a) + 1;
}
free (argv[0]);
free (argv);
}
}
/* Set the command to invoke. */
new_argv[n++] = line;
new_argv[n++] = nextp;
memcpy(nextp, line, line_len + 1);
new_argv[n++] = NULL;
}
return new_argv;
@@ -3472,9 +3543,9 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
#ifdef WINDOWS32
/* Some shells do not work well when invoked as 'sh -c xxx' to run a
command line (e.g. Cygnus GNUWIN32 sh.exe on WIN32 systems). In these
command line (e.g. Cygnus GNUWIN32 sh.exe on W32 systems). In these
cases, run commands via a script file. */
if (just_print_flag && !(flags & COMMANDS_RECURSE))
if (just_print_flag && NONE_SET (flags, COMMANDS_RECURSE))
{
/* Need to allocate new_argv, although it's unused, because
start_job_command will want to free it and its 0'th element. */
@@ -3535,9 +3606,9 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
/* new_line is local, must not be freed therefore
We use line here instead of new_line because we run the shell
manually. */
size_t line_len = strlen (line);
char *p = new_line;
char *q = new_line;
line_len = strlen (line);
p = new_line;
memcpy (new_line, line, line_len + 1);
/* Replace all backslash-newline combination and also following tabs.
Important: stop at the first '\n' because that's what the loop above
@@ -3646,6 +3717,7 @@ construct_command_argv (char *line, char **restp, struct file *file,
char **argv;
{
struct variable *var;
/* Turn off --warn-undefined-variables while we expand SHELL and IFS. */
int save = warn_undefined_variables_flag;
warn_undefined_variables_flag = 0;
@@ -3680,8 +3752,7 @@ construct_command_argv (char *line, char **restp, struct file *file,
performed) and if shell is an absolute path without drive letter,
try whether it exists e.g.: if "/bin/sh" does not exist use
"$UNIXROOT/bin/sh" instead. */
if (unixroot && shell && strcmp (shell, last_shell) != 0
&& (shell[0] == '/' || shell[0] == '\\'))
if (unixroot && shell && ISDIRSEP (shell[0]) && !streq (shell, last_shell))
{
/* trying a new shell, check whether it exists */
size_t size = strlen (shell);
@@ -3707,7 +3778,15 @@ construct_command_argv (char *line, char **restp, struct file *file,
}
#endif /* __EMX__ */
shellflags = allocated_variable_expand_for_file ("$(.SHELLFLAGS)", file);
var = lookup_variable_for_file (STRING_SIZE_TUPLE (".SHELLFLAGS"), file);
if (!var)
shellflags = xstrdup ("");
else if (posix_pedantic && var->origin == o_default)
/* In POSIX mode we default to -ec, unless we're ignoring errors. */
shellflags = xstrdup (ANY_SET (cmd_flags, COMMANDS_NOERROR) ? "-c" : "-ec");
else
shellflags = allocated_variable_expand_for_file (var->value, file);
ifs = allocated_variable_expand_for_file ("$(IFS)", file);
warn_undefined_variables_flag = save;

View File

@@ -1,5 +1,5 @@
/* Definitions for managing subprocesses in GNU Make.
Copyright (C) 1992-2022 Free Software Foundation, Inc.
Copyright (C) 1992-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "output.h"

View File

@@ -1,5 +1,5 @@
/* Loading dynamic objects for GNU Make.
Copyright (C) 2012-2022 Free Software Foundation, Inc.
Copyright (C) 2012-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"

View File

@@ -1,5 +1,5 @@
/* API for GNU Make dynamic objects.
Copyright (C) 2013-2022 Free Software Foundation, Inc.
Copyright (C) 2013-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"

View File

@@ -1,5 +1,5 @@
/* Argument parsing and main program of GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "os.h"
@@ -34,9 +34,6 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef WINDOWS32
# include <windows.h>
# include <io.h>
#ifdef HAVE_STRINGS_H
# include <strings.h> /* for strcasecmp */
#endif
# include "pathstuff.h"
# include "sub_proc.h"
# include "w32err.h"
@@ -105,8 +102,10 @@ double atof ();
static void clean_jobserver (int status);
static void print_data_base (void);
static void print_version (void);
static void decode_switches (int argc, const char **argv, int env);
static struct variable *define_makeflags (int all, int makefile);
static void decode_switches (int argc, const char **argv,
enum variable_origin origin);
static void decode_env_switches (const char *envar, size_t len,
enum variable_origin origin);
static char *quote_for_env (char *out, const char *in);
static void initialize_global_hash_tables (void);
@@ -136,6 +135,7 @@ int verify_flag;
static int silent_flag;
static const int default_silent_flag = 0;
static enum variable_origin silent_origin = o_default;
/* Nonzero means either -s was given, or .SILENT-with-no-deps was seen. */
@@ -190,16 +190,15 @@ int no_builtin_variables_flag = 0;
int keep_going_flag;
static const int default_keep_going_flag = 0;
static enum variable_origin keep_going_origin = o_default;
/* Nonzero means check symlink mtimes. */
int check_symlink_flag = 0;
/* Nonzero means print directory before starting and when done (-w). */
int print_directory;
static int print_directory_flag = -1;
static const int default_print_directory_flag = -1;
static enum variable_origin print_directory_origin = o_default;
/* Nonzero means print version information. */
@@ -235,6 +234,7 @@ static const int inf_jobs = 0;
char *jobserver_auth = NULL;
/* Style for the jobserver. */
static char *jobserver_style = NULL;
/* Shuffle mode for goals and prerequisites. */
@@ -298,6 +298,9 @@ struct variable shell_var;
char cmd_prefix = '\t';
/* Whether or not .NOTINTERMEDIATE with no prerequisites was given. */
unsigned int no_intermediates;
/* Count the number of commands we've invoked, that might change something in
the filesystem. Start with 1 so calloc'd memory never matches. */
@@ -405,30 +408,34 @@ static int trace_flag = 0;
struct command_switch
{
int c; /* The switch character. */
int c; /* The switch character. */
enum /* Type of the value. */
enum /* Type of the value. */
{
flag, /* Turn int flag on. */
flag_off, /* Turn int flag off. */
string, /* One string per invocation. */
strlist, /* One string per switch. */
filename, /* A string containing a file name. */
positive_int, /* A positive integer. */
floating, /* A floating-point number (double). */
ignore /* Ignored. */
flag, /* Turn int flag on. */
flag_off, /* Turn int flag off. */
string, /* One string per invocation. */
strlist, /* One string per switch. */
filename, /* A string containing a file name. */
positive_int, /* A positive integer. */
floating, /* A floating-point number (double). */
ignore /* Ignored. */
} type;
void *value_ptr; /* Pointer to the value-holding variable. */
void *value_ptr; /* Pointer to the value-holding variable. */
unsigned int env:1; /* Can come from MAKEFLAGS. */
unsigned int toenv:1; /* Should be put in MAKEFLAGS. */
unsigned int no_makefile:1; /* Don't propagate when remaking makefiles. */
unsigned int env:1; /* Can come from MAKEFLAGS. */
unsigned int toenv:1; /* Should be put in MAKEFLAGS. */
unsigned int no_makefile:1; /* Don't propagate when remaking makefiles. */
unsigned int specified:1; /* Set if the switch was specified somewhere.
Allows switches that are ON by default to
appear in MAKEFLAGS when set explicitly. */
const void *noarg_value; /* Pointer to value used if no arg given. */
const void *default_value; /* Pointer to default value. */
const void *noarg_value; /* Pointer to value used if no arg given. */
const void *default_value; /* Pointer to default value. */
const char *long_name; /* Long option name. */
const char *long_name; /* Long option name. */
enum variable_origin *origin; /* Origin of the value. */
};
/* The table of command switches.
@@ -437,63 +444,64 @@ struct command_switch
#define TEMP_STDIN_OPT (CHAR_MAX+10)
static const struct command_switch switches[] =
static struct command_switch switches[] =
{
{ 'b', ignore, 0, 0, 0, 0, 0, 0, 0 },
{ 'B', flag, &always_make_set, 1, 1, 0, 0, 0, "always-make" },
{ 'd', flag, &debug_flag, 1, 1, 0, 0, 0, 0 },
{ 'e', flag, &env_overrides, 1, 1, 0, 0, 0, "environment-overrides", },
{ 'E', strlist, &eval_strings, 1, 0, 0, 0, 0, "eval" },
{ 'h', flag, &print_usage_flag, 0, 0, 0, 0, 0, "help" },
{ 'i', flag, &ignore_errors_flag, 1, 1, 0, 0, 0, "ignore-errors" },
{ 'k', flag, &keep_going_flag, 1, 1, 0, 0, &default_keep_going_flag,
"keep-going" },
{ 'L', flag, &check_symlink_flag, 1, 1, 0, 0, 0, "check-symlink-times" },
{ 'm', ignore, 0, 0, 0, 0, 0, 0, 0 },
{ 'n', flag, &just_print_flag, 1, 1, 1, 0, 0, "just-print" },
{ 'p', flag, &print_data_base_flag, 1, 1, 0, 0, 0, "print-data-base" },
{ 'q', flag, &question_flag, 1, 1, 1, 0, 0, "question" },
{ 'r', flag, &no_builtin_rules_flag, 1, 1, 0, 0, 0, "no-builtin-rules" },
{ 'R', flag, &no_builtin_variables_flag, 1, 1, 0, 0, 0,
"no-builtin-variables" },
{ 's', flag, &silent_flag, 1, 1, 0, 0, &default_silent_flag, "silent" },
{ 'S', flag_off, &keep_going_flag, 1, 1, 0, 0, &default_keep_going_flag,
"no-keep-going" },
{ 't', flag, &touch_flag, 1, 1, 1, 0, 0, "touch" },
{ 'v', flag, &print_version_flag, 1, 0, 0, 0, 0, "version" },
{ 'w', flag, &print_directory_flag, 1, 1, 0, 0,
&default_print_directory_flag, "print-directory" },
{ 'b', ignore, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 'B', flag, &always_make_set, 1, 1, 0, 0, 0, 0, "always-make", 0 },
{ 'd', flag, &debug_flag, 1, 1, 0, 0, 0, 0, 0, 0 },
{ 'e', flag, &env_overrides, 1, 1, 0, 0, 0, 0, "environment-overrides", 0 },
{ 'E', strlist, &eval_strings, 1, 0, 0, 0, 0, 0, "eval", 0 },
{ 'h', flag, &print_usage_flag, 0, 0, 0, 0, 0, 0, "help", 0 },
{ 'i', flag, &ignore_errors_flag, 1, 1, 0, 0, 0, 0, "ignore-errors", 0 },
{ 'k', flag, &keep_going_flag, 1, 1, 0, 0, 0, &default_keep_going_flag,
"keep-going", &keep_going_origin },
{ 'L', flag, &check_symlink_flag, 1, 1, 0, 0, 0, 0, "check-symlink-times", 0 },
{ 'm', ignore, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
{ 'n', flag, &just_print_flag, 1, 1, 1, 0, 0, 0, "just-print", 0 },
{ 'p', flag, &print_data_base_flag, 1, 1, 0, 0, 0, 0, "print-data-base", 0 },
{ 'q', flag, &question_flag, 1, 1, 1, 0, 0, 0, "question", 0 },
{ 'r', flag, &no_builtin_rules_flag, 1, 1, 0, 0, 0, 0, "no-builtin-rules", 0 },
{ 'R', flag, &no_builtin_variables_flag, 1, 1, 0, 0, 0, 0,
"no-builtin-variables", 0 },
{ 's', flag, &silent_flag, 1, 1, 0, 0, 0, &default_silent_flag, "silent",
&silent_origin },
{ 'S', flag_off, &keep_going_flag, 1, 1, 0, 0, 0, &default_keep_going_flag,
"no-keep-going", &keep_going_origin },
{ 't', flag, &touch_flag, 1, 1, 1, 0, 0, 0, "touch", 0 },
{ 'v', flag, &print_version_flag, 1, 0, 0, 0, 0, 0, "version", 0 },
{ 'w', flag, &print_directory_flag, 1, 1, 0, 0, 0,
&default_print_directory_flag, "print-directory", &print_directory_origin },
/* These options take arguments. */
{ 'C', filename, &directories, 0, 0, 0, 0, 0, "directory" },
{ 'f', filename, &makefiles, 0, 0, 0, 0, 0, "file" },
{ 'I', filename, &include_dirs, 1, 1, 0, 0, 0,
"include-dir" },
{ 'j', positive_int, &arg_job_slots, 1, 1, 0, &inf_jobs, &default_job_slots,
"jobs" },
{ 'l', floating, &max_load_average, 1, 1, 0, &default_load_average,
&default_load_average, "load-average" },
{ 'o', filename, &old_files, 0, 0, 0, 0, 0, "old-file" },
{ 'O', string, &output_sync_option, 1, 1, 0, "target", 0, "output-sync" },
{ 'W', filename, &new_files, 0, 0, 0, 0, 0, "what-if" },
{ 'C', filename, &directories, 0, 0, 0, 0, 0, 0, "directory", 0 },
{ 'f', filename, &makefiles, 0, 0, 0, 0, 0, 0, "file", 0 },
{ 'I', filename, &include_dirs, 1, 1, 0, 0, 0, 0,
"include-dir", 0 },
{ 'j', positive_int, &arg_job_slots, 1, 1, 0, 0, &inf_jobs, &default_job_slots,
"jobs", 0 },
{ 'l', floating, &max_load_average, 1, 1, 0, 0, &default_load_average,
&default_load_average, "load-average", 0 },
{ 'o', filename, &old_files, 0, 0, 0, 0, 0, 0, "old-file", 0 },
{ 'O', string, &output_sync_option, 1, 1, 0, 0, "target", 0, "output-sync", 0 },
{ 'W', filename, &new_files, 0, 0, 0, 0, 0, 0, "what-if", 0 },
/* These are long-style options. */
{ CHAR_MAX+1, strlist, &db_flags, 1, 1, 0, "basic", 0, "debug" },
{ CHAR_MAX+2, string, &jobserver_auth, 1, 1, 0, 0, 0, JOBSERVER_AUTH_OPT },
{ CHAR_MAX+3, flag, &trace_flag, 1, 1, 0, 0, 0, "trace" },
{ CHAR_MAX+4, flag_off, &print_directory_flag, 1, 1, 0, 0,
&default_print_directory_flag, "no-print-directory" },
{ CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
"warn-undefined-variables" },
{ CHAR_MAX+7, string, &sync_mutex, 1, 1, 0, 0, 0, "sync-mutex" },
{ CHAR_MAX+8, flag_off, &silent_flag, 1, 1, 0, 0, &default_silent_flag,
"no-silent" },
{ CHAR_MAX+9, string, &jobserver_auth, 1, 0, 0, 0, 0, "jobserver-fds" },
{ CHAR_MAX+1, strlist, &db_flags, 1, 1, 0, 0, "basic", 0, "debug", 0 },
{ CHAR_MAX+2, string, &jobserver_auth, 1, 1, 0, 0, 0, 0, JOBSERVER_AUTH_OPT, 0 },
{ CHAR_MAX+3, flag, &trace_flag, 1, 1, 0, 0, 0, 0, "trace", 0 },
{ CHAR_MAX+4, flag_off, &print_directory_flag, 1, 1, 0, 0, 0,
&default_print_directory_flag, "no-print-directory", &print_directory_origin },
{ CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0, 0,
"warn-undefined-variables", 0 },
{ CHAR_MAX+7, string, &sync_mutex, 1, 1, 0, 0, 0, 0, "sync-mutex", 0 },
{ CHAR_MAX+8, flag_off, &silent_flag, 1, 1, 0, 0, 0, &default_silent_flag,
"no-silent", &silent_origin },
{ CHAR_MAX+9, string, &jobserver_auth, 1, 0, 0, 0, 0, 0, "jobserver-fds", 0 },
/* There is special-case handling for this in decode_switches() as well. */
{ TEMP_STDIN_OPT, filename, &makefiles, 0, 0, 0, 0, 0, "temp-stdin" },
{ CHAR_MAX+11, string, &shuffle_mode, 1, 1, 0, "random", 0, "shuffle" },
{ CHAR_MAX+12, string, &jobserver_style, 1, 0, 0, 0, 0, "jobserver-style" },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0 }
{ TEMP_STDIN_OPT, filename, &makefiles, 0, 0, 0, 0, 0, 0, "temp-stdin", 0 },
{ CHAR_MAX+11, string, &shuffle_mode, 1, 1, 0, 0, "random", 0, "shuffle", 0 },
{ CHAR_MAX+12, string, &jobserver_style, 1, 0, 0, 0, 0, 0, "jobserver-style", 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};
/* Secondary long names for options. */
@@ -688,7 +696,7 @@ initialize_stopchar_map (void)
/* This code is stolen from gnulib.
If/when we abandon the requirement to work with K&R compilers, we can
remove this (and perhaps other parts of GNU make!) and migrate to using
remove this (and perhaps other parts of GNU Make!) and migrate to using
gnulib directly.
This is called only through atexit(), which means die() has already been
@@ -989,7 +997,7 @@ handle_runtime_exceptions (struct _EXCEPTION_POINTERS *exinfo)
}
/*
* On WIN32 systems we don't have the luxury of a /bin directory that
* On W32 systems we don't have the luxury of a /bin directory that
* is mapped globally to every drive mounted to the system. Since make could
* be invoked from any drive, and we don't want to propagate /bin/sh
* to every single drive. Allow ourselves a chance to search for
@@ -1016,12 +1024,10 @@ find_and_set_default_shell (const char *token)
"cmd.exe" case-insensitive. */
tokend = search_token + strlen (search_token) - 3;
if (((tokend == search_token
|| (tokend > search_token
&& (tokend[-1] == '/' || tokend[-1] == '\\')))
|| (tokend > search_token && ISDIRSEP (tokend[-1])))
&& !strcasecmp (tokend, "cmd"))
|| ((tokend - 4 == search_token
|| (tokend - 4 > search_token
&& (tokend[-5] == '/' || tokend[-5] == '\\')))
|| (tokend - 4 > search_token && ISDIRSEP (tokend[-5])))
&& !strcasecmp (tokend - 4, "cmd.exe")))
{
batch_mode_shell = 1;
@@ -1137,7 +1143,28 @@ reset_jobserver (void)
jobserver_auth = NULL;
}
#ifdef _AMIGA
void
temp_stdin_unlink ()
{
/* This function is called from a signal handler. Keep async-signal-safe.
If there is a temp file from reading from stdin, get rid of it. */
if (stdin_offset >= 0)
{
const char *nm = makefiles->list[stdin_offset];
int r = 0;
stdin_offset = -1;
EINTRLOOP(r, unlink (nm));
if (r < 0 && errno != ENOENT && !handling_fatal_signal)
perror_with_name (_("unlink (temporary file): "), nm);
}
}
#ifdef MK_OS_ZOS
extern char **environ;
#endif
#if defined(_AMIGA) || defined(MK_OS_ZOS)
int
main (int argc, char **argv)
#else
@@ -1244,6 +1271,9 @@ main (int argc, char **argv, char **envp)
#endif
#ifdef SIGQUIT
FATAL_SIG (SIGQUIT);
#endif
#ifdef SIGPIPE
FATAL_SIG (SIGPIPE);
#endif
FATAL_SIG (SIGINT);
FATAL_SIG (SIGTERM);
@@ -1303,7 +1333,7 @@ main (int argc, char **argv, char **envp)
else
{
program = start + strlen (start);
while (program > start && ! STOP_SET (program[-1], MAP_DIRSEP))
while (program > start && ! ISDIRSEP (program[-1]))
--program;
/* Remove the .exe extension if present. */
@@ -1370,6 +1400,10 @@ main (int argc, char **argv, char **envp)
initialize_global_hash_tables ();
/* Ensure the temp directory is set up: we don't want the first time we use
it to be in a forked process. */
get_tmpdir ();
/* Figure out where we are. */
#ifdef WINDOWS32
@@ -1414,7 +1448,7 @@ main (int argc, char **argv, char **envp)
#endif
#ifdef MAKE_JOBSERVER
" jobserver"
# ifdef HAVE_MKFIFO
# if JOBSERVER_USE_FIFO
" jobserver-fifo"
# endif
#endif
@@ -1430,6 +1464,9 @@ main (int argc, char **argv, char **envp)
#ifdef MAKE_LOAD
" load"
#endif
#ifdef HAVE_DOS_PATHS
" dospaths"
#endif
#ifdef MAKE_MAINTAINER_MODE
" maintainer"
#endif
@@ -1445,6 +1482,10 @@ main (int argc, char **argv, char **envp)
done before $(MAKE) is figured out so its definitions will not be
from the environment. */
#ifdef MK_OS_ZOS
char **envp = environ;
#endif
#ifndef _AMIGA
{
unsigned int i;
@@ -1481,7 +1522,7 @@ main (int argc, char **argv, char **envp)
/* If this is MAKE_RESTARTS, check to see if the "already printed
the enter statement" flag is set. */
if (len == 13 && memcmp (envp[i], STRING_SIZE_TUPLE ("MAKE_RESTARTS")) == 0)
if (len == 13 && memcmp (envp[i], "MAKE_RESTARTS", CSTRLEN ("MAKE_RESTARTS")) == 0)
{
if (*ep == '-')
{
@@ -1550,13 +1591,16 @@ main (int argc, char **argv, char **envp)
/* Decode the switches. */
if (lookup_variable (STRING_SIZE_TUPLE (GNUMAKEFLAGS_NAME)))
{
decode_env_switches (STRING_SIZE_TUPLE (GNUMAKEFLAGS_NAME));
decode_env_switches (STRING_SIZE_TUPLE (GNUMAKEFLAGS_NAME), o_command);
/* Clear GNUMAKEFLAGS to avoid duplication. */
define_variable_cname (GNUMAKEFLAGS_NAME, "", o_env, 0);
}
decode_env_switches (STRING_SIZE_TUPLE (MAKEFLAGS_NAME));
/* Set MAKEFLAGS's origin to command line: in submakes MAKEFLAGS will carry
command line switches. This causes env variable MAKEFLAGS to beat
makefile modifications to MAKEFLAGS. */
decode_env_switches (STRING_SIZE_TUPLE (MAKEFLAGS_NAME), o_command);
#if 0
/* People write things like:
@@ -1577,7 +1621,7 @@ main (int argc, char **argv, char **envp)
int env_slots = arg_job_slots;
arg_job_slots = INVALID_JOB_SLOTS;
decode_switches (argc, (const char **)argv, 0);
decode_switches (argc, (const char **)argv, o_command);
argv_slots = arg_job_slots;
if (arg_job_slots == INVALID_JOB_SLOTS)
@@ -1657,14 +1701,6 @@ main (int argc, char **argv, char **envp)
/* Set always_make_flag if -B was given and we've not restarted already. */
always_make_flag = always_make_set && (restarts == 0);
/* If the user didn't specify any print-directory options, compute the
default setting: disable under -s / print in sub-makes and under -C. */
if (print_directory_flag == -1)
print_directory = !silent_flag && (directories != 0 || makelevel > 0);
else
print_directory = print_directory_flag;
/* If -R was given, set -r too (doesn't make sense otherwise!) */
if (no_builtin_variables_flag)
no_builtin_rules_flag = 1;
@@ -1745,7 +1781,7 @@ main (int argc, char **argv, char **envp)
But allow -C/ just in case someone wants that. */
{
char *p = (char *)dir + strlen (dir) - 1;
while (p > dir && (p[0] == '/' || p[0] == '\\'))
while (p > dir && ISDIRSEP (p[0]))
--p;
p[1] = '\0';
}
@@ -1790,6 +1826,10 @@ main (int argc, char **argv, char **envp)
define_variable_cname ("CURDIR", current_directory, o_file, 0);
/* Construct the list of include directories to search.
This will check for existence so it must be done after chdir. */
construct_include_path (include_dirs ? include_dirs->list : NULL);
/* Validate the arg_job_slots configuration before we define MAKEFLAGS so
users get an accurate value in their makefiles.
At this point arg_job_slots is the argv setting, if there is one, else
@@ -1881,7 +1921,7 @@ main (int argc, char **argv, char **envp)
allow the user's setting of MAKEOVERRIDES to affect MAKEFLAGS, so
a reference to this hidden variable is written instead. */
define_variable_cname ("MAKEOVERRIDES", "${-*-command-variables-*-}",
o_env, 1);
o_default, 1);
#ifdef VMS
vms_export_dcl_symbol ("MAKEOVERRIDES", "${-*-command-variables-*-}");
#endif
@@ -1906,9 +1946,10 @@ main (int argc, char **argv, char **envp)
_("Makefile from standard input specified twice"));
outfile = get_tmpfile (&newnm);
if (outfile == 0)
OSS (fatal, NILF,
_("fopen: temporary file %s: %s"), newnm, strerror (errno));
if (!outfile)
O (fatal, NILF,
_("cannot store makefile from stdin to a temporary file"));
while (!feof (stdin) && ! ferror (stdin))
{
char buf[2048];
@@ -1919,8 +1960,8 @@ main (int argc, char **argv, char **envp)
}
fclose (outfile);
/* Replace the name that read_all_makefiles will
see with the name of the temporary file. */
/* Replace the name that read_all_makefiles will see with the name
of the temporary file. */
makefiles->list[i] = strcache_add (newnm);
stdin_offset = i;
@@ -1965,7 +2006,7 @@ main (int argc, char **argv, char **envp)
# endif
}
#ifdef HAVE_PSELECT
#if defined(HAVE_PSELECT) && !defined(MK_OS_ZOS)
/* If we have pselect() then we need to block SIGCHLD so it's deferred. */
{
sigset_t block;
@@ -1987,19 +2028,12 @@ main (int argc, char **argv, char **envp)
/* Define the initial list of suffixes for old-style rules. */
set_default_suffixes ();
/* Define the file rules for the built-in suffix rules. These will later
be converted into pattern rules. We used to do this in
install_default_implicit_rules, but since that happens after reading
makefiles, it results in the built-in pattern rules taking precedence
over makefile-specified suffix rules, which is wrong. */
install_default_suffix_rules ();
/* Define some internal and special variables. */
define_automatic_variables ();
/* Set up the MAKEFLAGS and MFLAGS variables for makefiles to see.
Initialize it to be exported but allow the makefile to reset it. */
define_makeflags (0, 0)->export = v_export;
define_makeflags (0)->export = v_export;
/* Define the default variables. */
define_default_variables ();
@@ -2049,12 +2083,12 @@ main (int argc, char **argv, char **envp)
arg_job_slots = INVALID_JOB_SLOTS;
/* Decode switches again, for variables set by the makefile. */
decode_env_switches (STRING_SIZE_TUPLE (GNUMAKEFLAGS_NAME));
decode_env_switches (STRING_SIZE_TUPLE (GNUMAKEFLAGS_NAME), o_env);
/* Clear GNUMAKEFLAGS to avoid duplication. */
define_variable_cname (GNUMAKEFLAGS_NAME, "", o_override, 0);
decode_env_switches (STRING_SIZE_TUPLE (MAKEFLAGS_NAME));
decode_env_switches (STRING_SIZE_TUPLE (MAKEFLAGS_NAME), o_env);
#if 0
decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
#endif
@@ -2206,7 +2240,7 @@ main (int argc, char **argv, char **envp)
if (syncing)
{
/* If there a mutex we're the child, else we're the origin. */
/* If there is no mutex we're the base: create one. Else parse it. */
if (!sync_mutex)
{
osync_setup ();
@@ -2214,12 +2248,19 @@ main (int argc, char **argv, char **envp)
}
else if (!osync_parse_mutex (sync_mutex))
{
/* Parsing failed; continue without output sync. */
osync_clear ();
free (sync_mutex);
sync_mutex = NULL;
syncing = 0;
}
}
if (jobserver_auth)
DB (DB_VERBOSE|DB_JOBS, (_("Using jobserver controller %s\n"), jobserver_auth));
if (sync_mutex)
DB (DB_VERBOSE, (_("Using output-sync mutex %s\n"), sync_mutex));
#ifndef MAKE_SYMLINKS
if (check_symlink_flag)
{
@@ -2230,13 +2271,18 @@ main (int argc, char **argv, char **envp)
/* Set up MAKEFLAGS and MFLAGS again, so they will be right. */
define_makeflags (1, 0);
define_makeflags (0);
/* Make each 'struct goaldep' point at the 'struct file' for the file
depended on. Also do magic for special targets. */
snap_deps ();
/* Define the file rules for the built-in suffix rules. These will later
be converted into pattern rules. */
install_default_suffix_rules ();
/* Convert old-style suffix rules to pattern rules. It is important to
do this before installing the built-in pattern rules below, so that
makefile-specified suffix rules take precedence over built-in pattern
@@ -2294,6 +2340,9 @@ main (int argc, char **argv, char **envp)
OUTPUT_UNSET ();
output_close (&make_sync);
if (shuffle_mode)
DB (DB_BASIC, (_("Enabled shuffle mode: %s\n"), shuffle_mode));
if (read_files)
{
/* Update any makefiles if necessary. */
@@ -2387,7 +2436,7 @@ main (int argc, char **argv, char **envp)
}
/* Set up 'MAKEFLAGS' specially while remaking makefiles. */
define_makeflags (1, 1);
define_makeflags (1);
{
int orig_db_level = db_level;
@@ -2558,13 +2607,11 @@ main (int argc, char **argv, char **envp)
for (; *av; ++av, ++nv)
{
size_t len;
char *f;
char *a = *av;
const char *mf = makefiles->list[mfidx];
len = strlen (a);
assert (len > 0);
assert (strlen (a) > 0);
*nv = a;
@@ -2729,6 +2776,8 @@ main (int argc, char **argv, char **envp)
fflush (stdout);
fflush (stderr);
osync_clear();
/* The exec'd "child" will be another make, of course. */
jobserver_pre_child(1);
@@ -2750,7 +2799,7 @@ main (int argc, char **argv, char **envp)
child.output.syncout = 0;
child.environment = environ;
pid = child_execute_job (&child, 1, nargv);
pid = child_execute_job (&child, 1, (char **)nargv);
/* is this loop really necessary? */
do {
@@ -2769,9 +2818,7 @@ main (int argc, char **argv, char **envp)
#endif
jobserver_post_child(1);
/* Get rid of any stdin temp file. */
if (stdin_offset >= 0)
unlink (makefiles->list[stdin_offset]);
temp_stdin_unlink ();
_exit (127);
}
@@ -2781,7 +2828,7 @@ main (int argc, char **argv, char **envp)
}
/* Set up 'MAKEFLAGS' again for the normal targets. */
define_makeflags (1, 0);
define_makeflags (0);
/* Set always_make_flag if -B was given. */
always_make_flag = always_make_set;
@@ -2797,15 +2844,7 @@ main (int argc, char **argv, char **envp)
}
}
/* If there is a temp file from reading a makefile from stdin, get rid of
it now. */
if (stdin_offset >= 0)
{
const char *nm = makefiles->list[stdin_offset];
if (unlink (nm) < 0 && errno != ENOENT)
perror_with_name (_("unlink (temporary file): "), nm);
stdin_offset = -1;
}
temp_stdin_unlink ();
/* If there were no command-line goals, use the default. */
if (goals == 0)
@@ -2977,7 +3016,7 @@ init_switches (void)
/* Non-option argument. It might be a variable definition. */
static void
handle_non_switch_argument (const char *arg, int env)
handle_non_switch_argument (const char *arg, enum variable_origin origin)
{
struct variable *v;
@@ -3010,7 +3049,7 @@ handle_non_switch_argument (const char *arg, int env)
}
}
#endif
v = try_variable_definition (0, arg, o_command, 0);
v = try_variable_definition (0, arg, origin, 0);
if (v != 0)
{
/* It is indeed a variable definition. If we don't already have this
@@ -3030,11 +3069,12 @@ handle_non_switch_argument (const char *arg, int env)
command_variables = cv;
}
}
else if (! env)
else if (arg[0] != '\0' && origin == o_command)
{
/* Not an option or variable definition; it must be a goal
target! Enter it as a file and add it to the dep chain of
goals. */
/* Not an option or variable definition; it must be a goal target.
Enter it as a file and add it to the dep chain of goals.
Check ARG[0] because if the top makefile resets MAKEOVERRIDES
then ARG points to an empty string in the submake. */
struct file *f = enter_file (strcache_add (expand_command_line_file (arg)));
f->cmd_target = 1;
@@ -3078,14 +3118,23 @@ handle_non_switch_argument (const char *arg, int env)
}
}
/* Called if the makefile resets the MAKEFLAGS variable. */
void
reset_makeflags (enum variable_origin origin)
{
decode_env_switches (STRING_SIZE_TUPLE(MAKEFLAGS_NAME), origin);
construct_include_path (include_dirs ? include_dirs->list : NULL);
define_makeflags (rebuilding_makefiles);
}
/* Decode switches from ARGC and ARGV.
They came from the environment if ENV is nonzero. */
They came from the environment if ORIGIN is o_env. */
static void
decode_switches (int argc, const char **argv, int env)
decode_switches (int argc, const char **argv, enum variable_origin origin)
{
int bad = 0;
const struct command_switch *cs;
struct command_switch *cs;
struct stringlist *sl;
int c;
@@ -3096,7 +3145,7 @@ decode_switches (int argc, const char **argv, int env)
/* Let getopt produce error messages for the command line,
but not for options from the environment. */
opterr = !env;
opterr = origin == o_command;
/* Reset getopt's state. */
optind = 0;
@@ -3112,7 +3161,7 @@ decode_switches (int argc, const char **argv, int env)
break;
else if (c == 1)
/* An argument not starting with a dash. */
handle_non_switch_argument (coptarg, env);
handle_non_switch_argument (coptarg, origin);
else if (c == '?')
/* Bad option. We will print a usage message and die later.
But continue to parse the other options so the user can
@@ -3126,7 +3175,12 @@ decode_switches (int argc, const char **argv, int env)
this switch. We test this individually inside the
switch below rather than just once outside it, so that
options which are to be ignored still consume args. */
int doit = !env || cs->env;
int doit = (origin == o_command
|| (cs->env &&
(cs->origin == NULL || origin >= *cs->origin)));
if (doit)
cs->specified = 1;
switch (cs->type)
{
@@ -3139,7 +3193,11 @@ decode_switches (int argc, const char **argv, int env)
case flag:
case flag_off:
if (doit)
*(int *) cs->value_ptr = cs->type == flag;
{
*(int *) cs->value_ptr = cs->type == flag;
if (cs->origin)
*cs->origin = origin;
}
break;
case string:
@@ -3172,6 +3230,8 @@ decode_switches (int argc, const char **argv, int env)
char **val = (char **)cs->value_ptr;
free (*val);
*val = xstrdup (coptarg);
if (cs->origin)
*cs->origin = origin;
break;
}
@@ -3205,7 +3265,11 @@ decode_switches (int argc, const char **argv, int env)
}
if (cs->type == strlist)
sl->list[sl->idx++] = xstrdup (coptarg);
{
sl->list[sl->idx++] = xstrdup (coptarg);
if (cs->origin)
*cs->origin = origin;
}
else if (cs->c == TEMP_STDIN_OPT)
{
if (stdin_offset > 0)
@@ -3213,9 +3277,15 @@ decode_switches (int argc, const char **argv, int env)
/* We don't need to expand the temp file. */
stdin_offset = sl->idx;
sl->list[sl->idx++] = strcache_add (coptarg);
if (cs->origin)
*cs->origin = origin;
}
else
sl->list[sl->idx++] = expand_command_line_file (coptarg);
{
sl->list[sl->idx++] = expand_command_line_file (coptarg);
if (cs->origin)
*cs->origin = origin;
}
sl->list[sl->idx] = 0;
break;
@@ -3247,11 +3317,19 @@ decode_switches (int argc, const char **argv, int env)
bad = 1;
}
else
*(unsigned int *) cs->value_ptr = i;
{
*(unsigned int *) cs->value_ptr = i;
if (cs->origin)
*cs->origin = origin;
}
}
else
*(unsigned int *) cs->value_ptr
= *(unsigned int *) cs->noarg_value;
{
*(unsigned int *) cs->value_ptr
= *(unsigned int *) cs->noarg_value;
if (cs->origin)
*cs->origin = origin;
}
break;
case floating:
@@ -3260,8 +3338,12 @@ decode_switches (int argc, const char **argv, int env)
coptarg = argv[optind++];
if (doit)
*(double *) cs->value_ptr = (coptarg != 0 ? atof (coptarg)
: *(double *) cs->noarg_value);
{
*(double *) cs->value_ptr = (coptarg != 0 ? atof (coptarg)
: *(double *) cs->noarg_value);
if (cs->origin)
*cs->origin = origin;
}
break;
}
@@ -3276,9 +3358,9 @@ decode_switches (int argc, const char **argv, int env)
to be returned in order, this only happens when there is a "--"
argument to prevent later arguments from being options. */
while (optind < argc)
handle_non_switch_argument (argv[optind++], env);
handle_non_switch_argument (argv[optind++], origin);
if (bad && !env)
if (bad && origin == o_command)
print_usage (bad);
/* If there are any options that need to be decoded do it now. */
@@ -3287,9 +3369,6 @@ decode_switches (int argc, const char **argv, int env)
/* Perform any special switch handling. */
run_silent = silent_flag;
/* Construct the list of include directories to search. */
construct_include_path (include_dirs ? include_dirs->list : NULL);
}
/* Decode switches from environment variable ENVAR (which is LEN chars long).
@@ -3297,8 +3376,8 @@ decode_switches (int argc, const char **argv, int env)
dash to the first word if it lacks one, and passing the vector to
decode_switches. */
void
decode_env_switches (const char *envar, size_t len)
static void
decode_env_switches (const char *envar, size_t len, enum variable_origin origin)
{
char *varref = alloca (2 + len + 2);
char *value, *p, *buf;
@@ -3360,7 +3439,7 @@ decode_env_switches (const char *envar, size_t len)
argv[1] = buf;
/* Parse those words. */
decode_switches (argc, argv, 1);
decode_switches (argc, argv, origin);
}
/* Quote the string IN so that it will be interpreted as a single word with
@@ -3385,11 +3464,11 @@ quote_for_env (char *out, const char *in)
}
/* Define the MAKEFLAGS and MFLAGS variables to reflect the settings of the
command switches. Include options with args if ALL is nonzero.
command switches. Always include options with args.
Don't include options with the 'no_makefile' flag set if MAKEFILE. */
static struct variable *
define_makeflags (int all, int makefile)
struct variable *
define_makeflags (int makefile)
{
const char ref[] = "MAKEOVERRIDES";
const char posixref[] = "-*-command-variables-*-";
@@ -3445,7 +3524,7 @@ define_makeflags (int all, int makefile)
case flag:
case flag_off:
if ((!*(int *) cs->value_ptr) == (cs->type == flag_off)
&& (cs->default_value == 0
&& (cs->default_value == NULL || cs->specified
|| *(int *) cs->value_ptr != *(int *) cs->default_value))
ADD_FLAG (0, 0);
break;
@@ -3574,25 +3653,24 @@ define_makeflags (int all, int makefile)
p = mempcpy (p, evalref, CSTRLEN (evalref));
}
if (all)
{
/* If there are any overrides to add, write a reference to
$(MAKEOVERRIDES), which contains command-line variable definitions.
Separate the variables from the switches with a "--" arg. */
{
/* If there are any overrides to add, write a reference to
$(MAKEOVERRIDES), which contains command-line variable definitions.
Separate the variables from the switches with a "--" arg. */
const char *r = posix_pedantic ? posixref : ref;
size_t l = strlen (r);
v = lookup_variable (r, l);
const char *r = posix_pedantic ? posixref : ref;
size_t l = strlen (r);
v = lookup_variable (r, l);
if (v && v->value && v->value[0] != '\0')
{
p = stpcpy (p, " -- ");
*(p++) = '$';
*(p++) = '(';
p = mempcpy (p, r, l);
*(p++) = ')';
}
}
if (v && v->value && v->value[0] != '\0')
{
p = stpcpy (p, " -- ");
*(p++) = '$';
*(p++) = '(';
p = mempcpy (p, r, l);
*(p++) = ')';
}
}
/* If there is a leading dash, omit it. */
if (flagstring[0] == '-')
@@ -3610,6 +3688,19 @@ define_makeflags (int all, int makefile)
return v;
}
/* Return 1 if the working directory change message should be printed.
Otherwise, return 0. */
int
should_print_dir (void)
{
if (print_directory_flag >= 0)
return print_directory_flag;
/* If the user didn't specify any print-directory options, compute the
default setting: disable under -s / print in sub-makes and under -C. */
return !silent_flag && (makelevel > 0 || directories != NULL);
}
/* Print version information. */
@@ -3637,7 +3728,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-2022 Free Software Foundation, Inc.\n",
printf ("%sCopyright (C) 1988-2023 Free Software Foundation, Inc.\n",
precede);
printf (_("%sLicense GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>\n\
@@ -3724,13 +3815,7 @@ die (int status)
print_version ();
/* Get rid of a temp file from reading a makefile from stdin. */
if (stdin_offset >= 0)
{
const char *nm = makefiles->list[stdin_offset];
if (unlink (nm) < 0 && errno != ENOENT)
perror_with_name (_("unlink (temporary file): "), nm);
stdin_offset = -1;
}
temp_stdin_unlink ();
/* Wait for children to die. */
err = (status != 0);

View File

@@ -1,5 +1,5 @@
/* Miscellaneous global declarations and portability cruft for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,34 +12,12 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
/* We use <config.h> instead of "config.h" so that a compilation
using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
(which it would do because makeint.h was found in $srcdir). */
#include <config.h>
#undef HAVE_CONFIG_H
#define HAVE_CONFIG_H 1
/* Specify we want GNU source code. This must be defined before any
system headers are included. */
#define _GNU_SOURCE 1
/* AIX requires this to be the first thing in the file. */
#if HAVE_ALLOCA_H
# include <alloca.h>
#else
# ifdef _AIX
#pragma alloca
# else
# if !defined(__GNUC__) && !defined(WINDOWS32)
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
#endif
/* Some versions of GCC (e.g., 10.x) set the warn_unused_result attribute on
__builtin_alloca. This causes alloca(0) to fail and is not easily worked
@@ -82,7 +60,6 @@ char *alloca ();
# define __NO_STRING_INLINES
#endif
#include <stddef.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <signal.h>
@@ -105,6 +82,17 @@ char *alloca ();
extern int errno;
#endif
/* Define macros specifying which OS we are building for. */
#if __gnu_hurd__
# define MK_OS_HURD 1
#endif
#if __CYGWIN__
# define MK_OS_CYGWIN 1
#endif
#if defined(__MVS__)
# define MK_OS_ZOS 1
#endif
#ifdef __VMS
/* In strict ANSI mode, VMS compilers should not be defining the
VMS macro. Define it here instead of a bulk edit for the correct code.
@@ -152,13 +140,14 @@ extern int errno;
#endif
#ifndef PATH_MAX
# ifndef POSIX
# ifdef MAXPATHLEN
# define PATH_MAX MAXPATHLEN
# else
/* Some systems (HURD) have fully dynamic pathnames with no maximum.
Ideally we'd support this but it will take some work. */
# define PATH_MAX 4096
# endif
#endif
#ifndef MAXPATHLEN
# define MAXPATHLEN 1024
#endif
#ifdef PATH_MAX
# define GET_PATH_MAX PATH_MAX
@@ -250,8 +239,6 @@ extern int vms_unix_simulation;
# ifdef HAVE_STRING_H
# include <string.h>
# define ANSI_STRING 1
# else
# include <strings.h>
# endif
# ifdef HAVE_MEMORY_H
# include <memory.h>
@@ -294,6 +281,25 @@ char *strerror (int errnum);
#if HAVE_STDINT_H
# include <stdint.h>
#endif
#if HAVE_STRINGS_H
# include <strings.h> /* Needed for strcasecmp / strncasecmp. */
#endif
#if defined _MSC_VER || defined __MINGW32__
# define MK_PRI64_PREFIX "I64"
#else
# define MK_PRI64_PREFIX "ll"
#endif
#ifndef PRIdMAX
# define PRIdMAX MK_PRI64_PREFIX "d"
#endif
#ifndef PRIuMAX
# define PRIuMAX MK_PRI64_PREFIX "u"
#endif
#ifndef SCNdMAX
# define SCNdMAX PRIdMAX
#endif
#define FILE_TIMESTAMP uintmax_t
#if !defined(HAVE_STRSIGNAL)
@@ -390,7 +396,9 @@ extern int unixy_shell;
# endif
/* Include only the minimal stuff from windows.h. */
# define WIN32_LEAN_AND_MEAN
# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
# endif
#endif /* WINDOWS32 */
/* ALL_SET() evaluates the second argument twice. */
@@ -398,6 +406,7 @@ extern int unixy_shell;
#define NONE_SET(_v,_m) (! ANY_SET ((_v),(_m)))
#define ALL_SET(_v,_m) (((_v)&(_m)) == (_m))
/* Bitmasks for the STOPCHAR array. */
#define MAP_NUL 0x0001
#define MAP_BLANK 0x0002 /* space, TAB */
#define MAP_NEWLINE 0x0004
@@ -447,6 +456,7 @@ extern int unixy_shell;
# define MAP_PATHSEP MAP_SEMI
#elif PATH_SEPARATOR_CHAR == ','
# define MAP_PATHSEP MAP_COMMA
#else
# error "Unknown PATH_SEPARATOR_CHAR"
#endif
@@ -462,6 +472,18 @@ extern int unixy_shell;
/* Move S past all whitespace (including newlines). */
#define NEXT_TOKEN(s) while (ISSPACE (*(s))) ++(s)
/* True if C is a directory separator on the current system. */
#define ISDIRSEP(c) STOP_SET((c),MAP_DIRSEP)
/* True if S starts with a drive specifier. */
#if defined(HAVE_DOS_PATHS)
# define HAS_DRIVESPEC(_s) ((((_s)[0] >= 'a' && (_s)[0] <= 'z') \
|| ((_s)[0] >= 'A' && (_s)[0] <= 'Z')) \
&& (_s)[1] == ':')
#else
# define HAS_DRIVESPEC(_s) 0
#endif
/* 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
@@ -477,6 +499,8 @@ extern struct rlimit stack_limit;
/* Number of characters in a string constant. Does NOT include the \0 byte. */
#define CSTRLEN(_s) (sizeof (_s)-1)
/* Only usable when NOT calling a macro: only use it for local functions. */
#define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s)
/* The number of bytes needed to represent the largest signed and unsigned
@@ -492,6 +516,15 @@ extern struct rlimit stack_limit;
# define TTYNAME(_f) DEFAULT_TTYNAME
#endif
#ifdef VMS
# define DEFAULT_TMPDIR "/sys$scratch/"
#elif defined(P_tmpdir)
# define DEFAULT_TMPDIR P_tmpdir
#else
# define DEFAULT_TMPDIR "/tmp"
#endif
struct file;
@@ -511,7 +544,7 @@ void error (const floc *flocp, size_t length, const char *fmt, ...)
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 () NORETURN;
void out_of_memory (void) NORETURN;
/* When adding macros to this list be sure to update the value of
XGETTEXT_OPTIONS in the po/Makevars file. */
@@ -529,13 +562,23 @@ void out_of_memory () NORETURN;
#define ONS(_t,_a,_f,_n,_s) _t((_a), INTSTR_LENGTH + strlen (_s), \
(_f), (_n), (_s))
void decode_env_switches (const char*, size_t line);
enum variable_origin;
struct variable;
void reset_makeflags (enum variable_origin origin);
struct variable *define_makeflags (int makefile);
int should_print_dir (void);
void temp_stdin_unlink (void);
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))
unsigned int make_toui (const char*, const char**);
pid_t make_pid ();
char *make_lltoa (long long, char *);
char *make_ulltoa (unsigned long long, char *);
void make_seed (unsigned int);
unsigned int make_rand (void);
pid_t make_pid (void);
void *xmalloc (size_t);
void *xcalloc (size_t);
void *xrealloc (void *, size_t);
@@ -550,7 +593,7 @@ int alpha_compare (const void *, const void *);
void print_spaces (unsigned int);
char *find_percent (char *);
const char *find_percent_cached (const char **);
char *get_tmppath ();
const char *get_tmpdir (void);
int get_tmpfd (char **);
FILE *get_tmpfile (char **);
ssize_t writebuf (int, const void *, size_t);
@@ -566,13 +609,14 @@ void ar_parse_name (const char *, char **, char **);
int ar_touch (const char *);
time_t ar_member_date (const char *);
typedef long int (*ar_member_func_t) (int desc, const char *mem, int truncated,
typedef intmax_t (*ar_member_func_t) (int desc, const char *mem, int truncated,
long int hdrpos, long int datapos,
long int size, long int date, int uid,
long int size, intmax_t date, int uid,
int gid, unsigned int mode,
const void *arg);
long int ar_scan (const char *archive, ar_member_func_t function, const void *arg);
intmax_t ar_scan (const char *archive, ar_member_func_t function,
const void *arg);
int ar_name_equal (const char *name, const char *mem, int truncated);
#ifndef VMS
int ar_member_touch (const char *arname, const char *memname);
@@ -625,8 +669,12 @@ int unload_file (const char *name);
#ifdef MAKE_MAINTAINER_MODE
# define SPIN(_s) spin (_s)
void spin (const char* suffix);
# define DBG(_f) dbg _f
void dbg (const char *fmt, ...);
#else
# define SPIN(_s)
/* Never put this code into Git or a release. */
# define DBG(_f) compile-error
#endif
/* We omit these declarations on non-POSIX systems which define _POSIX_VERSION,
@@ -640,10 +688,10 @@ long int lseek ();
# ifdef HAVE_GETCWD
# if !defined(VMS) && !defined(__DECC)
char *getcwd ();
char *getcwd (void);
# endif
# else
char *getwd ();
char *getwd (void);
# define getcwd(buf, len) getwd (buf)
# endif
@@ -654,9 +702,6 @@ char *getwd ();
# define strcasecmp stricmp
# elif HAVE_STRCMPI
# define strcasecmp strcmpi
# else
/* Create our own, in misc.c */
int strcasecmp (const char *s1, const char *s2);
# endif
#endif
@@ -665,22 +710,9 @@ int strcasecmp (const char *s1, const char *s2);
# define strncasecmp strnicmp
# elif HAVE_STRNCMPI
# define strncasecmp strncmpi
# else
/* Create our own, in misc.c */
int strncasecmp (const char *s1, const char *s2, int n);
# endif
#endif
#if !HAVE_MEMPCPY
/* Create our own, in misc.c */
void *mempcpy (void *dest, const void *src, size_t n);
#endif
#if !HAVE_STPCPY
/* Create our own, in misc.c */
char *stpcpy (char *dest, const char *src);
#endif
#define OUTPUT_SYNC_NONE 0
#define OUTPUT_SYNC_LINE 1
#define OUTPUT_SYNC_TARGET 2
@@ -697,7 +729,7 @@ extern unsigned short stopchar_map[];
extern int just_print_flag, run_silent, ignore_errors_flag, keep_going_flag;
extern int print_data_base_flag, question_flag, touch_flag, always_make_flag;
extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag;
extern int print_version_flag, print_directory, check_symlink_flag;
extern int print_version_flag, check_symlink_flag;
extern int warn_undefined_variables_flag, posix_pedantic;
extern int not_parallel, second_expansion, clock_skew_detected;
extern int rebuilding_makefiles, one_shell, output_sync, verify_flag;
@@ -716,6 +748,16 @@ extern int batch_mode_shell;
#define RECIPEPREFIX_DEFAULT '\t'
extern char cmd_prefix;
extern unsigned int no_intermediates;
#if HAVE_MKFIFO
/* It seems that mkfifo() is not working correctly, or at least not the way
GNU make wants it to work, on GNU/Hurd and Cygwin so don't use it there. */
# if !defined(JOBSERVER_USE_FIFO) && !MK_OS_HURD && !MK_OS_CYGWIN
# define JOBSERVER_USE_FIFO 1
# endif
#endif
#define JOBSERVER_AUTH_OPT "jobserver-auth"
extern char *jobserver_auth;
@@ -771,7 +813,7 @@ extern char *version_string, *remote_description, *make_host;
extern unsigned int commands_started;
extern int handling_fatal_signal;
extern volatile sig_atomic_t handling_fatal_signal;
#ifndef MIN
#define MIN(_a,_b) ((_a)<(_b)?(_a):(_b))

View File

@@ -1,5 +1,5 @@
/* Miscellaneous generic support functions for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "filedef.h"
@@ -20,8 +20,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "os.h"
#include "debug.h"
/* GNU make no longer supports pre-ANSI89 environments. */
#include <assert.h>
#include <stdarg.h>
#ifdef WINDOWS32
@@ -29,6 +28,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
# include <io.h>
#endif
#ifdef __EMX__
# define INCL_DOS
# include <os2.h>
#endif
#ifdef HAVE_FCNTL_H
# include <fcntl.h>
#else
@@ -54,6 +58,52 @@ make_toui (const char *str, const char **error)
return val;
}
/* Convert val into a string, written to buf. buf must be large enough
to hold the largest possible value, plus a nul byte. Returns buf.
We can't use standard PRI* here: those are based on intNN_t types. */
char *
make_lltoa (long long val, char *buf)
{
sprintf (buf, "%" MK_PRI64_PREFIX "d", val);
return buf;
}
char *
make_ulltoa (unsigned long long val, char *buf)
{
sprintf (buf, "%" MK_PRI64_PREFIX "u", val);
return buf;
}
/* Simple random number generator, for use with shuffle.
This doesn't need to be truly random, just pretty random. Use our own
implementation rather than relying on the C runtime's rand() so we always
get the same results for a given seed, regardless of C runtime. */
static unsigned int mk_state = 0;
void
make_seed (unsigned int seed)
{
mk_state = seed;
}
unsigned int
make_rand ()
{
/* mk_state must never be 0. */
if (mk_state == 0)
mk_state = (unsigned int)(time (NULL) ^ make_pid ()) + 1;
/* A simple xorshift RNG. */
mk_state ^= mk_state << 13;
mk_state ^= mk_state >> 17;
mk_state ^= mk_state << 5;
return mk_state;
}
/* Compare strings *S1 and *S2.
Return negative if the first is less, positive if it is greater,
zero if they are equal. */
@@ -113,7 +163,7 @@ collapse_continuations (char *line)
if (i & 1)
{
/* Backslash/newline handling:
In traditional GNU make all trailing whitespace, consecutive
In traditional GNU Make all trailing whitespace, consecutive
backslash/newlines, and any leading non-newline whitespace on the
next line is reduced to a single space.
In POSIX, each backslash/newline and is replaced by a space. */
@@ -484,6 +534,22 @@ spin (const char* type)
}
}
void
dbg (const char *fmt, ...)
{
FILE *fp = fopen ("/tmp/gmkdebug.log", "a+");
va_list args;
char buf[4096];
va_start (args, fmt);
vsprintf (buf, fmt, args);
va_end (args);
fprintf(fp, "%u: %s\n", (unsigned) make_pid (), buf);
fflush (fp);
fclose (fp);
}
#endif
@@ -506,33 +572,49 @@ umask (mode_t mask)
}
#endif
#define MAKE_TMPDIR "MAKE_TMPDIR"
#ifdef VMS
# define DEFAULT_TMPFILE "sys$scratch:gnv$make_cmdXXXXXX.com"
# define DEFAULT_TMPDIR "/sys$scratch/"
#else
# define DEFAULT_TMPFILE "GmXXXXXX"
# ifdef P_tmpdir
# define DEFAULT_TMPDIR P_tmpdir
# else
# define DEFAULT_TMPDIR "/tmp"
# endif
# define DEFAULT_TMPFILE "GmXXXXXX"
#endif
static const char *
const char *
get_tmpdir ()
{
static const char *tmpdir = NULL;
if (!tmpdir)
{
if (((tmpdir = getenv (MAKE_TMPDIR)) == NULL || *tmpdir == '\0')
#if defined (__MSDOS__) || defined (WINDOWS32) || defined (__EMX__)
&& ((tmpdir = getenv ("TMP")) == NULL || *tmpdir == '\0')
&& ((tmpdir = getenv ("TEMP")) == NULL || *tmpdir == '\0')
# define TMP_EXTRAS "TMP", "TEMP",
#else
# define TMP_EXTRAS
#endif
&& ((tmpdir = getenv ("TMPDIR")) == NULL || *tmpdir == '\0'))
tmpdir = DEFAULT_TMPDIR;
const char *tlist[] = { "MAKE_TMPDIR", "TMPDIR", TMP_EXTRAS NULL };
const char **tp;
unsigned int found = 0;
for (tp = tlist; *tp; ++tp)
if ((tmpdir = getenv (*tp)) && *tmpdir != '\0')
{
struct stat st;
int r;
found = 1;
EINTRLOOP(r, stat (tmpdir, &st));
if (r < 0)
OSSS (error, NILF,
_("%s value %s: %s"), *tp, tmpdir, strerror (errno));
else if (! S_ISDIR (st.st_mode))
OSS (error, NILF,
_("%s value %s: not a directory"), *tp, tmpdir);
else
return tmpdir;
}
tmpdir = DEFAULT_TMPDIR;
if (found)
OS (error, NILF, _("using default temporary directory '%s'"), tmpdir);
}
return tmpdir;
@@ -543,47 +625,58 @@ get_tmptemplate ()
{
const char *tmpdir = get_tmpdir ();
char *template;
size_t len;
char *cp;
len = strlen (tmpdir);
template = xmalloc (len + CSTRLEN (DEFAULT_TMPFILE) + 2);
strcpy (template, tmpdir);
template = xmalloc (strlen (tmpdir) + CSTRLEN (DEFAULT_TMPFILE) + 2);
cp = stpcpy (template, tmpdir);
#ifdef HAVE_DOS_PATHS
if (template[len - 1] != '/' && template[len - 1] != '\\')
strcat (template, "/");
#else
# ifndef VMS
if (template[len - 1] != '/')
strcat (template, "/");
# endif /* !VMS */
#endif /* !HAVE_DOS_PATHS */
#if !defined VMS
/* It's not possible for tmpdir to be empty. */
if (! ISDIRSEP (cp[-1]))
*(cp++) = '/';
#endif
strcat (template, DEFAULT_TMPFILE);
strcpy (cp, DEFAULT_TMPFILE);
return template;
}
char *
#if !HAVE_MKSTEMP || !HAVE_FDOPEN
/* Generate a temporary filename. This is not safe as another program could
snipe our filename after we've generated it: use this only on systems
without more secure alternatives. */
static char *
get_tmppath ()
{
char *path;
#ifdef HAVE_MKTEMP
path = get_tmptemplate();
# ifdef HAVE_MKTEMP
path = get_tmptemplate ();
if (*mktemp (path) == '\0')
pfatal_with_name ("mktemp");
#else
{
OSS (error, NILF,
_("cannot generate temp path from %s: %s"), path, strerror (errno));
return NULL;
}
# else
path = xmalloc (L_tmpnam + 1);
if (tmpnam (path) == NULL)
pfatal_with_name ("tmpnam");
#endif
{
OS (error, NILF,
_("cannot generate temp name: %s"), strerror (errno));
return NULL;
}
# endif
return path;
}
#endif
/* Generate a temporary file and return an fd for it. If name is NULL then
the temp file is anonymous and will be deleted when the process exits. */
the temp file is anonymous and will be deleted when the process exits. If
name is not null then *name will point to an allocated buffer, or set to
NULL on failure. */
int
get_tmpfd (char **name)
{
@@ -591,15 +684,18 @@ get_tmpfd (char **name)
char *tmpnm;
mode_t mask;
/* If there's an os-specific way to get an anoymous temp file use it. */
if (!name)
if (name)
*name = NULL;
else
{
/* If there's an os-specific way to get an anonymous temp file use it. */
fd = os_anontmp ();
if (fd >= 0)
return fd;
}
/* Preserve the current umask, and set a restrictive one for temp files. */
/* Preserve the current umask, and set a restrictive one for temp files.
Only really needed for mkstemp() but won't hurt for the open method. */
mask = umask (0077);
#if defined(HAVE_MKSTEMP)
@@ -609,55 +705,121 @@ get_tmpfd (char **name)
EINTRLOOP (fd, mkstemp (tmpnm));
#else
tmpnm = get_tmppath ();
if (!tmpnm)
return -1;
/* Can't use mkstemp(), but try to guard against a race condition. */
EINTRLOOP (fd, open (tmpnm, O_CREAT|O_EXCL|O_RDWR, 0600));
#endif
umask (mask);
if (fd < 0)
{
OSS (error, NILF,
_("cannot create temporary file %s: %s"), tmpnm, strerror (errno));
free (tmpnm);
return -1;
}
if (name)
*name = tmpnm;
else
{
unlink (tmpnm);
int r;
EINTRLOOP (r, unlink (tmpnm));
if (r < 0)
OSS (error, NILF,
_("cannot unlink temporary file %s: %s"), tmpnm, strerror (errno));
free (tmpnm);
}
umask (mask);
return fd;
}
/* Return a FILE* for a temporary file, opened in the safest way possible.
Set name to point to an allocated buffer containing the name of the file,
or NULL on failure. Note, name cannot be NULL! */
FILE *
get_tmpfile (char **name)
{
#if defined(HAVE_FDOPEN)
int fd = get_tmpfd (name);
/* Be consistent with tmpfile, which opens as if by "wb+". */
const char *tmpfile_mode = "wb+";
FILE *file;
return fd < 0 ? NULL : fdopen (fd, "w");
#if defined(HAVE_FDOPEN)
int fd;
assert (name);
fd = get_tmpfd (name);
if (fd < 0)
return NULL;
assert (*name);
ENULLLOOP (file, fdopen (fd, tmpfile_mode));
if (file == NULL)
OSS (error, NILF,
_("fdopen: temporary file %s: %s"), *name, strerror (errno));
#else
/* Preserve the current umask, and set a restrictive one for temp files. */
mode_t mask = umask (0077);
char *tmpnm = get_tmppath ();
assert (name);
*name = get_tmppath ();
if (!*name)
return NULL;
/* Not secure, but...? If name is NULL we could use tmpfile()... */
FILE *file = fopen (tmpnm, "w");
/* Although this fopen is insecure, it is executed only on non-fdopen
platforms, which should be a rarity nowadays. */
umask (mask);
if (name)
*name = tmpnm;
else
ENULLLOOP (file, fopen (*name, tmpfile_mode));
if (file == NULL)
{
unlink (tmpnm);
free (tmpnm);
OSS (error, NILF,
_("fopen: temporary file %s: %s"), *name, strerror (errno));
free (*name);
*name = NULL;
}
return file;
umask (mask);
#endif
return file;
}
#if HAVE_TTYNAME && defined(__EMX__)
/* OS/2 kLIBC has a declaration for ttyname(), so configure finds it.
But, it is not implemented! Roll our own. */
char *ttyname (int fd)
{
ULONG type;
ULONG attr;
ULONG rc;
rc = DosQueryHType (fd, &type, &attr);
if (rc)
{
errno = EBADF;
return NULL;
}
if (type == HANDTYPE_DEVICE)
{
if (attr & 3) /* 1 = KBD$, 2 = SCREEN$ */
return (char *) "/dev/con";
if (attr & 4) /* 4 = NUL */
return (char *) "/dev/nul";
if (attr & 8) /* 8 = CLOCK$ */
return (char *) "/dev/clock$";
}
errno = ENOTTY;
return NULL;
}
#endif
#if !HAVE_STRCASECMP && !HAVE_STRICMP && !HAVE_STRCMPI
/* If we don't have strcasecmp() (from POSIX), or anything that can substitute
for it, define our own version. */
@@ -688,7 +850,7 @@ strcasecmp (const char *s1, const char *s2)
substitute for it, define our own version. */
int
strncasecmp (const char *s1, const char *s2, int n)
strncasecmp (const char *s1, const char *s2, size_t n)
{
while (n-- > 0)
{
@@ -719,11 +881,11 @@ get_path_max (void)
if (value == 0)
{
long int x = pathconf ("/", _PC_PATH_MAX);
long x = pathconf ("/", _PC_PATH_MAX);
if (x > 0)
value = x;
value = (unsigned int) x;
else
return MAXPATHLEN;
value = PATH_MAX;
}
return value;

36
src/mkconfig.h.in Normal file
View File

@@ -0,0 +1,36 @@
/* Autoconf values for use on non-POSIX systems.
Copyright (C) 2022-2023 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 <https://www.gnu.org/licenses/>. */
/* Name of package */
#define PACKAGE "@PACKAGE@"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
/* Define to the full name of this package. */
#define PACKAGE_NAME "@PACKAGE_NAME@"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "@PACKAGE_NAME@ @PACKAGE_VERSION@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "@PACKAGE_TARNAME@"
/* Define to the home page for this package. */
#define PACKAGE_URL "@PACKAGE_URL@"
/* Define to the version of this package. */
#define PACKAGE_VERSION "@PACKAGE_VERSION@"

65
src/mkcustom.h Normal file
View File

@@ -0,0 +1,65 @@
/* Miscellaneous global declarations and portability cruft for GNU Make.
Copyright (C) 2023 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 <https://www.gnu.org/licenses/>. */
/*
This file is included at the end of config.h
That means it's included _everywhere_ as the first thing,
INCLUDING content imported from gnulib. BE AWARE!!
*/
#undef HAVE_CONFIG_H
#define HAVE_CONFIG_H 1
/* Specify we want GNU source code. This must be defined before any
system headers are included. */
#define _GNU_SOURCE 1
/* AIX requires this to be the first thing in the file. */
#if HAVE_ALLOCA_H
# include <alloca.h>
#else
# ifdef _AIX
#pragma alloca
# else
# if !defined(__GNUC__) && !defined(WINDOWS32)
# ifndef alloca /* predefined by HP cc +Olibcalls */
char *alloca ();
# endif
# endif
# endif
#endif
/* Declare function prototypes for src/misc.c functions if needed. */
#include <stddef.h>
#if !HAVE_STRCASECMP && !HAVE_STRICMP && !HAVE_STRCMPI
int strcasecmp (const char *s1, const char *s2);
#endif
#if !HAVE_STRNCASECMP && !HAVE_STRNICMP && !HAVE_STRNCMPI
int strncasecmp (const char *s1, const char *s2, size_t n);
#endif
#if !HAVE_MEMPCPY
void *mempcpy (void *dest, const void *src, size_t n);
#endif
#if !HAVE_STPCPY
char *stpcpy (char *dest, const char *src);
#endif

View File

@@ -1,5 +1,5 @@
/* Declarations for operating system interfaces for GNU Make.
Copyright (C) 2016-2022 Free Software Foundation, Inc.
Copyright (C) 2016-2023 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
@@ -12,8 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#define IO_UNKNOWN 0x0001
#define IO_COMBINED_OUTERR 0x0002
@@ -26,10 +25,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
# define fd_inherit(_i) (0)
# define fd_noinherit(_i) (0)
# define fd_set_append(_i) (void)(0)
# define os_anontmp() (-1)
#else
/* Determine the state of stdin/stdout/stderr. */
unsigned int check_io_state ();
unsigned int check_io_state (void);
/* Set a file descriptor to close/not close in a subprocess. */
void fd_inherit (int);
@@ -37,13 +37,9 @@ void fd_noinherit (int);
/* If the file descriptor is for a file put it into append mode. */
void fd_set_append (int);
#endif
/* Return a file descriptor for a new anonymous temp file, or -1. */
#if defined(WINDOWS32)
int os_anontmp ();
#else
# define os_anontmp() (-1)
int os_anontmp (void);
#endif
/* This section provides OS-specific functions to support the jobserver. */
@@ -51,7 +47,7 @@ int os_anontmp ();
#ifdef MAKE_JOBSERVER
/* Returns 1 if the jobserver is enabled, else 0. */
unsigned int jobserver_enabled ();
unsigned int jobserver_enabled (void);
/* Called in the parent make to set up the jobserver initially. */
unsigned int jobserver_setup (int job_slots, const char *style);
@@ -61,23 +57,25 @@ unsigned int jobserver_setup (int job_slots, const char *style);
unsigned int jobserver_parse_auth (const char* auth);
/* Returns an allocated buffer used to pass to child instances. */
char *jobserver_get_auth ();
char *jobserver_get_auth (void);
/* Returns a pointer to a static string used to indicate that the child
cannot access the jobserver, or NULL if it always can. */
const char *jobserver_get_invalid_auth ();
const char *jobserver_get_invalid_auth (void);
/* Clear this instance's jobserver configuration. */
void jobserver_clear ();
/* Clear this instance's jobserver configuration.
This method might be invoked from a signal handler. */
void jobserver_clear (void);
/* Recover all the jobserver tokens and return the number we got. */
unsigned int jobserver_acquire_all ();
/* Recover all the jobserver tokens and return the number we got.
Will also run jobserver_clear() as a side-effect. */
unsigned int jobserver_acquire_all (void);
/* Release a jobserver token. If it fails and is_fatal is 1, fatal. */
void jobserver_release (int is_fatal);
/* Notify the jobserver that a child exited. */
void jobserver_signal ();
void jobserver_signal (void);
/* Get ready to start a non-recursive child. */
void jobserver_pre_child (int);
@@ -86,7 +84,7 @@ void jobserver_pre_child (int);
void jobserver_post_child (int);
/* Set up to acquire a new token. */
void jobserver_pre_acquire ();
void jobserver_pre_acquire (void);
/* Wait until we can acquire a jobserver token.
TIMEOUT is 1 if we have other jobs waiting for the load to go down;
@@ -116,28 +114,29 @@ unsigned int jobserver_acquire (int timeout);
#ifndef NO_OUTPUT_SYNC
/* Returns 1 if output sync is enabled, else 0. */
unsigned int osync_enabled ();
unsigned int osync_enabled (void);
/* Called in the parent make to set up output sync initially. */
void osync_setup ();
void osync_setup (void);
/* Returns an allocated buffer containing output sync info to pass to child
instances, or NULL if not needed. */
char *osync_get_mutex ();
char *osync_get_mutex (void);
/* Called in a child instance to obtain info on the output sync mutex.
Return 1 if we got a valid mutex, else 0. */
unsigned int osync_parse_mutex (const char *mutex);
/* Clean up this instance's output sync facilities. */
void osync_clear ();
/* Clean up this instance's output sync facilities.
This method might be invoked from a signal handler. */
void osync_clear (void);
/* Acquire the output sync lock. This will wait until available.
Returns 0 if there was an error getting the semaphore. */
unsigned int osync_acquire ();
unsigned int osync_acquire (void);
/* Release the output sync lock. */
void osync_release ();
void osync_release (void);
#else
@@ -155,5 +154,5 @@ void osync_release ();
#if defined(VMS) || defined(WINDOWS32) || defined(_AMIGA) || defined(__MSDOS__)
# define get_bad_stdin() (-1)
#else
int get_bad_stdin ();
int get_bad_stdin (void);
#endif

View File

@@ -1,5 +1,5 @@
/* Output to stdout / stderr for GNU make
Copyright (C) 2013-2022 Free Software Foundation, Inc.
/* Output to stdout / stderr for GNU Make
Copyright (C) 2013-2023 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
@@ -12,13 +12,13 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "os.h"
#include "output.h"
/* GNU make no longer supports pre-ANSI89 environments. */
/* GNU Make no longer supports pre-ANSI89 environments. */
#include <assert.h>
#include <stdio.h>
@@ -51,20 +51,24 @@ unsigned int stdio_traced = 0;
static void
_outputs (struct output *out, int is_err, const char *msg)
{
if (! out || ! out->syncout)
{
FILE *f = is_err ? stderr : stdout;
fputs (msg, f);
fflush (f);
}
else
FILE *f;
if (out && out->syncout)
{
int fd = is_err ? out->err : out->out;
size_t len = strlen (msg);
int r;
EINTRLOOP (r, lseek (fd, 0, SEEK_END));
writebuf (fd, msg, len);
if (fd != OUTPUT_NONE)
{
size_t len = strlen (msg);
int r;
EINTRLOOP (r, lseek (fd, 0, SEEK_END));
writebuf (fd, msg, len);
return;
}
}
f = is_err ? stderr : stdout;
fputs (msg, f);
fflush (f);
}
/* Write a message indicating that we've just entered or
@@ -198,7 +202,16 @@ output_tmpfd (void)
static void
setup_tmpfile (struct output *out)
{
unsigned int io_state = check_io_state ();
static unsigned int in_setup = 0;
unsigned int io_state;
/* If something fails during setup we might recurse back into this function
while writing errors. Make sure we don't do so infinitely. */
if (in_setup)
return;
in_setup = 1;
io_state = check_io_state ();
if (NONE_SET (io_state, IO_STDOUT_OK|IO_STDERR_OK))
{
@@ -230,13 +243,18 @@ setup_tmpfile (struct output *out)
}
}
in_setup = 0;
return;
/* If we failed to create a temp file, disable output sync going forward. */
error:
O (error, NILF,
_("cannot open output-sync lock file, suppressing output-sync."));
output_close (out);
output_sync = OUTPUT_SYNC_NONE;
osync_clear ();
in_setup = 0;
}
/* Synchronize the output of jobs in -j mode to keep the results of
@@ -267,7 +285,8 @@ output_dump (struct output *out)
}
/* Log the working directory for this dump. */
if (print_directory && output_sync != OUTPUT_SYNC_RECURSE)
if (output_sync != OUTPUT_SYNC_RECURSE && should_print_dir ())
traced = log_working_directory (1);
if (outfd_not_empty)
@@ -351,7 +370,7 @@ output_start (void)
/* If we're not syncing this output per-line or per-target, make sure we emit
the "Entering..." message where appropriate. */
if (output_sync == OUTPUT_SYNC_NONE || output_sync == OUTPUT_SYNC_RECURSE)
if (! stdio_traced && print_directory)
if (! stdio_traced && should_print_dir ())
stdio_traced = log_working_directory (1);
}
@@ -394,10 +413,11 @@ void
message (int prefix, size_t len, const char *fmt, ...)
{
va_list args;
char *start;
char *p;
len += strlen (fmt) + strlen (program) + INTSTR_LENGTH + 4 + 1 + 1;
p = get_buffer (len);
start = p = get_buffer (len);
if (prefix)
{
@@ -414,8 +434,8 @@ message (int prefix, size_t len, const char *fmt, ...)
strcat (p, "\n");
assert (fmtbuf.buffer[len-1] == '\0');
outputs (0, fmtbuf.buffer);
assert (start[len-1] == '\0');
outputs (0, start);
}
/* Print an error message. */
@@ -424,12 +444,13 @@ void
error (const floc *flocp, size_t len, const char *fmt, ...)
{
va_list args;
char *start;
char *p;
len += (strlen (fmt) + strlen (program)
+ (flocp && flocp->filenm ? strlen (flocp->filenm) : 0)
+ INTSTR_LENGTH + 4 + 1 + 1);
p = get_buffer (len);
start = p = get_buffer (len);
if (flocp && flocp->filenm)
sprintf (p, "%s:%lu: ", flocp->filenm, flocp->lineno + flocp->offset);
@@ -445,8 +466,8 @@ error (const floc *flocp, size_t len, const char *fmt, ...)
strcat (p, "\n");
assert (fmtbuf.buffer[len-1] == '\0');
outputs (1, fmtbuf.buffer);
assert (start[len-1] == '\0');
outputs (1, start);
}
/* Print an error message and exit. */
@@ -456,12 +477,13 @@ fatal (const floc *flocp, size_t len, const char *fmt, ...)
{
va_list args;
const char *stop = _(". Stop.\n");
char *start;
char *p;
len += (strlen (fmt) + strlen (program)
+ (flocp && flocp->filenm ? strlen (flocp->filenm) : 0)
+ INTSTR_LENGTH + 8 + strlen (stop) + 1);
p = get_buffer (len);
start = p = get_buffer (len);
if (flocp && flocp->filenm)
sprintf (p, "%s:%lu: *** ", flocp->filenm, flocp->lineno + flocp->offset);
@@ -477,8 +499,8 @@ fatal (const floc *flocp, size_t len, const char *fmt, ...)
strcat (p, stop);
assert (fmtbuf.buffer[len-1] == '\0');
outputs (1, fmtbuf.buffer);
assert (start[len-1] == '\0');
outputs (1, start);
die (MAKE_FAILURE);
}

View File

@@ -1,5 +1,5 @@
/* Output to stdout / stderr for GNU make
Copyright (C) 2013-2022 Free Software Foundation, Inc.
/* Output to stdout / stderr for GNU Make
Copyright (C) 2013-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
struct output
{

View File

@@ -1,5 +1,5 @@
/* POSIX-based operating system interface for GNU Make.
Copyright (C) 2016-2022 Free Software Foundation, Inc.
Copyright (C) 2016-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
@@ -24,6 +24,10 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#elif defined(HAVE_SYS_FILE_H)
# include <sys/file.h>
#endif
#if MK_OS_ZOS
/* FIXME: HAVE_PSELECT path hangs on z/OS */
#undef HAVE_PSELECT
#endif
#if !defined(FD_OK)
# define FD_OK(_f) 1
@@ -75,6 +79,9 @@ check_io_state ()
/* This section provides OS-specific functions to support the jobserver. */
/* True if this is the root make instance. */
static unsigned char job_root = 0;
/* These track the state of the jobserver pipe. Passed to child instances. */
static int job_fds[2] = { -1, -1 };
@@ -129,6 +136,9 @@ set_blocking (int fd, int blocking)
if (r < 0)
pfatal_with_name ("fcntl(O_NONBLOCK)");
}
#else
(void) fd;
(void) blocking;
#endif
}
@@ -137,10 +147,19 @@ jobserver_setup (int slots, const char *style)
{
int r;
#if HAVE_MKFIFO
if (style == NULL || strcmp (style, "fifo") == 0)
#if JOBSERVER_USE_FIFO
if (!style || strcmp (style, "fifo") == 0)
{
fifo_name = get_tmppath ();
/* Unfortunately glibc warns about uses of mktemp even though we aren't
using it in dangerous way here. So avoid this by generating our own
temporary file name. */
# define FNAME_PREFIX "GMfifo"
const char *tmpdir = get_tmpdir ();
fifo_name = xmalloc (strlen (tmpdir) + CSTRLEN (FNAME_PREFIX)
+ INTSTR_LENGTH + 2);
sprintf (fifo_name, "%s/" FNAME_PREFIX "%" MK_PRI64_PREFIX "d",
tmpdir, (long long)make_pid ());
EINTRLOOP (r, mkfifo (fifo_name, 0600));
if (r < 0)
@@ -155,16 +174,14 @@ jobserver_setup (int slots, const char *style)
hang until the write side is open. */
EINTRLOOP (job_fds[0], open (fifo_name, O_RDONLY|O_NONBLOCK));
if (job_fds[0] < 0)
OSS (fatal, NILF, _("Cannot open jobserver %s: %s"),
OSS (fatal, NILF, _("cannot open jobserver %s: %s"),
fifo_name, strerror (errno));
EINTRLOOP (job_fds[1], open (fifo_name, O_WRONLY));
if (job_fds[0] < 0)
OSS (fatal, NILF, _("Cannot open jobserver %s: %s"),
OSS (fatal, NILF, _("cannot open jobserver %s: %s"),
fifo_name, strerror (errno));
DB (DB_JOBS, (_("Jobserver setup (fifo %s)\n"), fifo_name));
js_type = js_fifo;
}
}
@@ -173,15 +190,12 @@ jobserver_setup (int slots, const char *style)
if (js_type == js_none)
{
if (style && strcmp (style, "pipe") != 0)
OS (fatal, NILF, _("Unknown jobserver auth style '%s'"), style);
OS (fatal, NILF, _("unknown jobserver auth style '%s'"), style);
EINTRLOOP (r, pipe (job_fds));
if (r < 0)
pfatal_with_name (_("creating jobs pipe"));
DB (DB_JOBS, (_("Jobserver setup (fds %d,%d)\n"),
job_fds[0], job_fds[1]));
js_type = js_pipe;
}
@@ -203,6 +217,8 @@ jobserver_setup (int slots, const char *style)
/* When using pselect() we want the read to be non-blocking. */
set_blocking (job_fds[0], 0);
job_root = 1;
return 1;
}
@@ -220,21 +236,24 @@ jobserver_parse_auth (const char *auth)
EINTRLOOP (job_fds[0], open (fifo_name, O_RDONLY));
if (job_fds[0] < 0)
OSS (fatal, NILF,
_("Cannot open jobserver %s: %s"), fifo_name, strerror (errno));
{
OSS (error, NILF,
_("cannot open jobserver %s: %s"), fifo_name, strerror (errno));
return 0;
}
EINTRLOOP (job_fds[1], open (fifo_name, O_WRONLY));
if (job_fds[0] < 0)
OSS (fatal, NILF,
_("Cannot open jobserver %s: %s"), fifo_name, strerror (errno));
if (job_fds[1] < 0)
{
OSS (error, NILF,
_("cannot open jobserver %s: %s"), fifo_name, strerror (errno));
return 0;
}
js_type = js_fifo;
}
/* If not, it must be a simple pipe. */
else if (sscanf (auth, "%d,%d", &rfd, &wfd) == 2)
{
DB (DB_JOBS, (_("Jobserver client (fds %d,%d)\n"), rfd, wfd));
/* The parent overrode our FDs because we aren't a recursive make. */
if (rfd == -2 || wfd == -2)
return 0;
@@ -327,8 +346,20 @@ jobserver_clear ()
job_fds[0] = job_fds[1] = job_rfd = -1;
free (fifo_name);
fifo_name = NULL;
if (fifo_name)
{
if (job_root)
{
int r;
EINTRLOOP (r, unlink (fifo_name));
}
if (!handling_fatal_signal)
{
free (fifo_name);
fifo_name = NULL;
}
}
js_type = js_none;
}
@@ -368,11 +399,10 @@ jobserver_acquire_all ()
++tokens;
}
if (fifo_name)
EINTRLOOP (r, unlink (fifo_name));
DB (DB_JOBS, ("Acquired all %u jobserver tokens.\n", tokens));
jobserver_clear ();
return tokens;
}
@@ -462,7 +492,7 @@ jobserver_acquire (int timeout)
case EBADF:
/* Someone closed the jobs pipe.
That shouldn't happen but if it does we're done. */
O (fatal, NILF, _("job server shut down"));
O (fatal, NILF, _("job server shut down"));
default:
pfatal_with_name (_("pselect jobs pipe"));
@@ -594,7 +624,7 @@ jobserver_acquire (int timeout)
go back and reap_children(), and try again. */
errno = saved_errno;
if (errno != EINTR && errno != EBADF)
if (errno != EINTR && errno != EBADF && errno != EAGAIN)
pfatal_with_name (_("read jobs pipe"));
if (errno == EBADF)
@@ -615,7 +645,7 @@ static int osync_handle = -1;
static char *osync_tmpfile = NULL;
static unsigned int sync_parent = 0;
static unsigned int sync_root = 0;
unsigned int
osync_enabled ()
@@ -627,8 +657,8 @@ void
osync_setup ()
{
osync_handle = get_tmpfd (&osync_tmpfile);
if (osync_handle >= 0)
sync_parent = 1;
fd_noinherit (osync_handle);
sync_root = 1;
}
char *
@@ -655,6 +685,7 @@ osync_parse_mutex (const char *mutex)
return 0;
}
free (osync_tmpfile);
osync_tmpfile = xstrdup (mutex + CSTRLEN (MUTEX_PREFIX));
EINTRLOOP (osync_handle, open (osync_tmpfile, O_WRONLY));
@@ -662,21 +693,26 @@ osync_parse_mutex (const char *mutex)
OSS (fatal, NILF, _("cannot open output sync mutex %s: %s"),
osync_tmpfile, strerror (errno));
fd_noinherit (osync_handle);
return 1;
}
void
osync_clear ()
{
if (osync_handle)
if (osync_handle >= 0)
{
close (osync_handle);
osync_handle = -1;
}
if (sync_parent && osync_tmpfile)
if (sync_root && osync_tmpfile)
{
unlink (osync_tmpfile);
int r;
EINTRLOOP (r, unlink (osync_tmpfile));
free (osync_tmpfile);
osync_tmpfile = NULL;
}
}
@@ -692,6 +728,7 @@ osync_acquire ()
fl.l_whence = SEEK_SET;
fl.l_start = 0;
fl.l_len = 1;
/* We don't want to keep waiting on EINTR. */
if (fcntl (osync_handle, F_SETLKW, &fl) == -1)
{
perror ("fcntl()");
@@ -713,6 +750,7 @@ osync_release ()
fl.l_whence = SEEK_SET;
fl.l_start = 0;
fl.l_len = 1;
/* We don't want to keep waiting on EINTR. */
if (fcntl (osync_handle, F_SETLKW, &fl) == -1)
perror ("fcntl()");
}
@@ -736,7 +774,7 @@ get_bad_stdin ()
if (pipe (pd) == 0)
{
/* Close the write side. */
(void) close (pd[1]);
close (pd[1]);
/* Save the read side. */
bad_stdin = pd[0];
@@ -809,3 +847,50 @@ fd_set_append (int fd)
}
#endif
}
/* Return a file descriptor for a new anonymous temp file, or -1. */
int
os_anontmp ()
{
const char *tdir = get_tmpdir ();
int fd = -1;
#ifdef O_TMPFILE
static unsigned int tmpfile_works = 1;
if (tmpfile_works)
{
EINTRLOOP (fd, open (tdir, O_RDWR | O_TMPFILE | O_EXCL, 0600));
if (fd >= 0)
return fd;
DB (DB_BASIC, (_("Cannot open '%s' with O_TMPFILE: %s.\n"),
tdir, strerror (errno)));
tmpfile_works = 0;
}
#endif
#if HAVE_DUP
/* If we can dup and we are creating temp files in the default location then
try tmpfile() + dup() + fclose() to avoid ever having a named file. */
if (streq (tdir, DEFAULT_TMPDIR))
{
mode_t mask = umask (0077);
FILE *tfile;
ENULLLOOP (tfile, tmpfile ());
if (!tfile)
{
OS (error, NILF, "tmpfile: %s", strerror (errno));
return -1;
}
umask (mask);
EINTRLOOP (fd, dup (fileno (tfile)));
if (fd < 0)
OS (error, NILF, "dup: %s", strerror (errno));
fclose (tfile);
}
#endif
return fd;
}

View File

@@ -1,5 +1,5 @@
/* Reading and parsing of makefiles for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
@@ -192,15 +192,7 @@ read_all_makefiles (const char **makefiles)
char *name, *p;
size_t length;
{
/* Turn off --warn-undefined-variables while we expand MAKEFILES. */
int save = warn_undefined_variables_flag;
warn_undefined_variables_flag = 0;
value = allocated_variable_expand ("$(MAKEFILES)");
warn_undefined_variables_flag = save;
}
value = allocated_variable_expand ("$(MAKEFILES)");
/* Set NAME to the start of next token and LENGTH to its length.
MAKEFILES is updated for finding remaining tokens. */
@@ -373,25 +365,29 @@ eval_makefile (const char *filename, unsigned short flags)
/* If the makefile wasn't found and it's either a makefile from the
'MAKEFILES' variable or an included makefile, search the included
makefile search path for this makefile. */
if (ebuf.fp == NULL && deps->error == ENOENT && (flags & RM_INCLUDED)
&& *filename != '/' && include_directories)
for (const char **dir = include_directories; *dir != NULL; ++dir)
{
const char *included = concat (3, *dir, "/", filename);
if (ebuf.fp == NULL && deps->error == ENOENT && include_directories
&& ANY_SET (flags, RM_INCLUDED)
&& !HAS_DRIVESPEC (filename) && !ISDIRSEP (*filename))
{
const char **dir;
for (dir = include_directories; *dir != NULL; ++dir)
{
const char *included = concat (3, *dir, "/", filename);
ENULLLOOP(ebuf.fp, fopen (included, "r"));
if (ebuf.fp)
{
filename = included;
break;
}
if (errno != ENOENT)
{
filename = included;
deps->error = errno;
break;
}
}
ENULLLOOP(ebuf.fp, fopen (included, "r"));
if (ebuf.fp)
{
filename = included;
break;
}
if (errno != ENOENT)
{
filename = included;
deps->error = errno;
break;
}
}
}
/* Enter the final name for this makefile as a goaldep. */
filename = strcache_add (filename);
@@ -400,6 +396,7 @@ eval_makefile (const char *filename, unsigned short flags)
deps->file = enter_file (filename);
filename = deps->file->name;
deps->flags = flags;
deps->file->is_explicit = 1;
free (expanded);
@@ -984,6 +981,7 @@ eval (struct ebuffer *ebuf, int set_default)
/* Otherwise add it to the list to be rebuilt. */
deps = alloc_goaldep ();
deps->next = read_files;
deps->floc = ebuf->floc;
read_files = deps;
deps->file = f;
}
@@ -1107,7 +1105,7 @@ eval (struct ebuffer *ebuf, int set_default)
Note that the only separators of targets in this context are
whitespace and a left paren. If others are possible, add them
to the string in the call to strchr. */
while (colonp && (colonp[1] == '/' || colonp[1] == '\\') &&
while (colonp && ISDIRSEP (colonp[1]) &&
isalpha ((unsigned char) colonp[-1]) &&
(colonp == p2 + 1 || strchr (" \t(", colonp[-2]) != 0))
colonp = find_char_unquote (colonp + 1, ':');
@@ -1136,20 +1134,29 @@ eval (struct ebuffer *ebuf, int set_default)
p2 = next_token (variable_buffer);
/* If the word we're looking at is EOL, see if there's _anything_
on the line. If not, a variable expanded to nothing, so ignore
it. If so, we can't parse this line so punt. */
/* If we're at EOL we didn't find a separator so we don't know what
kind of line this is. */
if (wtype == w_eol)
{
/* Ignore an empty line. */
if (*p2 == '\0')
continue;
/* There's no need to be ivory-tower about this: check for
one of the most common bugs found in makefiles... */
/* Check for spaces instead of TAB. */
if (cmd_prefix == '\t' && strneq (line, " ", 8))
O (fatal, fstart, _("missing separator (did you mean TAB instead of 8 spaces?)"));
else
O (fatal, fstart, _("missing separator"));
/* Check for conditionals without whitespace afterward.
We don't check ifdef/ifndef because there's no real way to miss
whitespace there. */
p2 = next_token (line);
if (strneq (p2, "if", 2) &&
((strneq (&p2[2], "neq", 3) && !STOP_SET (p2[5], MAP_BLANK))
|| (strneq (&p2[2], "eq", 2) && !STOP_SET (p2[4], MAP_BLANK))))
O (fatal, fstart, _("missing separator (ifeq/ifneq must be followed by whitespace)"));
/* No idea... */
O (fatal, fstart, _("missing separator"));
}
{
@@ -1278,8 +1285,7 @@ eval (struct ebuffer *ebuf, int set_default)
do {
check_again = 0;
/* For DOS-style paths, skip a "C:\..." or a "C:/..." */
if (p != 0 && (p[1] == '\\' || p[1] == '/') &&
isalpha ((unsigned char)p[-1]) &&
if (p != 0 && ISDIRSEP (p[1]) && isalpha ((unsigned char)p[-1]) &&
(p == p2 + 1 || strchr (" \t:(", p[-2]) != 0)) {
p = strchr (p + 1, ':');
check_again = 1;
@@ -3070,7 +3076,7 @@ construct_include_path (const char **arg_dirs)
do_variable_definition (NILF, ".INCLUDE_DIRS", *cpp,
o_default, f_append, 0);
free (include_directories);
free ((void *) include_directories);
include_directories = dirs;
}
@@ -3269,7 +3275,7 @@ parse_file_seq (char **stringp, size_t size, int stopmap,
Tokens separated by spaces are treated as separate paths since make
doesn't allow path names with spaces. */
if (p && p == s+1 && p[0] == ':'
&& isalpha ((unsigned char)s[0]) && STOP_SET (p[1], MAP_DIRSEP))
&& isalpha ((unsigned char)s[0]) && ISDIRSEP (p[1]))
p = find_map_unquote (p+1, findmap);
#endif

View File

@@ -1,5 +1,5 @@
/* Basic dependency engine for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "filedef.h"
@@ -34,10 +34,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include <starlet.h>
#endif
#ifdef WINDOWS32
#include <windows.h>
#include <io.h>
#include <sys/stat.h>
#if defined(_MSC_VER) && _MSC_VER > 1200
/* VC7 or later supprots _stat64 to access 64-bit file size. */
/* VC7 or later supports _stat64 to access 64-bit file size. */
#define STAT _stat64
#else
#define STAT stat
@@ -78,6 +79,25 @@ static FILE_TIMESTAMP name_mtime (const char *name);
static const char *library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr);
static void
check_also_make (const struct file *file)
{
struct dep *ad;
FILE_TIMESTAMP mtime = file->last_mtime;
if (mtime == UNKNOWN_MTIME)
mtime = name_mtime (file->name);
/* If we updated the file, check its also-make files. */
if (is_ordinary_mtime (mtime) && mtime > file->mtime_before_update)
for (ad = file->also_make; ad; ad = ad->next)
if (ad->file->last_mtime == NONEXISTENT_MTIME)
OS (error, file->cmds ? &file->cmds->fileinfo : NILF,
_("warning: pattern recipe did not update peer target '%s'."),
ad->file->name);
}
/* Remake all the goals in the 'struct dep' chain GOALS. Return update_status
representing the totality of the status of the goals.
@@ -89,6 +109,7 @@ static const char *library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr);
enum update_status
update_goal_chain (struct goaldep *goaldeps)
{
unsigned long last_cmd_count = 0;
int t = touch_flag, q = question_flag, n = just_print_flag;
enum update_status status = us_none;
@@ -114,9 +135,12 @@ update_goal_chain (struct goaldep *goaldeps)
start_waiting_jobs ();
/* Wait for a child to die. */
/* Check for exited children. If no children have finished since the
last time we looked, then block until one exits. If some have
exited don't block, so we can possibly do more work. */
reap_children (1, 0);
reap_children (last_cmd_count == command_count, 0);
last_cmd_count = command_count;
lastgoal = 0;
gu = goals;
@@ -416,7 +440,7 @@ complain (struct file *file)
}
/* Consider a single 'struct file' and update it as appropriate.
Return 0 on success, or non-0 on failure. */
Return an update_status value; use us_success if we aren't sure yet. */
static enum update_status
update_file_1 (struct file *file, unsigned int depth)
@@ -449,7 +473,7 @@ update_file_1 (struct file *file, unsigned int depth)
}
DBF (DB_VERBOSE, _("File '%s' was considered already.\n"));
return 0;
return us_success;
}
switch (file->command_state)
@@ -459,7 +483,7 @@ update_file_1 (struct file *file, unsigned int depth)
break;
case cs_running:
DBF (DB_VERBOSE, _("Still updating file '%s'.\n"));
return 0;
return us_success;
case cs_finished:
DBF (DB_VERBOSE, _("Finished updating file '%s'.\n"));
return file->update_status;
@@ -471,8 +495,6 @@ update_file_1 (struct file *file, unsigned int depth)
fail. */
file->no_diag = file->dontcare;
++depth;
/* Notice recursive update of the same file. */
start_updating (file);
@@ -480,6 +502,9 @@ update_file_1 (struct file *file, unsigned int depth)
remember this one to turn off updating. */
ofile = file;
/* Increase the depth for reporting how we build the file. */
++depth;
/* Looking at the file's modtime beforehand allows the possibility
that its name may be changed by a VPATH search, and thus it may
not need an implicit rule. If this were not done, the file
@@ -491,8 +516,7 @@ update_file_1 (struct file *file, unsigned int depth)
noexist = this_mtime == NONEXISTENT_MTIME;
if (noexist)
DBF (DB_BASIC, _("File '%s' does not exist.\n"));
else if (ORDINARY_MTIME_MIN <= this_mtime && this_mtime <= ORDINARY_MTIME_MAX
&& file->low_resolution_time)
else if (is_ordinary_mtime (this_mtime) && file->low_resolution_time)
{
/* Avoid spurious rebuilds due to low resolution time stamps. */
int ns = FILE_TIMESTAMP_NS (this_mtime);
@@ -503,6 +527,28 @@ update_file_1 (struct file *file, unsigned int depth)
this_mtime += FILE_TIMESTAMPS_PER_S - 1 - ns;
}
/* If any also_make target doesn't exist, we must remake this one too.
If they do exist choose the oldest mtime so they will rebuild. */
for (ad = file->also_make; ad && !noexist; ad = ad->next)
{
struct file *adfile = ad->file;
FILE_TIMESTAMP fmtime = file_mtime (adfile);
noexist = fmtime == NONEXISTENT_MTIME;
if (noexist)
{
check_renamed (adfile);
DBS (DB_BASIC,
(_("Grouped target peer '%s' of file '%s' does not exist.\n"),
adfile->name, file->name));
}
else if (fmtime < this_mtime)
this_mtime = fmtime;
}
must_make = noexist;
/* If file was specified as a target with no commands, come up with some
default commands. This may also add more also_make files. */
@@ -518,26 +564,6 @@ update_file_1 (struct file *file, unsigned int depth)
file->cmds = default_file->cmds;
}
/* If any also_make target doesn't exist, we must remake this one too.
If they do exist choose the oldest mtime so they will rebuild. */
for (ad = file->also_make; ad && !noexist; ad = ad->next)
{
struct file *adfile = ad->file;
FILE_TIMESTAMP fmtime = file_mtime (adfile);
check_renamed (adfile);
noexist = fmtime == NONEXISTENT_MTIME;
if (noexist)
DBS (DB_BASIC,
(_("Grouped target peer '%s' of file '%s' does not exist.\n"),
adfile->name, file->name));
else if (fmtime < this_mtime)
this_mtime = fmtime;
}
must_make = noexist;
/* Update all non-intermediate files we depend on, if necessary, and see
whether any of them is more recent than this file. We need to walk our
deps, AND the deps of any also_make targets to ensure everything happens
@@ -713,16 +739,18 @@ update_file_1 (struct file *file, unsigned int depth)
finish_updating (file);
finish_updating (ofile);
DBF (DB_VERBOSE, _("Finished prerequisites of target file '%s'.\n"));
/* We've decided what we need to do to build the file. */
--depth;
if (running)
{
set_command_state (file, cs_deps_running);
--depth;
DBF (DB_VERBOSE, _("The prerequisites of '%s' are being made.\n"));
return 0;
return us_success;
}
DBF (DB_VERBOSE, _("Finished prerequisites of target file '%s'.\n"));
/* If any dependency failed, give up now. */
if (dep_status)
@@ -731,8 +759,6 @@ update_file_1 (struct file *file, unsigned int depth)
file->update_status = dep_status == us_none ? us_failed : dep_status;
notice_finished_file (file);
--depth;
DBF (DB_VERBOSE, _("Giving up on target file '%s'.\n"));
if (depth == 0 && keep_going_flag
@@ -807,16 +833,13 @@ update_file_1 (struct file *file, unsigned int depth)
if (fmt)
{
print_spaces (depth);
print_spaces (depth+1);
printf (fmt, dep_name (d), file->name);
fflush (stdout);
}
}
}
/* Here depth returns to the value it had when we were called. */
depth--;
if (file->double_colon && file->deps == 0)
{
must_make = 1;
@@ -850,7 +873,8 @@ update_file_1 (struct file *file, unsigned int depth)
/* Since make has not created this file, make should not remove it,
even if the file is intermediate. */
file->secondary = 1;
if (!file->notintermediate && no_intermediates == 0)
file->secondary = 1;
notice_finished_file (file);
@@ -864,7 +888,7 @@ update_file_1 (struct file *file, unsigned int depth)
file = file->prev;
}
return 0;
return us_success;
}
DBF (DB_BASIC, _("Must remake target '%s'.\n"));
@@ -883,7 +907,7 @@ update_file_1 (struct file *file, unsigned int depth)
if (file->command_state != cs_finished)
{
DBF (DB_VERBOSE, _("Recipe of '%s' is being run.\n"));
return 0;
return us_success;
}
switch (file->update_status)
@@ -936,7 +960,7 @@ notice_finished_file (struct file *file)
we don't want to do the touching. */
unsigned int i;
for (i = 0; i < file->cmds->ncommand_lines; ++i)
if (!(file->cmds->lines_flags[i] & COMMANDS_RECURSE))
if (NONE_SET (file->cmds->lines_flags[i], COMMANDS_RECURSE))
goto have_nonrecursing;
}
else
@@ -977,7 +1001,7 @@ notice_finished_file (struct file *file)
if ((question_flag || just_print_flag || touch_flag) && file->cmds)
{
for (i = file->cmds->ncommand_lines; i > 0; --i)
if (! (file->cmds->lines_flags[i-1] & COMMANDS_RECURSE))
if (NONE_SET (file->cmds->lines_flags[i-1], COMMANDS_RECURSE))
break;
}
@@ -1018,23 +1042,30 @@ notice_finished_file (struct file *file)
}
if (ran && file->update_status != us_none)
/* We actually tried to update FILE, which has
updated its also_make's as well (if it worked).
If it didn't work, it wouldn't work again for them.
So mark them as updated with the same status. */
for (d = file->also_make; d != 0; d = d->next)
{
d->file->command_state = cs_finished;
d->file->updated = 1;
d->file->update_status = file->update_status;
{
/* We actually tried to update FILE, which has
updated its also_make's as well (if it worked).
If it didn't work, it wouldn't work again for them.
So mark them as updated with the same status. */
for (d = file->also_make; d != 0; d = d->next)
{
d->file->command_state = cs_finished;
d->file->updated = 1;
d->file->update_status = file->update_status;
if (ran && !d->file->phony)
/* Fetch the new modification time.
We do this instead of just invalidating the cached time
so that a vpath_search can happen. Otherwise, it would
never be done because the target is already updated. */
f_mtime (d->file, 0);
}
if (ran && !d->file->phony)
/* Fetch the new modification time.
We do this instead of just invalidating the cached time
so that a vpath_search can happen. Otherwise, it would
never be done because the target is already updated. */
f_mtime (d->file, 0);
}
/* If the target was created by an implicit rule, and it was updated,
warn about any of its also_make targets that don't exist. */
if (file->tried_implicit && file->also_make)
check_also_make (file);
}
else if (file->update_status == us_none)
/* Nothing was done for FILE, but it needed nothing done.
So mark it now as "succeeded". */
@@ -1055,7 +1086,6 @@ check_dep (struct file *file, unsigned int depth,
struct dep *d;
enum update_status dep_status = us_success;
++depth;
start_updating (file);
/* We might change file if we find a different one via vpath;
@@ -1153,7 +1183,7 @@ check_dep (struct file *file, unsigned int depth,
d->file->parent = file;
maybe_make = *must_make_ptr;
new = check_dep (d->file, depth, this_mtime, &maybe_make);
new = check_dep (d->file, depth+1, this_mtime, &maybe_make);
if (new > dep_status)
dep_status = new;
@@ -1312,7 +1342,7 @@ f_mtime (struct file *file, int search)
if (ar_name (file->name))
{
/* This file is an archive-member reference. */
FILE_TIMESTAMP memmtime;
char *arname, *memname;
struct file *arfile;
time_t member_date;
@@ -1320,6 +1350,9 @@ f_mtime (struct file *file, int search)
/* Find the archive's name. */
ar_parse_name (file->name, &arname, &memname);
/* Find the mtime of the member file (it might not exist). */
memmtime = name_mtime (memname);
/* Find the modification time of the archive itself.
Also allow for its name to be changed via VPATH search. */
arfile = lookup_file (arname);
@@ -1363,9 +1396,16 @@ f_mtime (struct file *file, int search)
return NONEXISTENT_MTIME;
member_date = ar_member_date (file->hname);
mtime = (member_date == (time_t) -1
? NONEXISTENT_MTIME
: file_timestamp_cons (file->hname, member_date, 0));
if (member_date == (time_t) -1
|| (memmtime != NONEXISTENT_MTIME
&& (time_t) FILE_TIMESTAMP_S (memmtime) > member_date))
/* If the member file exists and is newer than the member in the
archive, pretend it's nonexistent. This means the member file was
updated but not added to the archive yet. */
mtime = NONEXISTENT_MTIME;
else
mtime = file_timestamp_cons (file->hname, member_date, 0);
}
else
#endif
@@ -1438,14 +1478,6 @@ f_mtime (struct file *file, int search)
FILE_TIMESTAMP adjustment = FAT_ADJ_OFFSET << FILE_TIMESTAMP_LO_BITS;
if (ORDINARY_MTIME_MIN + adjustment <= adjusted_mtime)
adjusted_mtime -= adjustment;
#elif defined(__EMX__)
/* FAT filesystems round time to the nearest even second!
Allow for any file (NTFS or FAT) to perhaps suffer from this
brain damage. */
FILE_TIMESTAMP adjustment = (((FILE_TIMESTAMP_S (adjusted_mtime) & 1) == 0
&& FILE_TIMESTAMP_NS (adjusted_mtime) == 0)
? (FILE_TIMESTAMP) 1 << FILE_TIMESTAMP_LO_BITS
: 0);
#endif
/* If the file's time appears to be in the future, update our
@@ -1524,7 +1556,7 @@ name_mtime (const char *name)
#if defined(WINDOWS32)
{
char tem[MAXPATHLEN], *tstart, *tend;
char tem[MAX_PATH+1], *tstart, *tend;
const char *p = name + strlen (name);
/* Remove any trailing slashes and "."/"..". MS-Windows stat
@@ -1542,7 +1574,7 @@ name_mtime (const char *name)
tend--;
if (*tend == '.' && tend > tstart)
tend--;
for ( ; tend > tstart && (*tend == '/' || *tend == '\\'); tend--)
for ( ; tend > tstart && ISDIRSEP (*tend); tend--)
*tend = '\0';
}
else

View File

@@ -3,7 +3,7 @@
Please do not send bug reports or questions about it to
the Make maintainers.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -16,7 +16,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"

View File

@@ -1,5 +1,5 @@
/* Template for the remote job exportation interface to GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
#include "filedef.h"

View File

@@ -1,5 +1,5 @@
/* Pattern and suffix rule internals for GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
@@ -94,7 +94,7 @@ get_rule_defn (struct rule *r)
if (dep->ignore_mtime == 0)
{
if (dep->wait_here)
p = mempcpy (p, STRING_SIZE_TUPLE (" .WAIT"));
p = mempcpy (p, " .WAIT", CSTRLEN (" .WAIT"));
p = mempcpy (mempcpy (p, " ", 1), dep_name (dep),
strlen (dep_name (dep)));
}
@@ -107,7 +107,7 @@ get_rule_defn (struct rule *r)
{
p = mempcpy (p, sep, strlen (sep));
if (ood->wait_here)
p = mempcpy (p, STRING_SIZE_TUPLE (".WAIT "));
p = mempcpy (p, ".WAIT ", CSTRLEN (".WAIT "));
p = mempcpy (p, dep_name (ood), strlen (dep_name (ood)));
}
*p = '\0';
@@ -346,7 +346,7 @@ convert_to_pattern (void)
/* 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
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)

View File

@@ -1,5 +1,5 @@
/* Definitions for using pattern rules in GNU Make.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Copyright (C) 1988-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
/* Structure used for pattern (implicit) rules. */

View File

@@ -1,5 +1,5 @@
/* Provide prerequisite shuffle support.
Copyright (C) 2022 Free Software Foundation, Inc.
Copyright (C) 2022-2023 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
@@ -12,7 +12,7 @@ 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/>. */
this program. If not, see <https://www.gnu.org/licenses/>. */
#include "makeint.h"
@@ -83,7 +83,7 @@ shuffle_set_mode (const char *cmdarg)
else
{
if (strcasecmp (cmdarg, "random") == 0)
config.seed = (unsigned int) (time (NULL) ^ make_pid ());
config.seed = make_rand ();
else
{
/* Assume explicit seed. */
@@ -109,7 +109,7 @@ random_shuffle_array (void **a, size_t len)
void *t;
/* Pick random element and swap. */
unsigned int j = rand () % len;
unsigned int j = make_rand () % len;
if (i == j)
continue;
@@ -130,7 +130,7 @@ reverse_shuffle_array (void **a, size_t len)
void *t;
/* Pick mirror and swap. */
unsigned int j = len - 1 - i;
size_t j = len - 1 - i;
/* Swap. */
t = a[i];
@@ -227,7 +227,7 @@ shuffle_deps_recursive (struct dep *deps)
/* Set specific seed at the top level of recursion. */
if (config.mode == sm_random)
srand (config.seed);
make_seed (config.seed);
shuffle_deps (deps);

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