Compare commits

...

10 Commits
4.2.93 ... 4.3

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

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

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

1
.gitignore vendored
View File

@@ -30,6 +30,7 @@ configure
/mk/Posix.mk
stamp-h1
.dirstamp
gnulib
# Build artifacts
.deps/

43
NEWS
View File

@@ -1,6 +1,6 @@
GNU make NEWS -*-indented-text-*-
History of user-visible changes.
3 January 2020
19 January 2020
See the end of this file for copyrights and conditions.
@@ -9,11 +9,11 @@ which is contained in this distribution as the file doc/make.texi.
See the README file and the GNU make manual for instructions for
reporting bugs.
Version 4.2.93 (03 Jan 2020)
Version 4.3 (19 Jan 2020)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set=custom
* WARNING: Backward-incompatibility!
Number signs (#) appearing inside a macro reference or function invocation
@@ -35,10 +35,18 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set
already contains some value. Similarly, appending an empty string does not
add a trailing space.
* WARNING: Backward-incompatibility!
Contrary to the documentation, suffix rules with prerequisites were being
treated BOTH as simple targets AND as pattern rules. Behavior now matches
the documentation, and pattern rules are no longer created in this case.
* NOTE: Deprecated behavior.
Contrary to the documentation, suffix rules with prerequisites are being
treated BOTH as simple targets AND as pattern rules. Further, the
prerequisites are ignored by the pattern rules. POSIX specifies that in
order to be a suffix rule there can be no prerequisites defined. In this
release if POSIX mode is enabled then rules with prerequisites cannot be
suffix rules. If POSIX mode is not enabled then the previous behavior is
preserved (a pattern rule with no extra prerequisites is created) AND a
warning about this behavior is generated:
warning: ignoring prerequisites on suffix rule definition
The POSIX behavior will be adopted as the only behavior in a future release
of GNU make so please resolve any warnings.
* New feature: Grouped explicit targets
Pattern rules have always had the ability to generate multiple targets with
@@ -54,14 +62,15 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=108&set
recipe. This variable can either be global (applies to all targets) or
a target-specific variable. To detect this feature search for 'extra-prereqs'
in the .FEATURES special variable.
Implementation contributed by Christof Warlich <cwarlich@gmx.de>
* Makefiles can now specify the '-j' option in their MAKEFLAGS variable and
this will cause make to enable that parallelism mode.
* GNU make will now use 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. Aron
Barath <baratharon@caesar.elte.hu> provided the basic implementation.
present, you can use the --disable-posix-spawn option to configure.
Implementation contributed by Aron Barath <baratharon@caesar.elte.hu>
* Error messages printed when invoking non-existent commands have been cleaned
up and made consistent.
@@ -99,7 +108,7 @@ Version 4.2.1 (10 Jun 2016)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=107&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=107&set=custom
This release is a bug-fix release.
@@ -108,7 +117,7 @@ Version 4.2 (22 May 2016)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=106&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=106&set=custom
* New variable: $(.SHELLSTATUS) is set to the exit status of the last != or
$(shell ...) function invoked in this instance of make. This will be "0" if
@@ -147,7 +156,7 @@ Version 4.1 (05 Oct 2014)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=105&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=105&set=custom
* New variables: $(MAKE_TERMOUT) and $(MAKE_TERMERR) are set to non-empty
values if stdout or stderr, respectively, are believed to be writing to a
@@ -195,7 +204,7 @@ Version 4.0 (09 Oct 2013)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set=custom
* WARNING: Backward-incompatibility!
If .POSIX is specified, then make adheres to the POSIX backslash/newline
@@ -299,7 +308,7 @@ Version 3.82 (28 Jul 2010)
A complete list of bugs fixed in this version is available here:
http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&set=custom
https://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&set=custom
* Compiling GNU make now requires a conforming ISO C 1989 compiler and
standard runtime library.
@@ -464,7 +473,7 @@ Version 3.81 (01 Apr 2006)
might have caused the target to rebuild. Starting with the _next_
release of GNU make, '$?' will contain all prerequisites that caused
the target to be considered out of date.
See http://savannah.gnu.org/bugs/?16051
See https://savannah.gnu.org/bugs/?16051
* WARNING: Backward-incompatibility!
GNU make now implements a generic "second expansion" feature on the
@@ -588,7 +597,7 @@ Version 3.81 (01 Apr 2006)
A complete list of bugs fixed in this version is available here:
http://savannah.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=103
https://savannah.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=103
Version 3.80 (03 Oct 2002)
@@ -706,7 +715,7 @@ Version 3.80 (03 Oct 2002)
A complete list of bugs fixed in this version is available here:
http://savannah.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=102
https://savannah.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=102
Version 3.79.1 (23 Jun 2000)

View File

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

View File

@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
AC_INIT([GNU make],[4.2.93],[bug-make@gnu.org])
AC_INIT([GNU make],[4.3],[bug-make@gnu.org])
AC_PREREQ([2.69])
@@ -176,7 +176,7 @@ AC_ARG_WITH([guile], [AS_HELP_STRING([--with-guile],
PKG_PROG_PKG_CONFIG
AS_IF([test "x$with_guile" != xno],
[ guile_versions="2.2 2.0 1.8"
[ guile_versions="3.0 2.2 2.0 1.8"
guile_version=no
have_guile=no
AC_MSG_CHECKING([for GNU Guile])
@@ -184,13 +184,21 @@ AS_IF([test "x$with_guile" != xno],
PKG_CHECK_EXISTS([guile-$v], [guile_version=$v; have_guile=yes; break], [])
done
AC_MSG_RESULT([$guile_version])
if test "$have_guile" = yes; then
PKG_CHECK_MODULES(GUILE, [guile-$guile_version])
AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])
fi
AS_IF([test "$have_guile" = yes],
[ PKG_CHECK_MODULES(GUILE, [guile-$guile_version])
# Unfortunately Guile requires a C99 compiler but GNU make doesn't, so
# verify we can actually compile the header.
keep_CPPFLAGS="$CPPFLAGS"
CPPFLAGS="$CPPFLAGS $pkg_cv_GUILE_CFLAGS"
AC_CHECK_HEADER([libguile.h],
[AC_DEFINE([HAVE_GUILE], [1], [Embed GNU Guile support])],
[have_guile=no],
[/* Avoid configuration error warnings. */])
CPPFLAGS="$keep_CPPFLAGS"
])
])
AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = yes])
AM_CONDITIONAL([HAVE_GUILE], [test "$have_guile" = "yes"])
AC_CHECK_DECLS([sys_siglist, _sys_siglist, __sys_siglist], , ,
[AC_INCLUDES_DEFAULT

View File

@@ -3,7 +3,7 @@
@setfilename make.info
@include version.texi
@set EDITION 0.74
@set EDITION 0.75
@settitle GNU @code{make}
@setchapternewpage odd
@@ -1932,8 +1932,8 @@ more recent than it.
@item
How to update the file @file{foo.o}: by running @code{cc} as stated.
The recipe does not explicitly mention @file{defs.h}, but we presume
that @file{foo.c} includes it, and that that is why @file{defs.h} was
added to the prerequisites.
that @file{foo.c} includes it, and that is why @file{defs.h} was added
to the prerequisites.
@end itemize
@end ifnottex
@@ -4533,6 +4533,19 @@ target is updated in some atomic fashion, or exists only to record a
modification-time (its contents do not matter), or must exist at all
times to prevent other sorts of trouble.
Although @code{make} does its best to clean up there are certain situations
in which cleanup is impossible. For example, @code{make} may be killed by
an uncatchable signal. Or, one of the programs make invokes may be killed
or crash, leaving behind an up-to-date but corrupt target file: @code{make}
will not realize that this failure requires the target to be cleaned. Or
@code{make} itself may encounter a bug and crash.
For these reasons it's best to write @emph{defensive recipes}, which won't
leave behind corrupted targets even if they fail. Most commonly these
recipes create temporary files rather than updating the target directly,
then rename the temporary file to the final target name. Some compilers
already behave this way, so that you don't need to write a defensive recipe.
@node Recursion, Canned Recipes, Interrupts, Recipes
@section Recursive Use of @code{make}
@cindex recursion
@@ -9918,6 +9931,10 @@ and linking with a single @code{cc} command. The optimized rule is used in
preference to the step-by-step chain because it comes earlier in the
ordering of rules.
Finally, for performance reasons @code{make} will not consider non-terminal
match-anything rules (i.e., @samp{%:}) when searching for a rule to
build a prerequisite of an implicit rule (@pxref{Match-Anything Rules}).
@node Pattern Rules, Last Resort, Chained Rules, Implicit Rules
@section Defining and Redefining Pattern Rules
@@ -10407,9 +10424,10 @@ remade from any other files; therefore, @code{make} can save time by not
looking for ways to remake them.@refill
If you do not mark the match-anything rule as terminal, then it is
non-terminal. A non-terminal match-anything rule cannot apply to a file name
that indicates a specific type of data. A file name indicates a specific
type of data if some non-match-anything implicit rule target matches it.
non-terminal. A non-terminal match-anything rule cannot apply to a
prerequisite of an implicit rule, or to a file name that indicates a
specific type of data. A file name indicates a specific type of data
if some non-match-anything implicit rule target matches it.
For example, the file name @file{foo.c} matches the target for the pattern
rule @samp{%.c : %.y} (the rule to run Yacc). Regardless of whether this
@@ -10646,8 +10664,9 @@ Make a list of all the pattern rules one of whose targets matches
matched against @var{t}; otherwise, against @var{n}.
@item
If any rule in that list is @emph{not} a match-anything rule, then
remove all non-terminal match-anything rules from the list.
If any rule in that list is @emph{not} a match-anything rule, or if
@var{t} is a prerequisite of an implicit rule, then remove all
non-terminal match-anything rules from the list.
@item
Remove from the list all rules with no recipe.
@@ -12731,6 +12750,18 @@ receive only part of the information necessary. In this case, the child
will generate this warning message and proceed with its build in a
sequential manner.
@item warning: ignoring prerequisites on suffix rule definition
According to POSIX, a suffix rule cannot contain prerequisites. If a rule
that could be a suffix rule has prerequisites it is interpreted as a simple
explicit rule, with an odd target name. This requirement is obeyed when
POSIX-conforming mode is enabled (the @code{.POSIX} target is defined). In
versions of GNU @code{make} prior to 4.3, no warning was emitted and a
suffix rule was created, however all prerequisites were ignored and were not
part of the suffix rule. Starting with GNU @code{make} 4.3 the behavior is
the same, and in addition this warning is generated. In a future version
the POSIX-conforming behavior will be the only behavior: no rule with a
prerequisite can be suffix rule and this warning will be removed.
@end table
@node Complex Makefile, GNU Free Documentation License, Error Messages, Top
@@ -13013,7 +13044,7 @@ tar.zoo: $(SRCS) $(AUX)
@end example
@node GNU Free Documentation License, Concept Index, Complex Makefile, Top
@appendixsec GNU Free Documentation License
@appendix GNU Free Documentation License
@cindex FDL, GNU Free Documentation License
@include fdl.texi

View File

@@ -231,15 +231,36 @@ get-doc/make-stds.texi get-doc/fdl.texi:
# Alternative configuration checks. #
# ---------------------------------- #
CFGCHECK_CONFIGFLAGS =
CFGCHECK_BUILDFLAGS =
CFGCHECK_MAKEFLAGS = CFLAGS='$(AM_CFLAGS)'
checkcfg.strict-c90: CFGCHECK_CONFIGFLAGS = CFLAGS='-std=c90 -pedantic'
checkcfg.strict-c90: CFGCHECK_MAKEFLAGS =
checkcfg.no-jobserver:CFGCHECK_CONFIGFLAGS = --disable-job-server
checkcfg.no-load: CFGCHECK_CONFIGFLAGS = --disable-load
checkcfg.no-guile: CFGCHECK_CONFIGFLAGS = --without-guile
checkcfg.no-spawn: CFGCHECK_CONFIGFLAGS = --disable-posix-spawn
checkcfg.no-sysglob: CFGCHECK_CONFIGFLAGS = make_cv_sys_gnu_glob=no
checkcfg.no-loadavg: CFGCHECK_CONFIGFLAGS = ac_cv_func_getloadavg=no \
ac_cv_have_decl_getloadavg=no \
gl_cv_have_raw_decl_getloadavg=no \
ac_cv_lib_util_getloadavg=no \
ac_cv_lib_getloadavg_getloadavg=no
checkcfg.no-sync: CFGCHECK_CONFIGFLAGS = CPPFLAGS=-DNO_OUTPUT_SYNC
checkcfg.no-archives: CFGCHECK_CONFIGFLAGS = CPPFLAGS=-DNO_ARCHIVES
CONFIG_CHECKS := \
checkcfg.--disable-job-server \
checkcfg.--disable-load \
checkcfg.--without-guile \
checkcfg.--disable-posix-spawn \
checkcfg.make_cv_sys_gnu_glob^no \
checkcfg.ac_cv_func_getloadavg^no+ac_cv_have_decl_getloadavg^no+gl_cv_have_raw_decl_getloadavg^no+ac_cv_lib_util_getloadavg^no+ac_cv_lib_getloadavg_getloadavg^no \
checkcfg.CPPFLAGS^-DNO_OUTPUT_SYNC \
checkcfg.CPPFLAGS^-DNO_ARCHIVES
checkcfg.strict-c90 \
checkcfg.no-jobserver \
checkcfg.no-load \
checkcfg.no-guile \
checkcfg.no-spawn \
checkcfg.no-sysglob \
checkcfg.no-loadavg \
checkcfg.no-sync \
checkcfg.no-archives
.PHONY: check-alt-config
check-alt-config: $(CONFIG_CHECKS)
@@ -251,20 +272,20 @@ NR_MAKE = $(MAKE)
$(CONFIG_CHECKS): checkcfg.%: distdir
@echo "Building $@ (output in checkcfg.$*.log)"
exec >'checkcfg.$*.log' 2>&1; \
echo "Testing configure with $(subst ^,=,$(subst +, ,$*))"; set -x; \
echo "Testing configure with $(CFGCHECK_CONFIGFLAGS)"; set -x; \
rm -rf $(distdir)/_build \
&& mkdir $(distdir)/_build \
&& cd $(distdir)/_build \
&& ../configure --srcdir=.. $(subst ^,=,$(subst +, ,$*)) \
&& ../configure --srcdir=.. $(CFGCHECK_CONFIGFLAGS) \
$(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS)
exec >>'checkcfg.$*.log' 2>&1; set -x; \
cd $(distdir)/_build \
&& OUTDIR=_bld ../build.sh \
&& OUTDIR=_bld ../build.sh $(CFGCHECK_BUILD_FLAGS) \
&& _bld/make $(AM_MAKEFLAGS) check-local \
&& _bld/make $(AM_MAKEFLAGS) clean
exec >>'checkcfg.$*.log' 2>&1; set -x; \
cd $(distdir)/_build \
&& $(NR_MAKE) $(AM_MAKEFLAGS) CFLAGS='$(AM_CFLAGS)' \
&& $(NR_MAKE) $(AM_MAKEFLAGS) $(CFGCHECK_MAKEFLAGS) \
&& ./make $(AM_MAKEFLAGS) check \
&& ./make $(AM_MAKEFLAGS) clean

View File

@@ -100,7 +100,7 @@ struct nameseq *ar_glob (const char *arname, const char *member_pattern, size_t
#define alloc_seq_elt(_t) xcalloc (sizeof (_t))
void free_ns_chain (struct nameseq *n);
#if defined(MAKE_MAINTAINER_MODE) && defined(__GNUC__)
#if defined(MAKE_MAINTAINER_MODE) && defined(__GNUC__) && !defined(__STRICT_ANSI__)
/* Use inline to get real type-checking. */
#define SI static inline
SI struct nameseq *alloc_ns() { return alloc_seq_elt (struct nameseq); }

View File

@@ -640,9 +640,10 @@ expand_deps (struct file *f)
struct dep *
expand_extra_prereqs (const struct variable *extra)
{
struct dep *d;
struct dep *prereqs = extra ? split_prereqs (variable_expand (extra->value)) : NULL;
for (struct dep *d = prereqs; d; d = d->next)
for (d = prereqs; d; d = d->next)
{
d->file = lookup_file (d->name);
if (!d->file)

View File

@@ -2785,9 +2785,10 @@ construct_command_argv_internal (char *line, char **restp, const char *shell,
#else /* must be UNIX-ish */
static const char *sh_chars = "#;\"*?[]&|<>(){}$`^~!";
static const char *sh_cmds[] =
{ ".", ":", "break", "case", "cd", "command", "continue", "eval", "exec",
"exit", "export", "for", "if", "login", "logout", "read", "readonly",
"set", "shift", "switch", "test", "times", "trap", "ulimit", "umask",
{ ".", ":", "alias", "bg", "break", "case", "cd", "command", "continue",
"eval", "exec", "exit", "export", "fc", "fg", "for", "getopts", "hash",
"if", "jobs", "login", "logout", "read", "readonly", "return", "set",
"shift", "test", "times", "trap", "type", "ulimit", "umask", "unalias",
"unset", "wait", "while", 0 };
# ifdef HAVE_DOS_PATHS

View File

@@ -80,11 +80,11 @@ char **construct_command_argv (char *line, char **restp, struct file *file,
pid_t child_execute_job (struct childbase *child, int good_stdin, char **argv);
#ifdef _AMIGA
void exec_command (char **argv) __attribute__ ((noreturn));
void exec_command (char **argv) NORETURN;
#elif defined(__EMX__)
int exec_command (char **argv, char **envp);
#else
void exec_command (char **argv, char **envp) __attribute__ ((noreturn));
void exec_command (char **argv, char **envp) NORETURN;
#endif
void unblock_all_sigs (void);

View File

@@ -96,7 +96,7 @@ int chdir ();
#endif
#ifndef STDC_HEADERS
# ifndef sun /* Sun has an incorrect decl in a header. */
void exit (int) __attribute__ ((noreturn));
void exit (int) NORETURN;
# endif
double atof ();
#endif

View File

@@ -220,19 +220,22 @@ extern int vms_legacy_behavior;
extern int vms_unix_simulation;
#endif
#ifndef __attribute__
/* This feature is available in gcc versions 2.5 and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
# define __attribute__(x)
# endif
#if !defined(__attribute__) && (__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__)
/* Don't use __attribute__ if it's not supported. */
# define ATTRIBUTE(x)
#else
# define ATTRIBUTE(x) __attribute__ (x)
#endif
/* The __-protected variants of 'format' and 'printf' attributes
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
# endif
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
# define __format__ format
# define __printf__ printf
#endif
#define UNUSED __attribute__ ((unused))
#define UNUSED ATTRIBUTE ((unused))
#define NORETURN ATTRIBUTE ((noreturn))
#if defined (STDC_HEADERS) || defined (__GNU_LIBRARY__)
# include <stdlib.h>
@@ -255,8 +258,8 @@ void *malloc (int);
void *realloc (void *, int);
void free (void *);
void abort (void) __attribute__ ((noreturn));
void exit (int) __attribute__ ((noreturn));
void abort (void) NORETURN;
void exit (int) NORETURN;
# endif /* HAVE_STDLIB_H. */
#endif /* Standard headers. */
@@ -327,7 +330,7 @@ extern mode_t umask (mode_t);
#define strneq(a, b, l) (strncmp ((a), (b), (l)) == 0)
#if defined(__GNUC__) || defined(ENUM_BITFIELDS)
#if defined(ENUM_BITFIELDS) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
# define ENUM_BITFIELD(bits) :bits
#else
# define ENUM_BITFIELD(bits)
@@ -486,12 +489,12 @@ typedef struct
const char *concat (unsigned int, ...);
void message (int prefix, size_t length, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
ATTRIBUTE ((__format__ (__printf__, 3, 4)));
void error (const floc *flocp, size_t length, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
ATTRIBUTE ((__format__ (__printf__, 3, 4)));
void fatal (const floc *flocp, size_t length, const char *fmt, ...)
__attribute__ ((noreturn, __format__ (__printf__, 3, 4)));
void out_of_memory () __attribute__((noreturn));
ATTRIBUTE ((noreturn, __format__ (__printf__, 3, 4)));
void out_of_memory () NORETURN;
/* When adding macros to this list be sure to update the value of
XGETTEXT_OPTIONS in the po/Makevars file. */
@@ -509,8 +512,8 @@ void out_of_memory () __attribute__((noreturn));
#define ONS(_t,_a,_f,_n,_s) _t((_a), INTSTR_LENGTH + strlen (_s), \
(_f), (_n), (_s))
void die (int) __attribute__ ((noreturn));
void pfatal_with_name (const char *) __attribute__ ((noreturn));
void die (int) NORETURN;
void pfatal_with_name (const char *) NORETURN;
void perror_with_name (const char *, const char *);
#define xstrlen(_s) ((_s)==NULL ? 0 : strlen (_s))
void *xmalloc (size_t);

View File

@@ -71,14 +71,16 @@ snap_implicit_rules (void)
{
char *name = NULL;
size_t namelen = 0;
struct rule *rule;
struct dep *dep;
struct dep *prereqs = expand_extra_prereqs (lookup_variable (STRING_SIZE_TUPLE(".EXTRA_PREREQS")));
unsigned int pre_deps = 0;
max_pattern_dep_length = 0;
for (struct dep *d = prereqs; d; d = d->next)
for (dep = prereqs; dep; dep = dep->next)
{
size_t l = strlen (dep_name (d));
size_t l = strlen (dep_name (dep));
if (l > max_pattern_dep_length)
max_pattern_dep_length = l;
++pre_deps;
@@ -86,7 +88,7 @@ snap_implicit_rules (void)
num_pattern_rules = max_pattern_targets = max_pattern_deps = 0;
for (struct rule *rule = pattern_rules; rule; rule = rule->next)
for (rule = pattern_rules; rule; rule = rule->next)
{
unsigned int ndeps = pre_deps;
struct dep *lastdep = NULL;
@@ -96,7 +98,7 @@ snap_implicit_rules (void)
if (rule->num > max_pattern_targets)
max_pattern_targets = rule->num;
for (struct dep *dep = rule->deps; dep != 0; dep = dep->next)
for (dep = rule->deps; dep != 0; dep = dep->next)
{
const char *dname = dep_name (dep);
size_t len = strlen (dname);
@@ -270,11 +272,23 @@ convert_to_pattern (void)
memcpy (rulename + slen, dep_name (d2), s2len + 1);
f = lookup_file (rulename);
/* No target, or no commands, or it has deps: it can't be a
suffix rule. */
if (f == 0 || f->cmds == 0 || f->deps != 0)
/* No target, or no commands: it can't be a suffix rule. */
if (f == 0 || f->cmds == 0)
continue;
/* POSIX says that suffix rules can't have prerequisites.
In POSIX mode, don't make this a suffix rule. Previous versions
of GNU make did treat this as a suffix rule and ignored the
prerequisites, which is bad. In the future we'll do the same as
POSIX, but for now preserve the old behavior and warn about it. */
if (f->deps != 0)
{
if (posix_pedantic)
continue;
error (&f->cmds->fileinfo, 0,
_("warning: ignoring prerequisites on suffix rule definition"));
}
if (s2len == 2 && rulename[slen] == '.' && rulename[slen + 1] == 'a')
/* A suffix rule '.X.a:' generates the pattern rule '(%.o): %.X'.
It also generates a normal '%.a: %.X' rule below. */

View File

@@ -51,7 +51,9 @@ run_make_test(q!
unlink('foo.baz');
# Test #4: Suffix rules with deps are not suffix rules
# SV 40657: Test #4: "Suffix rules" with deps are normal rules
my $prewarn = 'warning: ignoring prerequisites on suffix rule definition';
touch('foo.bar');
@@ -59,20 +61,39 @@ run_make_test(q!
.SUFFIXES:
.SUFFIXES: .biz .baz
$X.POSIX:
.baz.biz: foo.bar ; @echo make $@ from $<
!,
'.baz.biz', "make .baz.biz from foo.bar\n");
'X=1 .baz.biz', "#MAKEFILE#:7: $prewarn\nmake .baz.biz from foo.bar\n");
# SV 40657: Test #5: In POSIX mode we don't get a warning
run_make_test(undef, 'X= .baz.biz', "make .baz.biz from foo.bar\n");
unlink('foo.bar');
# Test #5: Should not create pattern rules for it either
# SV 40657: Test #6: In POSIX mode, no pattern rules should be created
touch('foo.baz');
utouch(-20, 'foo.baz');
run_make_test(undef,
'foo.biz', "#MAKE#: *** No rule to make target 'foo.biz'. Stop.\n", 512);
'X= foo.biz', "#MAKE#: *** No rule to make target 'foo.biz'. Stop.\n", 512);
unlink('foo.baz');
# SV 40657: Test #7: In Non-POSIX mode, a pattern rule is created
run_make_test(undef,
'X=1 foo.biz', "#MAKEFILE#:7: $prewarn\nmake foo.biz from foo.baz\n");
# SV 40657: Test #8: ... but any prerequisites are ignored
utouch(-10, 'foo.biz');
touch('foo.bar');
run_make_test(undef,
'X=1 foo.biz', "#MAKEFILE#:7: $prewarn\n#MAKE#: 'foo.biz' is up to date.\n");
unlink('foo.baz', 'foo.biz', 'foo.bar');
# Complete
1;

View File

@@ -237,7 +237,7 @@ sub toplevel
if (-d $workpath) {
print "Clearing $workpath...\n";
&remove_directory_tree("$workpath/")
or &error ("Couldn't wipe out $workpath\n");
or &error ("Couldn't wipe out $workpath: $!\n");
} else {
mkdir ($workpath, 0777) or &error ("Couldn't mkdir $workpath: $!\n");
}
@@ -1129,8 +1129,9 @@ sub remove_directory_tree
-e $targetdir or return 1;
&remove_directory_tree_inner ("RDT00", $targetdir) or return 0;
if ($nuketop) {
rmdir($targetdir) or return 0;
if ($nuketop && !rmdir ($targetdir)) {
print "Cannot remove $targetdir: $!\n";
return 0;
}
return 1;
@@ -1149,10 +1150,16 @@ sub remove_directory_tree_inner
lstat ($object);
if (-d _ && &remove_directory_tree_inner ($subdirhandle, $object)) {
rmdir $object or return 0;
if (!rmdir($object)) {
print "Cannot remove $object: $!\n";
return 0;
}
} else {
if ($^O ne 'VMS') {
unlink $object or return 0;
if (!unlink $object) {
print "Cannot unlink $object: $!\n";
return 0;
}
} else {
# VMS can have multiple versions of a file.
1 while unlink $object;