mirror of
https://github.com/mirror/make.git
synced 2026-08-20 08:53:28 +08:00
Compare commits
71 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37e0010743 | ||
|
|
536c3e2b37 | ||
|
|
4c9b922560 | ||
|
|
2449ef3c88 | ||
|
|
fbf8c940e5 | ||
|
|
62194015fa | ||
|
|
c85f68c4e9 | ||
|
|
ffa28f3914 | ||
|
|
8f03e69af0 | ||
|
|
e819fc2022 | ||
|
|
f21cd822a3 | ||
|
|
2f336608d8 | ||
|
|
faedfdb0af | ||
|
|
9709d273b2 | ||
|
|
eb0bd1aaec | ||
|
|
d2bf740e77 | ||
|
|
a8890796a4 | ||
|
|
be6bb0fd68 | ||
|
|
db351fe85b | ||
|
|
8a0d7fd4ef | ||
|
|
f51fc130cc | ||
|
|
b99b6cdf3c | ||
|
|
36f955b0e8 | ||
|
|
a275f4e9ab | ||
|
|
11444fb001 | ||
|
|
0de7a0d3bf | ||
|
|
1656cd051c | ||
|
|
31a1337c23 | ||
|
|
5ae02ff8c1 | ||
|
|
1ceeb8c64b | ||
|
|
8791d2b38e | ||
|
|
f91b8bbb34 | ||
|
|
8dc66b6c31 | ||
|
|
ccbaf3861d | ||
|
|
c4fbfe8b5e | ||
|
|
e7ce3a655e | ||
|
|
c580ebae8d | ||
|
|
56d2978141 | ||
|
|
c91b269f66 | ||
|
|
29f453739f | ||
|
|
937e9aa32d | ||
|
|
8e9c7db1e1 | ||
|
|
15dfad96d7 | ||
|
|
76d2e5d98d | ||
|
|
a581146562 | ||
|
|
b2c7446023 | ||
|
|
89427039c3 | ||
|
|
7d8756a4a3 | ||
|
|
8e805c7ba6 | ||
|
|
132528b266 | ||
|
|
8f9e7722ff | ||
|
|
95c2db7b8d | ||
|
|
5d1b757517 | ||
|
|
c0023150f1 | ||
|
|
a89eef87e6 | ||
|
|
6164608900 | ||
|
|
a99183ed2b | ||
|
|
dc2d963989 | ||
|
|
53b8f6a5da | ||
|
|
6c1a6dd77c | ||
|
|
1b51ba1f5d | ||
|
|
4c9d87f4ae | ||
|
|
bb5df35133 | ||
|
|
92ab2e642d | ||
|
|
deb4ff272a | ||
|
|
e80ce6fc90 | ||
|
|
d71c0bb0ce | ||
|
|
090d99dd2d | ||
|
|
6b45f89adb | ||
|
|
11f7198f64 | ||
|
|
4321c5e562 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -37,7 +37,7 @@ configure
|
||||
stamp-*
|
||||
.dirstamp
|
||||
gnulib
|
||||
convert.sed
|
||||
*.sed
|
||||
|
||||
# Build artifacts
|
||||
.deps/
|
||||
|
||||
7
AUTHORS
7
AUTHORS
@@ -47,6 +47,10 @@ GNU Make porting efforts:
|
||||
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:
|
||||
@@ -94,6 +98,7 @@ Other contributors:
|
||||
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>
|
||||
@@ -106,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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) \
|
||||
src/mkconfig.h 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 \
|
||||
|
||||
152
NEWS
152
NEWS
@@ -1,6 +1,6 @@
|
||||
GNU Make NEWS -*-indented-text-*-
|
||||
History of user-visible changes.
|
||||
31 October 2022
|
||||
19 February 2023
|
||||
|
||||
See the end of this file for copyrights and conditions.
|
||||
|
||||
@@ -8,6 +8,46 @@ 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
|
||||
reporting bugs.
|
||||
|
||||
|
||||
Version 4.4.0.91 (19 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
|
||||
|
||||
* New platform: GNU Make is supported on z/OS
|
||||
Thanks to Igor Todorovski <itodorov@ca.ibm.com> for the patches and testing
|
||||
assistance.
|
||||
|
||||
* 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
|
||||
|
||||
* Updates to allow building on OS/2
|
||||
Provided by KO Myung-Hun <komh78@gmail.com>
|
||||
|
||||
* 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.
|
||||
|
||||
|
||||
Version 4.4 (31 Oct 2022)
|
||||
|
||||
@@ -245,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
|
||||
@@ -266,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>
|
||||
@@ -283,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.
|
||||
@@ -327,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
|
||||
@@ -366,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
|
||||
@@ -414,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
|
||||
@@ -446,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 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.
|
||||
|
||||
@@ -467,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
|
||||
@@ -509,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!
|
||||
@@ -517,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.
|
||||
@@ -626,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
|
||||
@@ -637,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
|
||||
@@ -660,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.
|
||||
|
||||
@@ -670,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
|
||||
@@ -693,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.
|
||||
@@ -729,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
|
||||
@@ -776,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.
|
||||
|
||||
@@ -808,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
|
||||
@@ -833,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.
|
||||
@@ -843,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,
|
||||
@@ -868,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.
|
||||
@@ -900,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
|
||||
@@ -928,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
|
||||
@@ -966,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
|
||||
@@ -1049,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
|
||||
@@ -1057,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.
|
||||
@@ -1113,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).
|
||||
@@ -1166,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,
|
||||
@@ -1181,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
|
||||
@@ -1336,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
|
||||
@@ -1818,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,6 +102,9 @@ 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 *****
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -347,7 +347,7 @@ Bug reports:
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
17
README.git
17
README.git
@@ -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
|
||||
@@ -88,10 +88,10 @@ 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)
|
||||
|
||||
@@ -99,7 +99,10 @@ 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:
|
||||
|
||||
* 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.
|
||||
@@ -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.)
|
||||
|
||||
@@ -266,7 +269,7 @@ package from there:
|
||||
If you don't want to create a new repository then run "git clean -fdx".
|
||||
Then:
|
||||
|
||||
./bootstrap.sh
|
||||
./bootstrap
|
||||
./configure
|
||||
make distcheck
|
||||
|
||||
|
||||
@@ -184,6 +184,8 @@ Ports
|
||||
|
||||
- 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
|
||||
@@ -205,7 +207,7 @@ 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
83
README.zOS
Normal 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.
|
||||
@@ -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
|
||||
|
||||
451
autogen.sh
451
autogen.sh
@@ -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 "$@"
|
||||
|
||||
240
autopull.sh
240
autopull.sh
@@ -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 "$@"
|
||||
|
||||
48
bootstrap
48
bootstrap
@@ -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
|
||||
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
@@ -45,6 +45,13 @@ 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
|
||||
@@ -56,9 +63,17 @@ 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
|
||||
sed -n "s/^AC_INIT(\[GNU.Make\],\[\([0-9.]*\)\].*/s,@PACKAGE_VERSION@,\1,g/p" configure.ac >> 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
|
||||
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
|
||||
:: 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
|
||||
@@ -70,12 +85,22 @@ if ERRORLEVEL 1 goto Failed
|
||||
|
||||
echo - Creating src\gmk-default.h
|
||||
echo static const char *const GUILE_module_defn = ^" \ > src\gmk-default.h
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
14
build.sh
14
build.sh
@@ -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
|
||||
@@ -42,19 +42,13 @@ 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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
26
configure.ac
26
configure.ac
@@ -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
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
AC_INIT([GNU Make],[4.4],[bug-make@gnu.org])
|
||||
AC_INIT([GNU Make],[4.4.0.91],[bug-make@gnu.org])
|
||||
|
||||
AC_PREREQ([2.69])
|
||||
|
||||
@@ -37,6 +37,8 @@ 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
|
||||
@@ -64,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
|
||||
@@ -183,7 +185,7 @@ AS_IF([test "x$with_guile" != xno],
|
||||
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],
|
||||
@@ -207,6 +209,8 @@ guile_init (void *arg)
|
||||
])
|
||||
])
|
||||
|
||||
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], , ,
|
||||
@@ -318,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
|
||||
@@ -341,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.
|
||||
@@ -471,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=
|
||||
@@ -490,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
|
||||
])])
|
||||
|
||||
@@ -498,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
|
||||
])
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.TH MAKE 1 "31 May 2022" "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]...
|
||||
@@ -398,9 +398,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
|
||||
|
||||
@@ -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
|
||||
@@ -2156,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
|
||||
@@ -3077,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.
|
||||
|
||||
@@ -5073,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
|
||||
@@ -5226,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}.
|
||||
|
||||
@@ -7352,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
|
||||
@@ -11333,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,
|
||||
@@ -11498,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
|
||||
|
||||
@@ -11519,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
|
||||
@@ -11754,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)
|
||||
|
||||
@@ -11820,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
|
||||
@@ -11893,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:
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
226
gl/lib/glob.c
226
gl/lib/glob.c
@@ -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;
|
||||
|
||||
112
gl/lib/glob.in.h
112
gl/lib/glob.in.h
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
]
|
||||
)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
Description:
|
||||
Install m4 macros for GNU make.
|
||||
Install m4 macros for GNU Make.
|
||||
|
||||
Files:
|
||||
m4/acinclude.m4
|
||||
|
||||
@@ -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
|
||||
@@ -238,16 +238,26 @@ export TAR_OPTIONS := --mode=u+w,go-w --owner=0 --group=0 --numeric-owner --sort
|
||||
# but add a new check to be sure it doesn't happen again.
|
||||
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. #
|
||||
@@ -264,6 +274,7 @@ CFGCHECK_MAKEFLAGS = # CFLAGS='$(AM_CFLAGS)'
|
||||
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 +290,7 @@ 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,8 +302,9 @@ 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
|
||||
@@ -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
|
||||
|
||||
@@ -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 \
|
||||
@@ -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 $(PACKAGE_NAME) version $(PACKAGE_VERSION)'; \
|
||||
) > "$*.directive"
|
||||
$(GPG) $(GPGFLAGS) -o "$@" --clearsign "$*.directive"
|
||||
@rm -f "$*.directive"
|
||||
|
||||
# Upload the artifacts
|
||||
|
||||
FTPPUT := $(firstword $(shell command -v ncftpput) $(wildcard $(GNULIBDIR)/build-aux/ncftpput-ftp) invalid)
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
2
src/ar.c
2
src/ar.c
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -176,7 +176,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
/* 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,
|
||||
@@ -329,3 +329,6 @@ this program. If not, see <https://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"
|
||||
|
||||
@@ -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
|
||||
@@ -213,7 +213,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
/* 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,
|
||||
@@ -428,3 +428,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
|
||||
/* Build host information. */
|
||||
#define MAKE_HOST "VMS"
|
||||
|
||||
/* Include customized declarations. */
|
||||
#include "../src/mkcustom.h"
|
||||
|
||||
@@ -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
|
||||
@@ -344,6 +344,14 @@ this program. If not, see <https://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. */
|
||||
@@ -449,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. */
|
||||
@@ -621,3 +629,6 @@ char *ttyname (int);
|
||||
#ifdef HAVE_CYGWIN_SHELL
|
||||
#undef BATCH_MODE_ONLY_SHELL
|
||||
#endif
|
||||
|
||||
/* Include customized declarations. */
|
||||
#include "../src/mkcustom.h"
|
||||
|
||||
@@ -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
|
||||
@@ -109,3 +109,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
/* 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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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) $< $@)",
|
||||
|
||||
@@ -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
|
||||
|
||||
147
src/dir.c
147
src/dir.c
@@ -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
|
||||
@@ -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);
|
||||
|
||||
@@ -610,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,
|
||||
@@ -623,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -634,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;
|
||||
|
||||
@@ -657,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;
|
||||
|
||||
@@ -671,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;
|
||||
}
|
||||
@@ -679,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
|
||||
/*
|
||||
@@ -687,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;
|
||||
}
|
||||
|
||||
@@ -706,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
|
||||
@@ -723,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;
|
||||
}
|
||||
|
||||
@@ -747,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
|
||||
@@ -768,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;
|
||||
}
|
||||
|
||||
@@ -794,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);
|
||||
}
|
||||
|
||||
@@ -822,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++;
|
||||
@@ -849,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 */
|
||||
@@ -923,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 */
|
||||
@@ -960,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. */
|
||||
|
||||
@@ -1021,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 */
|
||||
@@ -1058,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;
|
||||
|
||||
@@ -1115,9 +1116,9 @@ 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 %s): could not be opened.\n"),
|
||||
dir->name, dir->contents->path_key,
|
||||
@@ -1174,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."));
|
||||
@@ -1208,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;
|
||||
@@ -1279,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
|
||||
|
||||
@@ -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
|
||||
|
||||
11
src/file.c
11
src/file.c
@@ -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
|
||||
@@ -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.
|
||||
@@ -368,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)
|
||||
@@ -731,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)
|
||||
@@ -810,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -2327,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";
|
||||
|
||||
@@ -2337,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
|
||||
@@ -2357,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)
|
||||
@@ -2394,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')
|
||||
@@ -2801,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;
|
||||
|
||||
29
src/getopt.c
29
src/getopt.c
@@ -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.
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
(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))))
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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).
|
||||
|
||||
18
src/guile.c
18
src/guile.c
@@ -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
|
||||
@@ -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;
|
||||
|
||||
20
src/hash.c
20
src/hash.c
@@ -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; \
|
||||
|
||||
@@ -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
|
||||
@@ -272,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;
|
||||
@@ -893,7 +895,7 @@ pattern_search (struct file *file, int archive,
|
||||
|
||||
if (pattern_search (int_file,
|
||||
0,
|
||||
depth + 1,
|
||||
depth,
|
||||
recursions + 1,
|
||||
allow_compat_rules))
|
||||
{
|
||||
@@ -1008,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;
|
||||
|
||||
@@ -1090,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;
|
||||
}
|
||||
}
|
||||
@@ -1123,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;
|
||||
}
|
||||
|
||||
@@ -1139,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"),
|
||||
|
||||
113
src/job.c
113
src/job.c
@@ -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
|
||||
@@ -30,9 +30,6 @@ this program. If not, see <https://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";
|
||||
@@ -861,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 */
|
||||
@@ -1196,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')
|
||||
{
|
||||
@@ -1212,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
|
||||
@@ -1297,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
|
||||
@@ -1313,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. */
|
||||
@@ -1347,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);
|
||||
|
||||
@@ -1358,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
|
||||
@@ -1398,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;
|
||||
@@ -1467,12 +1464,12 @@ start_job_command (struct child *child)
|
||||
|
||||
#else
|
||||
|
||||
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);
|
||||
|
||||
jobserver_post_child (flags & COMMANDS_RECURSE);
|
||||
jobserver_post_child (ANY_SET (flags, COMMANDS_RECURSE));
|
||||
|
||||
#endif /* !VMS */
|
||||
}
|
||||
@@ -1893,7 +1890,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)
|
||||
@@ -1905,11 +1901,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.
|
||||
@@ -2513,7 +2549,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 */
|
||||
@@ -2550,6 +2586,11 @@ 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. Don't use execvpe() as we want the search for argv[0]
|
||||
@@ -2600,7 +2641,7 @@ exec_command (char **argv, char **envp)
|
||||
# ifdef __EMX__
|
||||
if (!unixy_shell)
|
||||
{
|
||||
new_argv[1] = "/c";
|
||||
new_argv[1] = (char *)"/c";
|
||||
++i;
|
||||
--argc;
|
||||
}
|
||||
@@ -2617,6 +2658,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
|
||||
@@ -2842,7 +2886,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)
|
||||
@@ -3226,7 +3270,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
|
||||
@@ -3488,7 +3538,7 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
|
||||
/* Some shells do not work well when invoked as 'sh -c xxx' to run a
|
||||
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. */
|
||||
@@ -3549,9 +3599,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
|
||||
@@ -3660,6 +3710,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;
|
||||
@@ -3720,7 +3771,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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
383
src/main.c
383
src/main.c
@@ -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
|
||||
@@ -34,9 +34,6 @@ this program. If not, see <https://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
|
||||
@@ -1152,7 +1160,11 @@ temp_stdin_unlink ()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _AMIGA
|
||||
#ifdef MK_OS_ZOS
|
||||
extern char **environ;
|
||||
#endif
|
||||
|
||||
#if defined(_AMIGA) || defined(MK_OS_ZOS)
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
#else
|
||||
@@ -1182,11 +1194,6 @@ main (int argc, char **argv, char **envp)
|
||||
/* Useful for attaching debuggers, etc. */
|
||||
SPIN ("main-entry");
|
||||
|
||||
/* Don't die if our stdout sends us SIGPIPE. */
|
||||
#ifdef SIGPIPE
|
||||
bsd_signal (SIGPIPE, SIG_IGN);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_ATEXIT
|
||||
if (ANY_SET (check_io_state (), IO_STDOUT_OK))
|
||||
atexit (close_stdout);
|
||||
@@ -1264,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);
|
||||
@@ -1438,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
|
||||
@@ -1454,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
|
||||
@@ -1469,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;
|
||||
@@ -1505,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 == '-')
|
||||
{
|
||||
@@ -1574,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:
|
||||
@@ -1601,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)
|
||||
@@ -1681,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;
|
||||
@@ -1814,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
|
||||
@@ -1905,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
|
||||
@@ -1930,6 +1946,9 @@ main (int argc, char **argv, char **envp)
|
||||
_("Makefile from standard input specified twice"));
|
||||
|
||||
outfile = get_tmpfile (&newnm);
|
||||
if (!outfile)
|
||||
O (fatal, NILF,
|
||||
_("cannot store makefile from stdin to a temporary file"));
|
||||
|
||||
while (!feof (stdin) && ! ferror (stdin))
|
||||
{
|
||||
@@ -1987,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;
|
||||
@@ -2021,7 +2040,7 @@ main (int argc, char **argv, char **envp)
|
||||
|
||||
/* 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 ();
|
||||
@@ -2071,12 +2090,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
|
||||
@@ -2259,7 +2278,7 @@ 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. */
|
||||
@@ -2419,7 +2438,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;
|
||||
@@ -2782,7 +2801,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 {
|
||||
@@ -2811,7 +2830,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;
|
||||
@@ -2999,7 +3018,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;
|
||||
|
||||
@@ -3032,7 +3051,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
|
||||
@@ -3052,11 +3071,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;
|
||||
|
||||
@@ -3100,14 +3120,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;
|
||||
|
||||
@@ -3118,7 +3147,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;
|
||||
|
||||
@@ -3134,7 +3163,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
|
||||
@@ -3148,7 +3177,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)
|
||||
{
|
||||
@@ -3161,7 +3195,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:
|
||||
@@ -3194,6 +3232,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;
|
||||
}
|
||||
|
||||
@@ -3227,7 +3267,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)
|
||||
@@ -3235,9 +3279,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;
|
||||
|
||||
@@ -3269,11 +3319,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:
|
||||
@@ -3282,8 +3340,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;
|
||||
}
|
||||
@@ -3298,9 +3360,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. */
|
||||
@@ -3309,9 +3371,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).
|
||||
@@ -3319,8 +3378,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;
|
||||
@@ -3382,7 +3441,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
|
||||
@@ -3407,11 +3466,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-*-";
|
||||
@@ -3467,7 +3526,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;
|
||||
@@ -3596,25 +3655,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] == '-')
|
||||
@@ -3632,6 +3690,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. */
|
||||
|
||||
@@ -3659,7 +3730,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\
|
||||
|
||||
@@ -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
|
||||
@@ -18,28 +18,6 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
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.
|
||||
@@ -251,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>
|
||||
@@ -296,6 +282,10 @@ char *strerror (int errnum);
|
||||
# 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
|
||||
@@ -406,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. */
|
||||
@@ -414,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
|
||||
@@ -463,14 +456,13 @@ 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
|
||||
|
||||
#define STOP_SET(_v,_m) ANY_SET(stopchar_map[(unsigned char)(_v)],(_m))
|
||||
|
||||
/* True if C is a directory separator on the current system. */
|
||||
#define ISDIRSEP(c) STOP_SET((c),MAP_DIRSEP)
|
||||
/* True if C is whitespace but not newline. */
|
||||
#define ISBLANK(c) STOP_SET((c),MAP_BLANK)
|
||||
/* True if C is whitespace including newlines. */
|
||||
@@ -480,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
|
||||
@@ -558,7 +562,12 @@ void out_of_memory (void) 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;
|
||||
@@ -693,9 +702,6 @@ char *getwd (void);
|
||||
# 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
|
||||
|
||||
@@ -704,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, size_t 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
|
||||
@@ -736,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;
|
||||
@@ -755,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;
|
||||
|
||||
107
src/misc.c
107
src/misc.c
@@ -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
|
||||
@@ -20,8 +20,7 @@ this program. If not, see <https://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 <https://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
|
||||
@@ -159,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. */
|
||||
@@ -650,11 +654,19 @@ get_tmppath ()
|
||||
# ifdef HAVE_MKTEMP
|
||||
path = get_tmptemplate ();
|
||||
if (*mktemp (path) == '\0')
|
||||
pfatal_with_name ("mktemp");
|
||||
{
|
||||
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");
|
||||
{
|
||||
OS (error, NILF,
|
||||
_("cannot generate temp name: %s"), strerror (errno));
|
||||
return NULL;
|
||||
}
|
||||
# endif
|
||||
|
||||
return path;
|
||||
@@ -662,7 +674,9 @@ get_tmppath ()
|
||||
#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)
|
||||
{
|
||||
@@ -670,9 +684,11 @@ 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;
|
||||
@@ -689,13 +705,19 @@ 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
|
||||
if (fd < 0)
|
||||
OSS (fatal, NILF,
|
||||
_("create temporary file %s: %s"), tmpnm, strerror (errno));
|
||||
{
|
||||
OSS (error, NILF,
|
||||
_("cannot create temporary file %s: %s"), tmpnm, strerror (errno));
|
||||
free (tmpnm);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (name)
|
||||
*name = tmpnm;
|
||||
@@ -704,8 +726,8 @@ get_tmpfd (char **name)
|
||||
int r;
|
||||
EINTRLOOP (r, unlink (tmpnm));
|
||||
if (r < 0)
|
||||
OSS (fatal, NILF,
|
||||
_("unlink temporary file %s: %s"), tmpnm, strerror (errno));
|
||||
OSS (error, NILF,
|
||||
_("cannot unlink temporary file %s: %s"), tmpnm, strerror (errno));
|
||||
free (tmpnm);
|
||||
}
|
||||
|
||||
@@ -715,8 +737,8 @@ get_tmpfd (char **name)
|
||||
}
|
||||
|
||||
/* 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.
|
||||
Note, this cannot be NULL! */
|
||||
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)
|
||||
{
|
||||
@@ -725,26 +747,37 @@ get_tmpfile (char **name)
|
||||
FILE *file;
|
||||
|
||||
#if defined(HAVE_FDOPEN)
|
||||
int fd = get_tmpfd (name);
|
||||
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 (fatal, NILF,
|
||||
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);
|
||||
int err;
|
||||
|
||||
assert (name);
|
||||
*name = get_tmppath ();
|
||||
if (!*name)
|
||||
return NULL;
|
||||
|
||||
/* Although this fopen is insecure, it is executed only on non-fdopen
|
||||
platforms, which should be a rarity nowadays. */
|
||||
|
||||
ENULLLOOP (file, fopen (*name, tmpfile_mode));
|
||||
if (file == NULL)
|
||||
OSS (fatal, NILF,
|
||||
_("fopen: temporary file %s: %s"), *name, strerror (errno));
|
||||
{
|
||||
OSS (error, NILF,
|
||||
_("fopen: temporary file %s: %s"), *name, strerror (errno));
|
||||
free (*name);
|
||||
*name = NULL;
|
||||
}
|
||||
|
||||
umask (mask);
|
||||
#endif
|
||||
@@ -753,6 +786,40 @@ get_tmpfile (char **name)
|
||||
}
|
||||
|
||||
|
||||
#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. */
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Autoconf values for use on non-POSIX systems.
|
||||
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
|
||||
|
||||
65
src/mkcustom.h
Normal file
65
src/mkcustom.h
Normal 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
|
||||
2
src/os.h
2
src/os.h
@@ -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
|
||||
|
||||
14
src/output.c
14
src/output.c
@@ -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
|
||||
@@ -18,7 +18,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
#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>
|
||||
@@ -248,6 +248,9 @@ setup_tmpfile (struct output *out)
|
||||
|
||||
/* 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 ();
|
||||
@@ -282,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)
|
||||
@@ -366,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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -24,6 +24,10 @@ this program. If not, see <https://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
|
||||
@@ -132,6 +136,9 @@ set_blocking (int fd, int blocking)
|
||||
if (r < 0)
|
||||
pfatal_with_name ("fcntl(O_NONBLOCK)");
|
||||
}
|
||||
#else
|
||||
(void) fd;
|
||||
(void) blocking;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -140,8 +147,8 @@ 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)
|
||||
{
|
||||
/* 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
|
||||
@@ -167,12 +174,12 @@ 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));
|
||||
|
||||
js_type = js_fifo;
|
||||
@@ -183,7 +190,7 @@ 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)
|
||||
@@ -229,14 +236,19 @@ 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. */
|
||||
@@ -612,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)
|
||||
@@ -867,12 +879,15 @@ os_anontmp ()
|
||||
FILE *tfile;
|
||||
ENULLLOOP (tfile, tmpfile ());
|
||||
if (!tfile)
|
||||
pfatal_with_name ("tmpfile");
|
||||
{
|
||||
OS (error, NILF, "tmpfile: %s", strerror (errno));
|
||||
return -1;
|
||||
}
|
||||
umask (mask);
|
||||
|
||||
EINTRLOOP (fd, dup (fileno (tfile)));
|
||||
if (fd < 0)
|
||||
pfatal_with_name ("dup");
|
||||
OS (error, NILF, "dup: %s", strerror (errno));
|
||||
fclose (tfile);
|
||||
}
|
||||
#endif
|
||||
|
||||
41
src/read.c
41
src/read.c
@@ -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
|
||||
@@ -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,8 +365,9 @@ 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)
|
||||
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)
|
||||
@@ -403,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);
|
||||
|
||||
@@ -1140,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"));
|
||||
}
|
||||
|
||||
{
|
||||
|
||||
66
src/remake.c
66
src/remake.c
@@ -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
|
||||
@@ -38,7 +38,7 @@ this program. If not, see <https://www.gnu.org/licenses/>. */
|
||||
#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
|
||||
@@ -109,6 +109,7 @@ check_also_make (const struct file *file)
|
||||
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;
|
||||
|
||||
@@ -134,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;
|
||||
@@ -491,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);
|
||||
|
||||
@@ -500,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
|
||||
@@ -734,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 us_success;
|
||||
}
|
||||
|
||||
DBF (DB_VERBOSE, _("Finished prerequisites of target file '%s'.\n"));
|
||||
|
||||
/* If any dependency failed, give up now. */
|
||||
|
||||
if (dep_status)
|
||||
@@ -752,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
|
||||
@@ -828,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;
|
||||
@@ -871,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);
|
||||
|
||||
@@ -957,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
|
||||
@@ -998,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;
|
||||
}
|
||||
|
||||
@@ -1083,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;
|
||||
@@ -1181,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;
|
||||
|
||||
@@ -1340,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;
|
||||
@@ -1348,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);
|
||||
@@ -1391,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
|
||||
@@ -1466,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Convert between signal names and numbers.
|
||||
Copyright (C) 1990-2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990-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
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Constant string caching for GNU Make.
|
||||
Copyright (C) 2006-2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 2006-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
|
||||
@@ -53,7 +53,7 @@ static unsigned long total_size = 0;
|
||||
|
||||
/* Add a new buffer to the cache. Add it at the front to reduce search time.
|
||||
This can also increase the overhead, since it's less likely that older
|
||||
buffers will be filled in. However, GNU make has so many smaller strings
|
||||
buffers will be filled in. However, GNU Make has so many smaller strings
|
||||
that this doesn't seem to be much of an issue in practice.
|
||||
*/
|
||||
static struct strcache *
|
||||
|
||||
165
src/variable.c
165
src/variable.c
@@ -1,5 +1,5 @@
|
||||
/* Internals of variables 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
|
||||
@@ -472,7 +472,7 @@ lookup_variable (const char *name, size_t length)
|
||||
const struct variable_set *set = setlist->set;
|
||||
struct variable *v;
|
||||
|
||||
v = (struct variable *) hash_find_item ((struct hash_table *) &set->table, &var_key);
|
||||
v = hash_find_item ((struct hash_table *) &set->table, &var_key);
|
||||
if (v && (!is_parent || !v->private_var))
|
||||
return v->special ? lookup_special_var (v) : v;
|
||||
|
||||
@@ -538,6 +538,29 @@ lookup_variable (const char *name, size_t length)
|
||||
|
||||
return 0;
|
||||
}
|
||||
/* Lookup a variable whose name is a string starting at NAME
|
||||
and with LENGTH chars. NAME need not be null-terminated.
|
||||
Returns address of the 'struct variable' containing all info
|
||||
on the variable, or nil if no such variable is defined. */
|
||||
|
||||
struct variable *
|
||||
lookup_variable_for_file (const char *name, size_t length, struct file *file)
|
||||
{
|
||||
struct variable *var;
|
||||
struct variable_set_list *savev;
|
||||
|
||||
if (file == NULL)
|
||||
return lookup_variable (name, length);
|
||||
|
||||
savev = current_variable_set_list;
|
||||
current_variable_set_list = file->variables;
|
||||
|
||||
var = lookup_variable (name, length);
|
||||
|
||||
current_variable_set_list = savev;
|
||||
|
||||
return var;
|
||||
}
|
||||
|
||||
/* Lookup a variable whose name is a string starting at NAME
|
||||
and with LENGTH chars in set SET. NAME need not be null-terminated.
|
||||
@@ -553,7 +576,7 @@ lookup_variable_in_set (const char *name, size_t length,
|
||||
var_key.name = (char *) name;
|
||||
var_key.length = (unsigned int) length;
|
||||
|
||||
return (struct variable *) hash_find_item ((struct hash_table *) &set->table, &var_key);
|
||||
return hash_find_item ((struct hash_table *) &set->table, &var_key);
|
||||
}
|
||||
|
||||
/* Initialize FILE's variable set list. If FILE already has a variable set
|
||||
@@ -905,7 +928,7 @@ define_automatic_variables (void)
|
||||
if (!replace || !*replace->value)
|
||||
replace = lookup_variable ("OS2_SHELL", 9);
|
||||
# else
|
||||
# warning NO_CMD_DEFAULT: GNU make will not use CMD.EXE as default shell
|
||||
# warning NO_CMD_DEFAULT: GNU Make will not use CMD.EXE as default shell
|
||||
# endif
|
||||
|
||||
if (replace && *replace->value)
|
||||
@@ -1065,7 +1088,8 @@ target_environment (struct file *file, int recursive)
|
||||
for (s = set_list; s != 0; s = s->next)
|
||||
{
|
||||
struct variable_set *set = s->set;
|
||||
int isglobal = set == &global_variable_set;
|
||||
const int islocal = s == set_list;
|
||||
const int isglobal = set == &global_variable_set;
|
||||
|
||||
v_slot = (struct variable **) set->table.ht_vec;
|
||||
v_end = v_slot + set->table.ht_size;
|
||||
@@ -1075,11 +1099,17 @@ target_environment (struct file *file, int recursive)
|
||||
struct variable **evslot;
|
||||
struct variable *v = *v_slot;
|
||||
|
||||
if (!islocal && v->private_var)
|
||||
continue;
|
||||
|
||||
evslot = (struct variable **) hash_find_slot (&table, v);
|
||||
|
||||
if (HASH_VACANT (*evslot))
|
||||
{
|
||||
/* If we're not global, or we are and should export, add it. */
|
||||
/* We'll always add target-specific variables, since we may
|
||||
discover that they should be exported later: we'll check
|
||||
again below. For global variables only add them if they're
|
||||
exportable. */
|
||||
if (!isglobal || should_export (v))
|
||||
hash_insert_at (&table, v, evslot);
|
||||
}
|
||||
@@ -1107,8 +1137,9 @@ target_environment (struct file *file, int recursive)
|
||||
|
||||
/* If V is recursively expanded and didn't come from the environment,
|
||||
expand its value. If it came from the environment, it should
|
||||
go back into the environment unchanged. */
|
||||
if (v->recursive && v->origin != o_env && v->origin != o_env_override)
|
||||
go back into the environment unchanged... except MAKEFLAGS. */
|
||||
if (v->recursive && ((v->origin != o_env && v->origin != o_env_override)
|
||||
|| streq (v->name, MAKEFLAGS_NAME)))
|
||||
value = cp = recursively_expand_for_file (v, file);
|
||||
|
||||
/* If this is the SHELL variable remember we already added it. */
|
||||
@@ -1215,17 +1246,18 @@ target_environment (struct file *file, int recursive)
|
||||
}
|
||||
|
||||
static struct variable *
|
||||
set_special_var (struct variable *var)
|
||||
set_special_var (struct variable *var, enum variable_origin origin)
|
||||
{
|
||||
if (streq (var->name, RECIPEPREFIX_NAME))
|
||||
if (streq (var->name, MAKEFLAGS_NAME))
|
||||
reset_makeflags (origin);
|
||||
|
||||
else if (streq (var->name, RECIPEPREFIX_NAME))
|
||||
{
|
||||
/* The user is resetting the command introduction prefix. This has to
|
||||
happen immediately, so that subsequent rules are interpreted
|
||||
properly. */
|
||||
cmd_prefix = var->value[0]=='\0' ? RECIPEPREFIX_DEFAULT : var->value[0];
|
||||
}
|
||||
else if (streq (var->name, MAKEFLAGS_NAME))
|
||||
decode_env_switches (STRING_SIZE_TUPLE(MAKEFLAGS_NAME));
|
||||
|
||||
return var;
|
||||
}
|
||||
@@ -1261,7 +1293,7 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
const char *value, enum variable_origin origin,
|
||||
enum variable_flavor flavor, int target_var)
|
||||
{
|
||||
const char *p;
|
||||
const char *newval;
|
||||
char *alloc_value = NULL;
|
||||
struct variable *v;
|
||||
int append = 0;
|
||||
@@ -1276,7 +1308,7 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
We have to allocate memory since otherwise it'll clobber the
|
||||
variable buffer, and we may still need that if we're looking at a
|
||||
target-specific variable. */
|
||||
p = alloc_value = allocated_variable_expand (value);
|
||||
newval = alloc_value = allocated_variable_expand (value);
|
||||
break;
|
||||
case f_expand:
|
||||
{
|
||||
@@ -1285,16 +1317,16 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
tokens to '$$' to resolve to '$' when recursively expanded. */
|
||||
char *t = allocated_variable_expand (value);
|
||||
char *np = alloc_value = xmalloc (strlen (t) * 2 + 1);
|
||||
p = t;
|
||||
while (p[0] != '\0')
|
||||
char *op = t;
|
||||
while (op[0] != '\0')
|
||||
{
|
||||
if (p[0] == '$')
|
||||
if (op[0] == '$')
|
||||
*(np++) = '$';
|
||||
*(np++) = *(p++);
|
||||
*(np++) = *(op++);
|
||||
}
|
||||
*np = '\0';
|
||||
p = alloc_value;
|
||||
free (t);
|
||||
newval = alloc_value;
|
||||
break;
|
||||
}
|
||||
case f_shell:
|
||||
@@ -1302,9 +1334,10 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
/* A shell definition "var != value". Expand value, pass it to
|
||||
the shell, and store the result in recursively-expanded var. */
|
||||
char *q = allocated_variable_expand (value);
|
||||
p = alloc_value = shell_result (q);
|
||||
alloc_value = shell_result (q);
|
||||
free (q);
|
||||
flavor = f_recursive;
|
||||
newval = alloc_value;
|
||||
break;
|
||||
}
|
||||
case f_conditional:
|
||||
@@ -1320,7 +1353,7 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
case f_recursive:
|
||||
/* A recursive variable definition "var = value".
|
||||
The value is used verbatim. */
|
||||
p = value;
|
||||
newval = value;
|
||||
break;
|
||||
case f_append:
|
||||
case f_append_value:
|
||||
@@ -1345,15 +1378,16 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
{
|
||||
/* There was no old value.
|
||||
This becomes a normal recursive definition. */
|
||||
p = value;
|
||||
newval = value;
|
||||
flavor = f_recursive;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Paste the old and new values together in VALUE. */
|
||||
|
||||
size_t oldlen, vallen;
|
||||
size_t oldlen, vallen, alloclen;
|
||||
const char *val;
|
||||
char *cp;
|
||||
char *tp = NULL;
|
||||
|
||||
val = value;
|
||||
@@ -1378,18 +1412,25 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
}
|
||||
|
||||
oldlen = strlen (v->value);
|
||||
p = alloc_value = xmalloc (oldlen + 1 + vallen + 1);
|
||||
alloclen = oldlen + 1 + vallen + 1;
|
||||
cp = alloc_value = xmalloc (alloclen);
|
||||
|
||||
if (oldlen)
|
||||
{
|
||||
memcpy (alloc_value, v->value, oldlen);
|
||||
alloc_value[oldlen] = ' ';
|
||||
++oldlen;
|
||||
char *s;
|
||||
if (streq (varname, MAKEFLAGS_NAME)
|
||||
&& (s = strstr (v->value, " -- ")))
|
||||
/* We found a separator in MAKEFLAGS. Ignore variable
|
||||
assignments: set_special_var() will reconstruct things. */
|
||||
cp = mempcpy (cp, v->value, s - v->value);
|
||||
else
|
||||
cp = mempcpy (cp, v->value, oldlen);
|
||||
*(cp++) = ' ';
|
||||
}
|
||||
|
||||
memcpy (&alloc_value[oldlen], val, vallen + 1);
|
||||
|
||||
memcpy (cp, val, vallen + 1);
|
||||
free (tp);
|
||||
newval = alloc_value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -1399,6 +1440,8 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
abort ();
|
||||
}
|
||||
|
||||
assert (newval);
|
||||
|
||||
#ifdef __MSDOS__
|
||||
/* Many Unix Makefiles include a line saying "SHELL=/bin/sh", but
|
||||
non-Unix systems don't conform to this default configuration (in
|
||||
@@ -1440,16 +1483,16 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
char *fake_env[2];
|
||||
size_t pathlen = 0;
|
||||
|
||||
shellbase = strrchr (p, '/');
|
||||
bslash = strrchr (p, '\\');
|
||||
shellbase = strrchr (newval, '/');
|
||||
bslash = strrchr (newval, '\\');
|
||||
if (!shellbase || bslash > shellbase)
|
||||
shellbase = bslash;
|
||||
if (!shellbase && p[1] == ':')
|
||||
shellbase = p + 1;
|
||||
if (!shellbase && newval[1] == ':')
|
||||
shellbase = newval + 1;
|
||||
if (shellbase)
|
||||
shellbase++;
|
||||
else
|
||||
shellbase = p;
|
||||
shellbase = newval;
|
||||
|
||||
/* Search for the basename of the shell (with standard
|
||||
executable extensions) along the $PATH. */
|
||||
@@ -1490,7 +1533,7 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
set no_default_sh_exe to indicate sh was found and
|
||||
set new value for SHELL variable. */
|
||||
|
||||
if (find_and_set_default_shell (p))
|
||||
if (find_and_set_default_shell (newval))
|
||||
{
|
||||
v = define_variable_in_set (varname, strlen (varname), default_shell,
|
||||
origin, flavor == f_recursive,
|
||||
@@ -1504,11 +1547,11 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
{
|
||||
char *tp = alloc_value;
|
||||
|
||||
alloc_value = allocated_variable_expand (p);
|
||||
alloc_value = allocated_variable_expand (newval);
|
||||
|
||||
if (find_and_set_default_shell (alloc_value))
|
||||
{
|
||||
v = define_variable_in_set (varname, strlen (varname), p,
|
||||
v = define_variable_in_set (varname, strlen (varname), newval,
|
||||
origin, flavor == f_recursive,
|
||||
(target_var
|
||||
? current_variable_set_list->set
|
||||
@@ -1536,7 +1579,7 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
invoked in places where we want to define globally visible variables,
|
||||
make sure we define this variable in the global set. */
|
||||
|
||||
v = define_variable_in_set (varname, strlen (varname), p, origin,
|
||||
v = define_variable_in_set (varname, strlen (varname), newval, origin,
|
||||
flavor == f_recursive || flavor == f_expand,
|
||||
(target_var
|
||||
? current_variable_set_list->set : NULL),
|
||||
@@ -1546,7 +1589,7 @@ do_variable_definition (const floc *flocp, const char *varname,
|
||||
|
||||
done:
|
||||
free (alloc_value);
|
||||
return v->special ? set_special_var (v) : v;
|
||||
return v->special ? set_special_var (v, origin) : v;
|
||||
}
|
||||
|
||||
/* Parse P (a null-terminated string) as a variable definition.
|
||||
@@ -1770,6 +1813,44 @@ try_variable_definition (const floc *flocp, const char *line,
|
||||
|
||||
return vp;
|
||||
}
|
||||
|
||||
/* These variables are internal to make, and so considered "defined" for the
|
||||
purposes of warn_undefined even if they are not really defined. */
|
||||
|
||||
struct defined_vars
|
||||
{
|
||||
const char *name;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
static const struct defined_vars defined_vars[] = {
|
||||
{ STRING_SIZE_TUPLE ("MAKECMDGOALS") },
|
||||
{ STRING_SIZE_TUPLE ("MAKE_RESTARTS") },
|
||||
{ STRING_SIZE_TUPLE ("MAKE_TERMOUT") },
|
||||
{ STRING_SIZE_TUPLE ("MAKE_TERMERR") },
|
||||
{ STRING_SIZE_TUPLE ("MAKEOVERRIDES") },
|
||||
{ STRING_SIZE_TUPLE (".DEFAULT") },
|
||||
{ STRING_SIZE_TUPLE ("-*-command-variables-*-") },
|
||||
{ STRING_SIZE_TUPLE ("-*-eval-flags-*-") },
|
||||
{ STRING_SIZE_TUPLE ("VPATH") },
|
||||
{ STRING_SIZE_TUPLE ("GPATH") },
|
||||
{ NULL, 0 }
|
||||
};
|
||||
|
||||
void
|
||||
warn_undefined (const char *name, size_t len)
|
||||
{
|
||||
if (warn_undefined_variables_flag)
|
||||
{
|
||||
const struct defined_vars *dp;
|
||||
for (dp = defined_vars; dp->name != NULL; ++dp)
|
||||
if (dp->len == len && memcmp (dp->name, name, len) == 0)
|
||||
return;
|
||||
|
||||
error (reading_file, len, _("warning: undefined variable '%.*s'"),
|
||||
(int)len, name);
|
||||
}
|
||||
}
|
||||
|
||||
/* Print information for variable V, prefixing it with PREFIX. */
|
||||
|
||||
@@ -1947,8 +2028,10 @@ sync_Path_environment ()
|
||||
if (!path)
|
||||
return;
|
||||
|
||||
/* Convert PATH into something WINDOWS32 world can grok. */
|
||||
convert_Path_to_windows32 (path, ';');
|
||||
/* Convert the value of PATH into something WINDOWS32 world can grok.
|
||||
Note: convert_Path_to_windows32 must see only the value of PATH,
|
||||
and see it from its first character, to do its tricky job. */
|
||||
convert_Path_to_windows32 (path + CSTRLEN ("PATH="), ';');
|
||||
|
||||
environ_path = path;
|
||||
putenv (environ_path);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Definitions for using variables 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
|
||||
@@ -182,6 +182,8 @@ void define_new_function(const floc *flocp, const char *name,
|
||||
unsigned int min, unsigned int max, unsigned int flags,
|
||||
gmk_func_ptr func);
|
||||
struct variable *lookup_variable (const char *name, size_t length);
|
||||
struct variable *lookup_variable_for_file (const char *name, size_t length,
|
||||
struct file *file);
|
||||
struct variable *lookup_variable_in_set (const char *name, size_t length,
|
||||
const struct variable_set *set);
|
||||
|
||||
@@ -191,6 +193,7 @@ struct variable *define_variable_in_set (const char *name, size_t length,
|
||||
int recursive,
|
||||
struct variable_set *set,
|
||||
const floc *flocp);
|
||||
void warn_undefined (const char* name, size_t length);
|
||||
|
||||
/* Define a variable in the current variable set. */
|
||||
|
||||
@@ -229,15 +232,6 @@ void undefine_variable_in_set (const char *name, size_t length,
|
||||
#define undefine_variable_global(n,l,o) \
|
||||
undefine_variable_in_set((n),(l),(o),NULL)
|
||||
|
||||
/* Warn that NAME is an undefined variable. */
|
||||
|
||||
#define warn_undefined(n,l) do{\
|
||||
if (warn_undefined_variables_flag) \
|
||||
error (reading_file, (l), \
|
||||
_("warning: undefined variable '%.*s'"), \
|
||||
(int)(l), (n)); \
|
||||
}while(0)
|
||||
|
||||
char **target_environment (struct file *file, int recursive);
|
||||
|
||||
struct pattern_var *create_pattern_var (const char *target,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* Record version and build host architecture for GNU make.
|
||||
Copyright (C) 1988-2022 Free Software Foundation, Inc.
|
||||
/* Record version and build host architecture for GNU Make.
|
||||
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
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* Author: John E. Malmberg
|
||||
*/
|
||||
|
||||
/* Copyright (C) 2014-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2014-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 Software
|
||||
@@ -36,7 +36,7 @@ decc$exit (int status);
|
||||
#endif
|
||||
|
||||
/* Lowest legal non-success VMS exit code is 8 */
|
||||
/* GNU make only defines codes 0, 1, 2 */
|
||||
/* GNU Make only defines codes 0, 1, 2 */
|
||||
/* So assume any exit code > 8 is a VMS exit code */
|
||||
|
||||
#ifndef MAX_EXPECTED_EXIT_CODE
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
* DCL symbols.
|
||||
*/
|
||||
|
||||
/* Copyright (C) 2014-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 2014-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 Software
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user