Compare commits

...

11 Commits

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

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

* src/main.c (main): Set default suffix rules after parsing makefiles.
* src/default.c (install_default_suffix_rules): Install a default
suffix rule only if there is no user defined rule.
* tests/scripts/features/suffixrules: Add tests.
2023-02-20 15:17:24 -05:00
Paul Smith
f5dc17ac2d * tests/scripts/misc/general4: Only test empty PATH on UNIX 2023-02-20 11:11:59 -05:00
Paul Smith
ac159491da * gl/modules/make-glob: Avoid glibc glob if bug #866 is present 2023-02-19 17:43:12 -05:00
Paul Smith
4436655568 * tests/scripts/features/include [AIX]: Set explicit timestamps 2023-02-19 15:35:22 -05:00
Paul Smith
549fc56102 * tests/scripts/features/archives: Set CC properly 2023-02-19 14:49:56 -05:00
20 changed files with 246 additions and 89 deletions

View File

@@ -171,7 +171,8 @@ errorpre = makeerror-$(PACKAGE_VERSION)-$(host_triplet)
testfiles = $(testlog) $(testresult) $(errorfile)
MOSTLYCLEANFILES = $(testfiles)
errordetails = config.status config.log src/config.h $(testlog) tests/work
errordetails = config.status config.log src/config.h src/mkconfig.h \
$(testlog) tests/work
# Create a 4-letter random sequence
rand_value = c = "abcdefghijklmnopqrstuvwxyz0123456789"

18
NEWS
View File

@@ -1,6 +1,6 @@
GNU Make NEWS -*-indented-text-*-
History of user-visible changes.
19 February 2023
26 February 2023
See the end of this file for copyrights and conditions.
@@ -10,7 +10,7 @@ See the README file and the GNU Make manual for instructions for
reporting bugs.
Version 4.4.0.91 (19 Feb 2023)
Version 4.4.1 (26 Feb 2023)
This release is primarily a bug-fix release.
A complete list of bugs fixed in this version is available here:
@@ -32,22 +32,22 @@ https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=110&se
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.
* Updates to allow building on OS/2
Provided by KO Myung-Hun <komh78@gmail.com>
* New platform: GNU Make is supported on z/OS
Thanks to Igor Todorovski <itodorov@ca.ibm.com> for the patches and testing
assistance.
Version 4.4 (31 Oct 2022)

View File

@@ -1,5 +1,5 @@
This version of GNU Make has been tested on:
Microsoft Windows 2000/XP/2003/Vista/7/8/10
Microsoft Windows 2000/XP/2003/Vista/7/8/10/11
It has also been used on Windows 95/98/NT, and on OS/2.
It builds with the MinGW port of GCC (tested with GCC 3.4.2, 4.8.1,

View File

@@ -251,6 +251,7 @@ consistent (that's why we don't finalize the Git tag, etc. until the end).
* Update the configure.ac file with the new release number.
* Update the EDITION value in the doc/make.texi file.
* Update the doc/make.1 file with the release date.
* Update the NEWS file with the release number and date.
* Ensure the Savannah bug list URL in the NEWS file uses the correct
"Fixed Release" ID number.

View File

@@ -28,7 +28,7 @@ if "%1" == "-h" goto Usage
if "%1" == "--help" goto Usage
echo.
echo Creating GNU Make for Windows 9X/NT/2K/XP/Vista/7/8/10
echo Creating GNU Make for Windows 9X/NT/2K/XP/Vista/7/8/10/11
echo.
set MAKE=gnumake

View File

@@ -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.0.91],[bug-make@gnu.org])
AC_INIT([GNU Make],[4.4.1],[bug-make@gnu.org])
AC_PREREQ([2.69])
@@ -353,14 +353,14 @@ AS_CASE([/$make_cv_load/$user_load/],
# For example passing -rdynamic to the SunPRO linker gives a warning
# but succeeds and creates a shared object, not an executable!
AS_IF([test "$make_cv_load" = yes], [
AC_MSG_CHECKING([If the linker accepts -Wl,--export-dynamic])
AC_MSG_CHECKING([if the linker accepts -Wl,--export-dynamic])
old_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])],
[AC_MSG_RESULT([yes])
AC_SUBST([AM_LDFLAGS], [-Wl,--export-dynamic])],
[AC_MSG_RESULT([no])
AC_MSG_CHECKING([If the linker accepts -rdynamic])
AC_MSG_CHECKING([if the linker accepts -rdynamic])
LDFLAGS="$old_LDFLAGS -rdynamic"
AC_LINK_IFELSE([AC_LANG_SOURCE([int main(){}])],
[AC_MSG_RESULT([yes])

View File

@@ -1,4 +1,4 @@
.TH MAKE 1 "31 May 2022" "GNU" "User Commands"
.TH MAKE 1 "26 May 2023" "GNU" "User Commands"
.SH NAME
make \- GNU Make utility to maintain groups of programs
.SH SYNOPSIS
@@ -76,9 +76,8 @@ listing, right near other important files such as
The first name checked,
.IR GNUmakefile ,
is not recommended for most makefiles. You should use this name if you have a
makefile that is specific to GNU
.BR make ,
and will not be understood by other versions of
makefile that is specific to GNU Make, and will not be understood by other
versions of
.BR make .
If
.I makefile
@@ -368,9 +367,7 @@ except that the modification time is changed only in the imagination of
.B \-\-warn\-undefined\-variables
Warn when an undefined variable is referenced.
.SH "EXIT STATUS"
GNU
.B make
exits with a status of zero if all makefiles were successfully parsed
GNU Make exits with a status of zero if all makefiles were successfully parsed
and no targets that were built failed. A status of one will be returned
if the
.B \-q

View File

@@ -3,7 +3,7 @@
@setfilename make.info
@include version.texi
@set EDITION 0.76
@set EDITION 0.77
@settitle GNU @code{make}
@setchapternewpage odd

View File

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

View File

@@ -707,7 +707,7 @@ set_default_suffixes (void)
installed after. */
void
install_default_suffix_rules (void)
install_default_suffix_rules ()
{
const char **s;
@@ -717,14 +717,16 @@ install_default_suffix_rules (void)
for (s = default_suffix_rules; *s != 0; s += 2)
{
struct file *f = enter_file (strcache_add (s[0]));
/* This function should run before any makefile is parsed. */
assert (f->cmds == 0);
f->cmds = xmalloc (sizeof (struct commands));
f->cmds->fileinfo.filenm = 0;
f->cmds->commands = xstrdup (s[1]);
f->cmds->command_lines = 0;
f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
f->builtin = 1;
/* Install the default rule only if there is no user defined rule. */
if (!f->cmds)
{
f->cmds = xmalloc (sizeof (struct commands));
f->cmds->fileinfo.filenm = NULL;
f->cmds->commands = xstrdup (s[1]);
f->cmds->command_lines = NULL;
f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
f->builtin = 1;
}
}
}

View File

@@ -1420,9 +1420,16 @@ start_job_command (struct child *child)
child->deleted = 0;
#ifndef _AMIGA
/* Set up the environment for the child. */
/* Set up the environment for the child.
It's a slight inaccuracy to set the environment for recursive make even
for command lines that aren't recursive, but I don't want to have to
recompute the target environment for each command. Better would be to
keep a separate entry for MAKEFLAGS in the environment so it could be
replaced on its own. For now just set it for all lines.
*/
if (child->environment == 0)
child->environment = target_environment (child->file, child->recursive);
child->environment = target_environment (child->file,
child->file->cmds->any_recurse);
#endif
#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)

View File

@@ -2028,13 +2028,6 @@ main (int argc, char **argv, char **envp)
/* Define the initial list of suffixes for old-style rules. */
set_default_suffixes ();
/* Define the file rules for the built-in suffix rules. These will later
be converted into pattern rules. We used to do this in
install_default_implicit_rules, but since that happens after reading
makefiles, it results in the built-in pattern rules taking precedence
over makefile-specified suffix rules, which is wrong. */
install_default_suffix_rules ();
/* Define some internal and special variables. */
define_automatic_variables ();
@@ -2285,6 +2278,11 @@ main (int argc, char **argv, char **envp)
snap_deps ();
/* Define the file rules for the built-in suffix rules. These will later
be converted into pattern rules. */
install_default_suffix_rules ();
/* Convert old-style suffix rules to pattern rules. It is important to
do this before installing the built-in pattern rules below, so that
makefile-specified suffix rules take precedence over built-in pattern

View File

@@ -265,16 +265,16 @@ mylib.a: mylib.a(a.o b.o)
!,
$vars, "Compile a.c\nCompile b.c\n$ar $arflags mylib.a a.o b.o\n${create2}rm b.o a.o");
run_make_test(undef, $arvar, "#MAKE#: 'mylib.a' is up to date.");
run_make_test(undef, $vars, "#MAKE#: 'mylib.a' is up to date.");
# Now update one of the source files and it should be compiled and archived
sleep(2);
touch('b.c');
run_make_test(undef, $arvar, "Compile b.c\n$ar $arflags mylib.a b.o\n${add2}rm b.o");
run_make_test(undef, $vars, "Compile b.c\n$ar $arflags mylib.a b.o\n${add2}rm b.o");
run_make_test(undef, $arvar, "#MAKE#: 'mylib.a' is up to date.");
run_make_test(undef, $vars, "#MAKE#: 'mylib.a' is up to date.");
unlink('a.c', 'b.c', 'a.o', 'b.o', 'mylib.a');
}

View File

@@ -476,14 +476,16 @@ all: ;
# Test that included makefiles are not intermediate.
# Here 'test.foo' is mentioned explicitly and cannot be considered
# intermediate.
&touch('test.foo', 'test.x', 'test');
utouch(-10, 'test.foo');
utouch(-5, 'test.x');
touch('test');
run_make_test(q!
.PHONY: force
include test.foo
%.foo: force; touch -a $@
%.foo: force; @echo force $@
%.x: %.foo; touch $@
test: test.x; touch $@
!, '', "touch -a test.foo\n#MAKE#: 'test' is up to date.\n");
!, '', "force test.foo\n#MAKE#: 'test' is up to date.\n");
unlink('test.foo', 'test.x', 'test');

View File

@@ -132,6 +132,42 @@ all a: ; @echo $@
'--jobserver-style=foo -j8',
"#MAKE#: *** unknown jobserver auth style 'foo'. Stop.", 512);
# Ensure the jobserver is not disabled even if only later commands are recursive
run_make_test(q!
.RECIPEPREFIX := >
all:
> @echo $@ 1
> @echo $@ 2
> @$(MAKE) -f #MAKEFILE# recurse
recurse: ; @echo $@
!,
"$np -j8", "all 1\nall 2\nrecurse");
if ($port_type ne 'W32') {
run_make_test(undef, "$np --jobserver-style=pipe -j8",
"all 1\nall 2\nrecurse");
}
# And with + instead of $(MAKE)
run_make_test(q!
.RECIPEPREFIX := >
all:
> @echo $@ 1
> @echo $@ 2
> @+#MAKEPATH# -f #MAKEFILE# recurse
recurse: ; @echo $@
!,
"$np -j8", "all 1\nall 2\nrecurse");
if ($port_type ne 'W32') {
run_make_test(undef, "$np --jobserver-style=pipe -j8",
"all 1\nall 2\nrecurse");
}
if (exists $FEATURES{'jobserver-fifo'}) {
# sv 62908.
# Test that when mkfifo fails, make switches to pipe and succeeds.

View File

@@ -95,5 +95,70 @@ run_make_test(undef,
unlink('foo.baz', 'foo.biz', 'foo.bar');
touch('hello.c');
unlink('hello.o');
# sv 63821.
# Default suffix rule .c.o.
run_make_test('all: hello.o', 'COMPILE.c=@echo OUTPUT_OPTION=', 'hello.c');
# User defined rules beat built-in rules.
run_make_test(q!
all: hello.o
.c.o:; $(info $@ user defined .c.o rule)
!, '', "hello.o user defined .c.o rule\n#MAKE#: Nothing to be done for 'all'.\n");
# sv 63821.
# The same as above, but suffixes are cleared.
run_make_test(q!
all: hello.o
.SUFFIXES:
.c.o:; $(info $@ user defined .c.o rule)
!, '', "#MAKE#: *** No rule to make target 'hello.o', needed by 'all'. Stop.\n", 512);
# sv 63821.
# Suffixes are cleared and defined in the makefile.
run_make_test(q!
all: hello.o
.SUFFIXES:
.SUFFIXES: .c .o
.c.o:; $(info $@ user defined .c.o rule)
!, '', "hello.o user defined .c.o rule\n#MAKE#: Nothing to be done for 'all'.\n");
# sv 63821.
# When built-in rules are disabled, but certain suffixes are added to
# .SUFFIXES, make should exit with the 'No rule...' error message.
run_make_test(q!
.SUFFIXES: .c .o
all: hello.o
!, '-r', "#MAKE#: *** No rule to make target 'hello.o', needed by 'all'. Stop.\n", 512);
# sv 63821.
# Same as above, but this time built-in rules are disabled inside the makefile.
run_make_test(q!
MAKEFLAGS += -r
.SUFFIXES: .c .o
all: hello.o
!, '', "#MAKE#: *** No rule to make target 'hello.o', needed by 'all'. Stop.\n", 512);
# sv 63821.
# Same as above, but this time there is a rule.
run_make_test(q!
all: hello.o
MAKEFLAGS += -r
.SUFFIXES: .c .o
.c.o:; $(info $@ user defined .c.o rule)
!, '', "hello.o user defined .c.o rule\n#MAKE#: Nothing to be done for 'all'.\n");
unlink('hello.c', 'hello.o');
# Complete
1;

View File

@@ -136,11 +136,13 @@ all: ; $sname
unlink($sname);
# SV 57674: ensure we use a system default PATH if one is not set
delete $ENV{PATH};
run_make_test(q!
if ($port_type eq 'UNIX') {
# SV 57674: ensure we use a system default PATH if one is not set
delete $ENV{PATH};
run_make_test(q!
a: ; @echo hi
!,
'', "hi\n");
'', "hi\n");
}
1;

View File

@@ -20,32 +20,27 @@ also specified on the command line.";
$port_type eq 'W32' and return -1;
open(MAKEFILE,"> $makefile");
printf MAKEFILE q,
define test
if [ ! -f test-file ]; then \
echo >> test-file; sleep 2; %s test-file; \
else \
echo $@ FAILED; \
fi
endef
printf MAKEFILE subst_make_string(q!
test = #HELPER# noexist test-file file test-file sleep 2 rm test-file
all : ONE TWO THREE
ONE : ; @$(test)
TWO : ; @$(test)
THREE : ; @$(test)
,, $CMD_rmfile;
!);
close(MAKEFILE);
my $ans = "noexist test-file\nfile test-file\nsleep 2\nrm test-file\n";
$mkoptions = "-l 0.0001";
$mkoptions .= " -j 4" if ($parallel_jobs);
# We have to wait longer than the default (5s).
&run_make_with_options($makefile, $mkoptions, &get_logfile, 0, 8);
&run_make_with_options($makefile, $mkoptions, &get_logfile, 0, 10);
$slurp = &read_file_into_string(&get_logfile(1));
if ($slurp =~ /cannot enforce load limit/) {
return -1;
}
&compare_output("", &get_logfile(1));
&compare_output("$ans$ans$ans", &get_logfile(1));
1;

View File

@@ -413,7 +413,6 @@ sub get_osname
elsif ($osname =~ m%OS/2%) {
$port_type = 'OS/2';
}
# VMS has a GNV Unix mode or a DCL mode.
# The SHELL environment variable should not be defined in VMS-DCL mode.
elsif ($osname eq 'VMS' && !defined $ENV{"SHELL"}) {

View File

@@ -8,17 +8,19 @@
# Each step consists of an operator and argument.
#
# It supports the following operators:
# out <word> : echo <word> to stdout with a newline
# raw <word> : echo <word> to stdout without adding anything
# env <word> : echo the value of the env.var. <word>, or "<unset>"
# file <word> : echo <word> to stdout AND create the file <word>
# dir <word> : echo <word> to stdout AND create the directory <word>
# rm <word> : echo <word> to stdout AND delete the file/directory <word>
# wait <word> : wait for a file named <word> to exist
# tmout <secs> : Change the timeout for waiting. Default is 4 seconds.
# sleep <secs> : Sleep for <secs> seconds then echo <secs>
# term <pid> : send SIGTERM to PID <pid>
# fail <err> : echo <err> to stdout then exit with error code err
# out <word> : echo <word> to stdout with a newline
# raw <word> : echo <word> to stdout without adding anything
# env <word> : echo the value of the env.var. <word>, or "<unset>"
# file <word> : echo <word> to stdout AND create the file <word>
# dir <word> : echo <word> to stdout AND create the directory <word>
# rm <word> : echo <word> to stdout AND delete the file/directory <word>
# wait <word> : wait for a file named <word> to exist
# exist <word> : echo <word> AND fail if a file named <word> doesn't exist
# noexist <word> : echo <word> AND fail if a file named <word> exists
# tmout <secs> : Change the timeout for waiting. Default is 4 seconds.
# sleep <secs> : Sleep for <secs> seconds then echo <secs>
# term <pid> : send SIGTERM to PID <pid>
# fail <err> : echo <err> to stdout then exit with error code err
#
# If given -q only the "out", "raw", and "env" commands generate output.
@@ -60,6 +62,18 @@ sub op {
return 1;
}
if ($op eq 'exist') {
-f "$nm" || die "$nm: file should exist: $!\n";
print "exist $nm\n" unless $quiet;
return 1
}
if ($op eq 'noexist') {
-f "$nm" && die "$nm: file exists\n";
print "noexist $nm\n" unless $quiet;
return 1
}
# Show the output before creating the directory
if ($op eq 'dir') {
print "dir $nm\n" unless $quiet;