Compare commits

..

85 Commits
4.0 ... 4.1

Author SHA1 Message Date
Paul Smith
a66bf2d736 GNU Make release 4.1. 2014-10-05 12:18:08 -04:00
Eli Zaretskii
31c2024b2e Fix Cygwin compilation error.
* job.c (construct_command_argv_internal) [HAVE_DOS_PATHS]: Fix
initializer for sh_chars_sh.
Reported by Denis Excoffier<cygwin@Denis-Excoffier.org>.
2014-10-02 18:11:43 +03:00
Gisle Vanem
7df0fe77d8 Fix last commit. 2014-10-01 20:43:12 +03:00
Gisle Vanem
9fc787c658 * makeint.h (ftruncate): Define also for __WATCOMC__.
Copyright-paperwork-exempt: yes.
2014-10-01 20:41:28 +03:00
Eli Zaretskii
1afb0ad372 Avoid compilation warnings.
* main.c (find_and_set_default_shell, main) [WINDOWS32]: Declare
variables 'const char *' to avoid compiler warnings.
* job.c (construct_command_argv_internal) [!NDEBUG]: Declare 'end'
and set it only if NDEBUG is not defined, to avoid compiler
warnings.
2014-10-01 18:34:29 +03:00
Eli Zaretskii
86a058029b Treat redirection of standard handles on Windows as it is done on Unix.
* job.c (start_job_command) [WINDOWS32]: Compute outfd and errfd
as on Posix platforms, and pass the results to process_easy.
* function.c (windows32_openpipe) [WINDOWS32]: Accept an
additional argument ERRFD and use it for redirecting the standard
error handle passed to the subprocess.
(func_shell_base) [WINDOWS32]: Pass the computed errfd to
windows32_openpipe.
2014-10-01 18:26:28 +03:00
Paul Smith
0a3a0756b9 Update Copyright statements for 2014. 2014-09-30 09:32:42 -04:00
Paul Smith
3712e8a819 * tests/scripts/features/load: Avoid unused variable warnings. 2014-09-30 09:32:41 -04:00
Paul Smith
9ed452b041 * loadapi.c (gmk_eval): Use C90 syntax. 2014-09-30 08:32:06 -04:00
Hartmut Becker
b11bef0bea * job.c: fix make action continuation lines.
* vmsjobs.c: fix writing DCL command files when trimming (white
  spaces and $ signs) especially after a split (command continuation).
2014-09-30 08:12:46 -04:00
Bernhard Reutner-Fischer
bd716a1ec1 * configure.ac: Fix spacing in helptext of customs
Copyright-paperwork-exempt: yes
2014-09-15 14:17:49 -04:00
Eli Zaretskii
b484efca56 Support MAKE_TERMOUT and MAKE_TERMERR on MS-Windows.
* w32/compat/posixfcn.c (isatty, ttyname): New functions.
* config.h.W32.template (HAVE_TTYNAME): Define.  Add a prototype
for ttyname.
2014-09-15 19:51:41 +03:00
Paul Smith
562344122f * loadapi.c (gmk_eval): [SV 43221] Preserve var buff content for eval. 2014-09-15 09:42:52 -04:00
Paul Smith
9a2451af0b * main.c, NEWS, doc/make.text: Rename MAKE_TTY* to MAKE_TERM* 2014-09-15 09:30:40 -04:00
Paul Smith
7f9ce6e97b * main.c (main): Set MAKE_TTYOUT and MAKE_TTYERR.
* configure.ac: Test for isatty() and ttyname()
* makeint.h: provide a substitute for ttyname() if it's not available.
* config.ami.template, config.h-vms.template, config.h.W32.template:
define/undefine HAVE_ISATTY/HAVE_TTYNAME macros.
* NEWS, doc/make.texi: Document these new variables.
2014-09-14 01:03:19 -04:00
Paul Smith
621e9edfe9 * tests/config-flags.pm.in, tests/scripts/features/archives: [SV 43046]
Use the "ar" program detected by configure when running the test suite.
2014-09-07 20:14:26 -04:00
Paul Smith
986632ec23 * doc/make.texi: Clarify implicit rule lookup of phony targets
Reported by Frank Heckenbach <f.heckenbach@fh-soft.de>
2014-09-07 20:02:31 -04:00
Hartmut Becker
95ffcda425 Fix and enhance VMS library support.
* ar.c: fix VMS library search for members, which do not have
suffixes, aka filename extensions.
* arscan.c: fix time conversion and library callback routines.
* default.c: more suffixes and automatically create the VMS library
if it doesn't exists.
2014-09-07 18:11:36 -04:00
Hartmut Becker
dcca1b5b0e Enhance VMS exporting make environment variables.
* config.h-vms.template: add feature macro USE_DCL_COM_FILE to always
write a DCL command file, enabled by default.
* vmsjobs.c: with USE_DCL_COM_FILE enabled write make variables as DCL
symbol assignments into the command file.  This enables printing
directory and make level info for recursive use of make. This also
enables forced DCL symbol substitution in the actions.
2014-09-07 18:10:11 -04:00
Hartmut Becker
9cad73ad82 Fix VMS automatic variable expansion
* function.c: add VMS code to func_notdir_suffix and func_basename_dir
to work on comma separated lists; this fixes the expansion of
$(^D), $(+D) and the F variants for VMS.
2014-09-07 18:03:45 -04:00
Hartmut Becker
8e7a28a6a4 * main.c [VMS]: Say that parallel jobs (-j) are not supported on VMS 2014-09-07 18:02:10 -04:00
Hartmut Becker
98de32a681 Enhance/fix VMS ONESHELL implementation and command execution
* job.c, vmsjobs.c: fix some double quote and new line handling;
implement ONESHELL with writing multiple lines into one DCL command
procedure; in ONESHELL allow VMS/make internal redirection only on the
first line; fix the created DCL command procedure, which didn't abort
on errors; return correct exit status from the DCL command procedure;
preserve current procedure verification; make the generated command
procedure more robust.
2014-09-07 18:01:35 -04:00
Hartmut Becker
5369be5079 Enhance/fix VMS setting of program name, MAKE/MAKE_COMMAND variables
* default.c, main.c, makeint.h, vmsfunctions.c: prefix argv[0] with
"mcr " for MAKE/MAKE_COMMAND and set the program name to the image
filename (without the .exe;version)
* vmsfunctions.c: remove obsolete code
* vmsify: use xmalloc
2014-09-07 17:48:14 -04:00
Hartmut Becker
8de07f3e4a Enhance/fix VMS exit code handling.
* commands.c, function.c, hash.c, job.c, main.c, output.c:
use MAKE exit codes.
* makeint.h: encode make exit codes so that they are VMS compatible.
* job.c: check child exit code for VMS style exit codes.
* vmsjobs.c: save and return VMS style exit code.
2014-09-07 17:41:59 -04:00
Hartmut Becker
f970315766 Enhance/fix VMS multi-line support.
* job.c: split the command line at a newline.
* default.c, vmsjobs.c: change ECHO variable to a pseudo builtin,
which ensures that the VMS/DCL ECHO ("write sys$output") is used
and is correctly quoted.
* vmsjobs.c: remove unused builtin 'rm'.
2014-09-07 17:40:28 -04:00
Hartmut Becker
579ee85941 * config_flags_pm.com, [RENAMED test_make.com] run_make_tests.com:
Moved into tests directory.
2014-09-07 17:30:37 -04:00
Hartmut Becker
7e51810bb5 Enhance/fix VMS build environment
* config.h-vms.template: make sure the CRTL version is known
* makefile.com: always compile/link the guile module, remove VAXCRTL
parameter, new LIST parameter
* makefile.vms: always compile/link the guile module, use more
complete dependencies
* prepare_vms.com: helper to create a VMS config file when building
from a snapshot of the repository
2014-09-07 17:13:56 -04:00
Paul Smith
bd30df4478 * configure.ac, maintMakefile, w32/Makefile.am: Fix autotools issues.
Reported by Paul Eggert <eggert@cs.ucla.edu>
2014-09-07 16:59:37 -04:00
Eli Zaretskii
1f2fd22fec Change the order of "makefile" and "Makefile" to match the manual. 2014-08-30 10:43:34 +03:00
Eli Zaretskii
ab1210b1fe Fix regression with "makefile" not being found on MS-Windows.
* read.c (read_all_makefiles) [WINDOWS32]: Recognize "makefile",
all-lowercase, as a makefile.  Reported by Michael Waeber
<waeber@gmail.com>.
2014-08-30 10:40:12 +03:00
Eli Zaretskii
241787d8e4 Fix compilation on MS-Windows.
* makeint.h [WINDOWS32]: Don't declare 'program' as 'const char *',
since it is modified in 'main'.
2014-07-16 18:23:04 +03:00
Eli Zaretskii
faeeb27166 [SV 42695] Fix compilation error on MS-Windows.
* main.c [WINDOWS32]: Don't declare 'program' as 'const char *',
since it is modified in 'main'.
2014-07-12 13:01:18 +03:00
Jonny Grant
cab353d1dd Fix defalt_makefiles[] for MS-Windows.
* read.c (read_all_makefiles) [WINDOWS32]: Remove the redundant
"makefile" and add "makefile.mak".

Copyright-paperwork-exempt: yes
2014-07-12 12:53:59 +03:00
Fredrik Fornwall
8b01e6bebf * arscan.c [ANDROID]: Android has no ar.h but supports archives.
Copyright-paperwork-exempt: yes
2014-07-07 03:56:17 -04:00
Paul Smith
55c00544cc * read.c (eval): [SV 41677] Correct test for TAB vs. 8 spaces. 2014-07-07 03:43:57 -04:00
Piotr Jaroszynski
8d577c2ff4 * output.c (pump_from_tmp): [SV 42378] Flush the output file regularly.
Copyright-paperwork-exempt: yes
2014-07-07 03:10:17 -04:00
John Malmberg
e44d6a12bb Update the regression test harness to support VMS.
* config_flags_pm.com, test_make.com: set up and run the regression
test environment on VMS.
* tests/run_make_tests.pl [VMS]: Use an alternate rmdir()
implementation on VMS.
(run_make_with_options) [VMS]: Provide VMS-specific quoting and shell
invocations.
(set_more_defaults) [VMS]: Set default values when running on VMS.
* tests/test_driver.pl (vms_get_process_logicals) [VMS]: Retrieve the
proper values from %ENV on VMS.
(resetENV) [VMS]: Use it.
(toplevel) [VMS]: Fix a bug with opendir() on some logical_devices.
(compare_output) [VMS]: Convert VMS test output to a "standard" format.
(_run_command) [VMS]: Handle signals and exit codes the VMS way.
(remove_directory_tree_inner) [VMS]: Unlink all versions of the file.
2014-07-07 02:47:30 -04:00
Paul Smith
423c3955d9 * various: Assume ISO C89-compliant free() implementation. 2014-07-07 01:59:03 -04:00
Paul Smith
ac67346d0f * maintMakefile, various: Improve constification of the codebase. 2014-07-07 01:59:03 -04:00
Paul Smith
e364498113 [SV 41983] Support omitting the text argument to $(file ...)
Reported by Tim Murphy <tnmurphy@gmail.com>
* function.c (func_file): Only write TEXT if it is not NULL.
* NEWS, doc/make.texi: Document the new feature
* tests/scripts/functions/file: Verify that the no-text version of
  $(file ...) works and doesn't add a newline.
2014-07-07 01:59:03 -04:00
Jacques Germishuys
85047eb904 NMakefile.template ($(OUTDIR)/posixfcn.obj): Fix a typo.
Copyright-paperwork-exempt: yes.
2014-05-13 20:30:47 +03:00
Paul Smith
0faa98a0bb [SV 42249] Propagate correct rule status results.
* remake.c (update_file, update_file_1, check_dep): Return an enum
  update_status value instead of an int, and keep the highest value we
  find as we walk the graph so that the ultimate status is correct.
* tests/scripts/options/dash-q: Add a test for updating prerequisites.
2014-05-01 09:51:04 -04:00
Paul Smith
8411528fdd * Rename MAP_PATHSEP to MAP_DIRSEP. 2014-02-08 16:01:10 -05:00
Paul Smith
d2a3e9ca9c * configure.ac: Fixup for newer autoconf/automake 2014-02-08 16:01:10 -05:00
Ray Donnelly
e1863c05d8 * output.c: Ensure space for final nul byte in fmtbuf.
Copyright-paperwork-exempt: yes
2014-02-08 16:01:10 -05:00
Gisle Vanem
b981bfd197 Improve error reporting in the Windows port when env size is too large.
w32/subproc/misc.c (arr2envblk): Compute and return the size of
the environment passed to child process.

w32/subproc/sub_proc.c (process_begin): If the call to
CreateProcess failed with EINVAL, and the required environment
size was larger than 32KB, assume it's a Windows XP limitation,
and display an error message to that effect.

w32/subproc/proc.h (arr2envblk): Update prototype.

Copyright-paperwork-exempt: yes
2014-02-07 11:15:56 +02:00
Paul Smith
88713683fe * job.c (set_child_handler_action_flags): [SV 41341]
Ensure signal handler is in place before alarm(1).
2014-02-01 23:12:04 -05:00
Alan Hourihane
a7cac0f0e3 * configure.ac: [SV 40790] Fix load autoconf variables.
Copyright-paperwork-exempt: yes
2014-01-20 00:17:44 -05:00
Pavel Fedin
165ccf3137 Allow the EMX build to use output_sync.
job.c (start_job_command): Move the child output diversion out
of non-EMX branch.
[__EMX__]: Don't use fixed FD_STDOUT and FD_STDERR in the call to
child_execute_job.

Copyright-paperwork-exempt: yes
2014-01-17 09:51:28 +02:00
Paul Smith
24620378ba * commands.c: [SV 40789] Remove unneeded header dlfcn.h 2014-01-12 10:54:59 -05:00
Paul Smith
9c8b68a905 * main.c (die): Close output_context AND make_sync.
die() can be invoked inside a separate output_context, if the
$(error ...) function is expanded as part of a recipe.
2014-01-12 10:54:29 -05:00
Pavel Fedin
432cb6575d Fix .LIBPATTERNS for MS-Windows builds.
default.c (.LIBPATTERNS) [__CYGWIN__ || WINDOWS32]: Provide
library patterns for MS-Windows.

Copyright-paperwork-exempt: yes
2014-01-11 22:28:48 +02:00
Paul Smith
a4937bc897 * w32/*: Remove TABs from the source code.
I know whitespace commits are annoying, but having these TABs is
causing me to miss things when I search through the code.  This
doesn't try to change the w32 code to meet GNU coding standards.
2013-11-27 19:43:33 -05:00
Paul Smith
889303cdfe * main.c (decode_env_switches): Ensure we have enough space.
Reported (with patch) by Gerte Hoogewerf <g.hoogewerf@gmail.com>
2013-11-27 19:06:45 -05:00
Stephan T. Lavavej
99385ee6f7 Solve some Windows build issues.
* main.c (main): Use ONS(), not OSN().
(prepare_mutex_handle_string) [WINDOWS32]: Use %Ix formatting to
support both 32bit and 64bit systems.
* job.c (free_child, new_job): Use ONS(), not OSN().
* w32/subproc/w32err.c (map_windws32_error_to_string): Use O() when
calling fatal().

Copyright-paperwork-exempt: yes
2013-11-27 10:57:37 -05:00
Paul Smith
f5f5adb62c * features/loadapi (test_expand): Allocate memory for the nul byte. 2013-11-24 04:08:30 -05:00
Paul Smith
865d90bb1e * load.c (load_file): Reset the name length minus the symbol. 2013-11-24 04:03:19 -05:00
Paul Smith
30b25acc4e * read.c (unescape_char): Use memmove() for overlapping memory. 2013-11-24 03:45:38 -05:00
Paul Smith
f8905059c3 Fix memory leak during environment option decoding.
* main.c (decode_switches): Always make a copy of option arguments.
(decode_env_switches): Use a stack buffer to convert environment
switches for parsing.
2013-11-24 03:45:02 -05:00
Paul Smith
12a3104c3d [SV 40226] Add a new type of switch: single-string options
* main.c (struct command_switch): Change the "string" types to "strlist"
and make "string" be a single-valued string instead.
(output_sync_option, jobserver_fds, sync_mutex): Change to string type.
(decode_output_sync_flags): Handle single strings instead of lists.
(prepare_mutex_handle_string): Ditto.
(main): Ditto.
(clean_jobserver): Ditto.
(init_switches): Handle the new type.
(decode_switches): Ditto.
(define_makeflags): Ditto.
2013-11-24 03:21:40 -05:00
Daniel Richard G
7b485daffb * load.c: [SV 40515] Define RTLD_GLOBAL if not set.
Copyright-paperwork-exempt: yes
2013-11-23 22:39:39 -05:00
Paul Smith
757849cd93 [SV 40361] Don't use vsnprintf(), which is an ISO C99 function.
* output.c (error, fatal, message): Take an extra argument specifying
how many bytes are used by the formatted arguments.
(get_buffer): New function that allocates the requested buffer size.
Remove msc_vsnprintf(), vfmtconcat(), and fmtconcat() as unneeded.
* makeint.h: Declare various helper macros for generating output.
* *.c: Change all error(), fatal(), message() calls to use the macros,
or pass the extra length argument directly.
2013-11-23 22:23:52 -05:00
Paul Smith
9d58570c77 * makeint.h (STOP_SET): [SV 40371] Cast to unsigned char.
* tests/scripts/misc/utf8: Test variable names with characters >127.
Fix suggested by Robert Bogomip <bob.bogo@milohedge.com>
2013-10-27 17:43:21 -04:00
Gerte Hoogewerf
d49ab08ae0 Fix MS Visual Studio NET2003 build.
* make_msvc_net2003.vcproj: Do not exclude guile.c from compilation.
Copyright-paperwork-exempt: Yes.
2013-10-24 21:20:36 +03:00
Christian Boos
10a4b120bd Fix SV bug #40227 with respect to stack size set for the MSVC build.
* NMakefile.template (/STACK): Increase to 0x400000, mainly for
the 64-bit builds.  Fixes SV bug #40227.
Copyright-paperwork-exempt: Yes.
(guile): Uncomment.
2013-10-23 19:56:18 +03:00
Eli Zaretskii
309768aff1 Fix the MS-Windows build: now guile.c must always be compiled in.
* build_w32.bat: Always compile guile.c and link against guile.o.
  Reported by Alexey Pavlov <alexpux@gmail.com>.

* makeint.h (guile_gmake_setup): Define prototype unconditionally,
to avoid compiler warnings.
2013-10-23 19:28:38 +03:00
Eli Zaretskii
9c28d5125d Fix Savannah bug #31150 with failures due to setting window title.
* sub_proc.c (process_begin): Don't set startInfo.lpTitle, it
reportedly causes SV bug #31150, and according to MSDN it's a
no-no.
2013-10-22 19:04:34 +03:00
Eli Zaretskii
a7794f483b Fix Savannah bug 40241 with Unixy file names as commands to MSYS shell.
* sub_proc.c: Include filedef.h and variable.h.
(process_begin): If exec_path was not found, but its first
character is '/', assume there's some shell magic, and invoke the
command through '$(SHELL) -c "COMMAND"'.  Fixes SV bug#40241.
(make_command_line): Kludgey feature: if full_exec_path is "-c",
assume that argv[0] is not to be skipped, as it holds the command
string to be passed to the shell.
2013-10-22 18:55:38 +03:00
Paul Smith
5d653b535a * glob.c (glob) [SV 18123]: Cherry-pick glibc fix
Apply commit a471e96a5352a5f0bde6d32dd36d33524811a2b1 from
git://sourceware.org/git/glibc.git to fix
https://sourceware.org/bugzilla/show_bug.cgi?id=10278
2013-10-20 13:18:50 -04:00
Paul Smith
53b4a9e668 * read.c (record_files): [SV 33034] Change fatal() to error()
Allows deprecated syntax.  However we don't guarantee this syntax
will continue to be legal in the future.
Change suggested by David Boyce <david.s.boyce@gmail.com>
2013-10-20 13:08:27 -04:00
Paul Smith
d4723d643d * README.git: Add some missing release steps. 2013-10-20 13:08:27 -04:00
Paul Smith
107ab16bf6 [SV 40240] Use configure info to build load test shared libs
* tests/config-flags.pm.in: A new file containing variable assignments
for the test suite; these variables are set by configure to contain
the values detected there for compilers, flags, etc.
* tests/run_make_tests.pl: Require the config-flags.pm file
* tests/scripts/features/load, tests/scripts/features/loadapi: Use the
configure-provided values when building the shared test library.
* configure.ac: Replace tests/config-flags.pm.in
* Makefile.am: Make sure tests/config-flags.pm is up to date
2013-10-19 15:39:15 -04:00
Paul Smith
07f2666b91 * maintMakefile (checkcfg.%): Add testing of build.sh 2013-10-19 12:25:09 -04:00
Paul Smith
f4b746b8c2 [SV 40254] Modify build.sh to work properly with Guile support.
* guile.c (guile_gmake_setup) [HAVE_GUILE]: Define a stub function
when Guile support is not enabled.
* main.c (main) [HAVE_GUILE]: Always invoke guile_gmake_setup().
* Makefile.am: Make guile.c standard, not optional.
* build.template: Add the Guile compiler and linker flags.
2013-10-19 12:24:14 -04:00
Paul Smith
d7f25cfda5 * maintMakefile: Accept variable overrides from the environment. 2013-10-19 12:09:13 -04:00
Paul Smith
b9a01a8b3b * NEWS: Fix version so we can build a distfile. 2013-10-19 12:08:04 -04:00
Paul Smith
d654bff457 * read.c (eval): Avoid GCC warning to add braces. 2013-10-19 12:07:31 -04:00
Paul Smith
74ed682c54 * GNUMAKEFLAGS: Remove -O so it passes in NO_OUTPUT_SYNC mode. 2013-10-19 12:05:58 -04:00
Christian Boos
e498e464dc Fix initialization of stringlist variables for jobserver_fds and sync_mutex.
(tiny change)

 main.c (prepare_mutex_handle_string, main): Initialize
 stringlist variables with at least 2 members, as one member is not
 currently supported.
2013-10-18 13:23:43 +03:00
Eli Zaretskii
d1d737d0fa Fix MinGW64 problem with non-compliant vsnprintf.
makeint.h (__USE_MINGW_ANSI_STDIO) [__MINGW64_VERSION_MAJOR]:
 Define for MinGW64, to force it to use an ANSI-compliant
 implementation of vsnprintf.  Reported by Christian Boos
 <cboos@edgewall.org>.
2013-10-18 13:12:22 +03:00
Eli Zaretskii
87e5b64f41 Fix the MSVC build on MS-Windows.
output.c (vsnprintf) [_MSC_VER]: Define, instead of defining
 snprintf, which isn't used.  Reported by Christian Boos
 <cboos@edgewall.org>.
 NMakefile.template (OBJS): Add load.obj and posixfcn.obj.
 ($(OUTDIR)/pathstuff.obj): New dependency.
 Suggested by Christian Boos <cboos@edgewall.org>.
2013-10-18 13:08:12 +03:00
Paul Smith
70df3c35bf [SV 40139] Modify "missing separator" for better translation 2013-10-13 16:48:23 -04:00
Paul Smith
01a745025d Add support for updating the GNU make web pages.
Add makefile rules for updating the http://www.gnu.org/software/make
web pages, including the online GNU make manual.
2013-10-13 16:48:22 -04:00
Paul Smith
4792e154b6 Convert to auto-generated ChangeLog files.
Rename existing ChangeLog files so they won't be distributed.
Add targets to maintMakefile to generate ChangeLog from the Git
repository.  This will require a version of gnulib be available.
Because ChangeLog is auto-generated, we have to switch our
automake mode to "foreign" or it will complain and fail.
2013-10-13 16:48:22 -04:00
Paul Smith
188b2a0f23 Set up for the next release. 2013-10-13 16:48:22 -04:00
130 changed files with 4289 additions and 2813 deletions

4
.gitignore vendored
View File

@@ -13,6 +13,7 @@ Makefile
Makefile.in Makefile.in
aclocal.m4 aclocal.m4
autom4te.cache autom4te.cache
config.cache
config.h config.h
config.h.in config.h.in
config.log config.log
@@ -29,6 +30,8 @@ make
# Distribution artifacts # Distribution artifacts
.dep_segment .dep_segment
.check-git-HEAD
ChangeLog
Makefile.DOS Makefile.DOS
NMakefile NMakefile
README README
@@ -44,3 +47,4 @@ config.h.W32
configh.dos configh.dos
make-[0-9]*/ make-[0-9]*/
make-[0-9]*.tar.* make-[0-9]*.tar.*
checkcfg.*.log

View File

@@ -72,7 +72,7 @@ With suggestions/comments/bug reports from a cast of ... well ...
hundreds, anyway :) hundreds, anyway :)
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 1997-2013 Free Software Foundation, Inc. Copyright (C) 1997-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,7 +1,7 @@
# -*-Makefile-*- template for DJGPP # -*-Makefile-*- template for DJGPP
# Makefile.in generated automatically by automake 1.2 from Makefile.am # Makefile.in generated automatically by automake 1.2 from Makefile.am
# #
# Copyright (C) 1994-2013 Free Software Foundation, Inc. # Copyright (C) 1994-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -1,6 +1,6 @@
# This is a -*-Makefile-*-, or close enough # This is a -*-Makefile-*-, or close enough
# #
# Copyright (C) 1997-2013 Free Software Foundation, Inc. # Copyright (C) 1997-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under
@@ -40,15 +40,11 @@ else
endif endif
make_SOURCES = ar.c arscan.c commands.c default.c dir.c expand.c file.c \ make_SOURCES = ar.c arscan.c commands.c default.c dir.c expand.c file.c \
function.c getopt.c getopt1.c implicit.c job.c load.c \ function.c getopt.c getopt1.c guile.c implicit.c job.c load.c \
loadapi.c main.c misc.c output.c read.c remake.c rule.c \ loadapi.c main.c misc.c output.c read.c remake.c rule.c \
signame.c strcache.c variable.c version.c vpath.c hash.c \ signame.c strcache.c variable.c version.c vpath.c hash.c \
$(remote) $(remote)
if HAVE_GUILE
make_SOURCES += guile.c
endif
EXTRA_make_SOURCES = vmsjobs.c remote-stub.c remote-cstms.c EXTRA_make_SOURCES = vmsjobs.c remote-stub.c remote-cstms.c
noinst_HEADERS = commands.h dep.h filedef.h job.h makeint.h rule.h variable.h \ noinst_HEADERS = commands.h dep.h filedef.h job.h makeint.h rule.h variable.h \
@@ -90,13 +86,6 @@ EXTRA_DIST = README build.sh.in $(man_MANS) \
DISTCLEANFILES = build.sh DISTCLEANFILES = build.sh
# Forward targets
html:
cd doc && $(MAKE) $(AM_MAKEFLAGS) $@
.PHONY: html
# --------------- Internationalization Section # --------------- Internationalization Section
localedir = $(datadir)/locale localedir = $(datadir)/locale
@@ -183,7 +172,7 @@ loadavg_LDADD = @GETLOADAVG_LIBS@
# #
MAKETESTFLAGS = MAKETESTFLAGS =
check-regression: check-regression: tests/config-flags.pm
@if test -f '$(srcdir)/tests/run_make_tests'; then \ @if test -f '$(srcdir)/tests/run_make_tests'; then \
if $(PERL) -v >/dev/null 2>&1; then \ if $(PERL) -v >/dev/null 2>&1; then \
case `cd '$(srcdir)'; pwd` in `pwd`) : ;; \ case `cd '$(srcdir)'; pwd` in `pwd`) : ;; \

View File

@@ -3,7 +3,7 @@
# NOTE: If you have no 'make' program at all to process this makefile, run # NOTE: If you have no 'make' program at all to process this makefile, run
# 'build.sh' instead. # 'build.sh' instead.
# #
# Copyright (C) 1995-2013 Free Software Foundation, Inc. # Copyright (C) 1995-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under

60
NEWS
View File

@@ -1,6 +1,6 @@
GNU make NEWS -*-indented-text-*- GNU make NEWS -*-indented-text-*-
History of user-visible changes. History of user-visible changes.
09 Oct 2013 05 Oct 2014
See the end of this file for copyrights and conditions. See the end of this file for copyrights and conditions.
@@ -8,6 +8,27 @@ All changes mentioned here are more fully described in the GNU make
manual, which is contained in this distribution as the file doc/make.texi. manual, which is contained in this distribution as the file doc/make.texi.
See the README file and the GNU make manual for instructions for See the README file and the GNU make manual for instructions for
reporting bugs. reporting bugs.
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
* 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
terminal. These variables are exported by default.
* Allow a no-text-argument form of the $(file ...) function. Without a text
argument nothing is written to the file: it is simply opened in the
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
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
Version 4.0 (09 Oct 2013) Version 4.0 (09 Oct 2013)
@@ -143,15 +164,6 @@ http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=104&set
results from wildcard expansions, use the $(sort ...) function to request results from wildcard expansions, use the $(sort ...) function to request
it explicitly. it explicitly.
* WARNING: Backward-incompatibility!
In previous versions of make it was acceptable to list one or more explicit
targets followed by one or more pattern targets in the same rule and it
worked "as expected". However, this was not documented as acceptable and if
you listed any explicit targets AFTER the pattern targets, the entire rule
would be mis-parsed. This release removes this ability completely: make
will generate an error message if you mix explicit and pattern targets in
the same rule.
* WARNING: Backward-incompatibility! * WARNING: Backward-incompatibility!
As a result of parser enhancements, three backward-compatibility issues As a result of parser enhancements, three backward-compatibility issues
exist: first, a prerequisite containing an "=" cannot be escaped with a exist: first, a prerequisite containing an "=" cannot be escaped with a
@@ -239,8 +251,8 @@ Version 3.81 (01 Apr 2006)
any prerequisite that does not exist, even though that prerequisite any prerequisite that does not exist, even though that prerequisite
might have caused the target to rebuild. Starting with the _next_ 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 this Savannah bug: the target to be considered out of date.
http://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=16051 See http://savannah.gnu.org/bugs/?16051
* WARNING: Backward-incompatibility! * 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
@@ -767,7 +779,7 @@ Version 3.69 (07 Nov 1993)
have reversed the change made in version 3.68 because it turned out to have reversed the change made in version 3.68 because it turned out to
cause a paradoxical situation in cases like: cause a paradoxical situation in cases like:
export variable = $(shell echo value) export variable = $(shell echo value)
When Make attempted to put this variable in the environment for a When Make attempted to put this variable in the environment for a
recipe, it would try expand the value by running the shell command recipe, it would try expand the value by running the shell command
@@ -790,8 +802,8 @@ Version 3.68 (28 Jul 1993)
foo.a(b.o) bar.a(c.o) bar.a(d.o)'. foo.a(b.o) bar.a(c.o) bar.a(d.o)'.
* A suffix rule `.X.a' now produces two pattern rules: * A suffix rule `.X.a' now produces two pattern rules:
(%.o): %.X # Previous versions produced only this. (%.o): %.X # Previous versions produced only this.
%.a: %.X # Now produces this as well, just like other suffixes. %.a: %.X # Now produces this as well, just like other suffixes.
* The new flag `--warn-undefined-variables' says to issue a warning message * The new flag `--warn-undefined-variables' says to issue a warning message
whenever Make expands a reference to an undefined variable. whenever Make expands a reference to an undefined variable.
@@ -861,15 +873,15 @@ Version 3.63 (22 Jan 1993)
no longer automatically put into the environments of the recipe lines that no longer automatically put into the environments of the recipe lines that
Make runs. Instead, only variables specified on the command line or in Make runs. Instead, only variables specified on the command line or in
the environment are exported by default. To export others, use: the environment are exported by default. To export others, use:
export VARIABLE export VARIABLE
or you can define variables with: or you can define variables with:
export VARIABLE = VALUE export VARIABLE = VALUE
or: or:
export VARIABLE := VALUE export VARIABLE := VALUE
You can use just: You can use just:
export export
or: or:
.EXPORT_ALL_VARIABLES: .EXPORT_ALL_VARIABLES:
to get the old behavior. See the node `Variables/Recursion' in the manual to get the old behavior. See the node `Variables/Recursion' in the manual
for a full description. for a full description.
@@ -889,9 +901,9 @@ Version 3.63 (22 Jan 1993)
* A single `include' directive can now specify more than one makefile to * A single `include' directive can now specify more than one makefile to
include, like this: include, like this:
include file1 file2 include file1 file2
You can also use shell file name patterns in an `include' directive: You can also use shell file name patterns in an `include' directive:
include *.mk include *.mk
* The default directories to search for included makefiles, and for * The default directories to search for included makefiles, and for
libraries specified with `-lNAME', are now set by configuration. libraries specified with `-lNAME', are now set by configuration.
@@ -1027,7 +1039,7 @@ Version 3.49
* The `wildcard' variable expansion function now expands ~ and ~USER. * The `wildcard' variable expansion function now expands ~ and ~USER.
* Messages indicating failed recipe lines now contain the target name: * Messages indicating failed recipe lines now contain the target name:
make: *** [target] Error 1 make: *** [target] Error 1
* The `-p' output format has been changed somewhat to look more like * The `-p' output format has been changed somewhat to look more like
makefile rules and to give all information that Make has about files. makefile rules and to give all information that Make has about files.
@@ -1207,7 +1219,7 @@ Version 3.05
(Changes from versions 1 through 3.05 were never recorded. Sorry.) (Changes from versions 1 through 3.05 were never recorded. Sorry.)
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -3,7 +3,7 @@
# NOTE: If you have no 'make' program at all to process this makefile, # NOTE: If you have no 'make' program at all to process this makefile,
# run 'build_w32.bat' instead. # run 'build_w32.bat' instead.
# #
# Copyright (C) 1996-2013 Free Software Foundation, Inc. # Copyright (C) 1996-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under
@@ -32,9 +32,9 @@ CFLAGS_debug = $(CFLAGS_any) /Od /D DEBUG /D _DEBUG /FR.\WinDebug/ /Fp.\WinDebug
CFLAGS_release = $(CFLAGS_any) /O2 /D NDEBUG /FR.\WinRel/ /Fp.\WinRel/make.pch /Fo.\WinRel/ CFLAGS_release = $(CFLAGS_any) /O2 /D NDEBUG /FR.\WinRel/ /Fp.\WinRel/make.pch /Fo.\WinRel/
LDFLAGS_debug = w32\subproc\WinDebug\subproc.lib /NOLOGO /SUBSYSTEM:console\ LDFLAGS_debug = w32\subproc\WinDebug\subproc.lib /NOLOGO /SUBSYSTEM:console\
/INCREMENTAL:no /PDB:WinDebug/make.pdb /OUT:WinDebug/make.exe /DEBUG /STACK:0x400000 /INCREMENTAL:no /PDB:WinDebug/make.pdb /OUT:WinDebug/make.exe /DEBUG
LDFLAGS_release = w32\subproc\WinRel\subproc.lib /NOLOGO /SUBSYSTEM:console\ LDFLAGS_release = w32\subproc\WinRel\subproc.lib /NOLOGO /SUBSYSTEM:console\
/INCREMENTAL:no /OUT:WinRel/make.exe /STACK:0x400000 /INCREMENTAL:no /OUT:WinRel/make.exe
all: config.h subproc Release Debug all: config.h subproc Release Debug
@@ -72,7 +72,7 @@ $(OUTDIR):
LIBS = kernel32.lib user32.lib advapi32.lib LIBS = kernel32.lib user32.lib advapi32.lib
#guile = $(OUTDIR)/guile.obj guile = $(OUTDIR)/guile.obj
OBJS = \ OBJS = \
$(OUTDIR)/ar.obj \ $(OUTDIR)/ar.obj \
@@ -89,6 +89,7 @@ OBJS = \
$(OUTDIR)/hash.obj \ $(OUTDIR)/hash.obj \
$(OUTDIR)/implicit.obj \ $(OUTDIR)/implicit.obj \
$(OUTDIR)/job.obj \ $(OUTDIR)/job.obj \
$(OUTDIR)/load.obj \
$(OUTDIR)/main.obj \ $(OUTDIR)/main.obj \
$(OUTDIR)/misc.obj \ $(OUTDIR)/misc.obj \
$(OUTDIR)/output.obj \ $(OUTDIR)/output.obj \
@@ -105,6 +106,7 @@ OBJS = \
$(OUTDIR)/fnmatch.obj \ $(OUTDIR)/fnmatch.obj \
$(OUTDIR)/dirent.obj \ $(OUTDIR)/dirent.obj \
$(OUTDIR)/pathstuff.obj \ $(OUTDIR)/pathstuff.obj \
$(OUTDIR)/posixfcn.obj \
$(guile) $(guile)
$(OUTDIR)/make.exe: $(OUTDIR) $(OBJS) $(OUTDIR)/make.exe: $(OUTDIR) $(OBJS)
@@ -121,5 +123,7 @@ $(OUTDIR)/fnmatch.obj : glob/fnmatch.c
$(CC) $(CFLAGS) /c $? $(CC) $(CFLAGS) /c $?
$(OUTDIR)/dirent.obj : w32/compat/dirent.c $(OUTDIR)/dirent.obj : w32/compat/dirent.c
$(CC) $(CFLAGS) /c $? $(CC) $(CFLAGS) /c $?
$(OUTDIR)/posixfcn.obj : w32/compat/posixfcn.c
$(CC) $(CFLAGS) /c $?
$(OUTDIR)/pathstuff.obj : w32/pathstuff.c $(OUTDIR)/pathstuff.obj : w32/pathstuff.c
$(CC) $(CFLAGS) /c $? $(CC) $(CFLAGS) /c $?

View File

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

View File

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

View File

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

View File

@@ -268,7 +268,7 @@ Long command lines are now converted to command files.
Comma (',') as a separator is now allowed. See makefile.vms for an example. Comma (',') as a separator is now allowed. See makefile.vms for an example.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 1996-2013 Free Software Foundation, Inc. Copyright (C) 1996-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
-*-text-*- -*-text-*-
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2002-2013 Free Software Foundation, Inc. Copyright (C) 2002-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -31,12 +31,17 @@ make source code via Git from the FSF's Savannah project
Changes using Git Changes using Git
----------------- -----------------
For non-developers, please continue to provide patches as before, or if you For non-developers, you can continue to provide patches as before, or if you
make a public repository I can pull from that if you prefer. make a public repository I can pull from that if you prefer.
For developers, I'm still new to Git myself, so I don't have a ton of advice. Starting with GNU make 4.0 we no longer keep a separate ChangeLog file in
In this release we will continue to create ChangeLog files by hand so please source control. We use the Gnulib git-to-changelog conversion script to
don't forget to update the ChangeLog. convert the Git comments into ChangeLog-style entries for release. As a
result, please format your Git comments carefully so they will look clean
after conversion. In particular, each line of your comment will have a TAB
added before it so be sure your comment lines are not longer than 72
characters; prefer 70 or less. Please use standard ChangeLog formats for
your commit messages (sans the leading TAB of course).
Rule #1: Don't rewrite pushed history (don't use "git push --force"). Rule #1: Don't rewrite pushed history (don't use "git push --force").
@@ -59,12 +64,13 @@ diff chunks in the same file. There is a video available which helps a lot.
Coding Standards Coding Standards
---------------- ----------------
GNU make code adheres to the GNU Coding Standards. Additionally, GNU make is GNU make code adheres to the GNU Coding Standards. Please use only spaces and
a foundational bootstrap package for the GNU project; as such it is very no TAB characters in source code.
conservative about language features it expects. It should build with any C
compiler conforming to the ANSI C89 / ISO C90 standard.
Please use only spaces and no TAB characters in source code. Additionally, GNU make is a foundational bootstrap package for the GNU
project; as such it is very conservative about language features it expects.
It should build with any C compiler conforming to the ANSI C89 / ISO C90
standard.
Building From Git Building From Git
@@ -73,7 +79,7 @@ Building From Git
To build GNU make from Git, you will need Autoconf, Automake, and To build GNU make from Git, you will need Autoconf, Automake, and
Gettext, and any tools that those utilities require (GNU m4, Perl, Gettext, and any tools that those utilities require (GNU m4, Perl,
etc.). See the configure.ac file to find the minimum versions of each etc.). See the configure.ac file to find the minimum versions of each
of these tools. You will also need a copy of wget. of these tools. You will also need a copy of wget and gnulib.
When building from Git you must build in the source directory: "VPATH When building from Git you must build in the source directory: "VPATH
builds" from remote directories are not supported. Once you've created builds" from remote directories are not supported. Once you've created
@@ -83,7 +89,6 @@ there.
After checking out the code, you will need to perform these steps to get After checking out the code, you will need to perform these steps to get
to the point where you can run "make". to the point where you can run "make".
1) $ autoreconf -i 1) $ autoreconf -i
This rebuilds all the things that need rebuilding, installing This rebuilds all the things that need rebuilding, installing
@@ -92,12 +97,10 @@ to the point where you can run "make".
You may get warnings here about missing files like README, etc. You may get warnings here about missing files like README, etc.
Ignore them, they are harmless. Ignore them, they are harmless.
2) $ ./configure 2) $ ./configure
Generate a Makefile Generate a Makefile
3) $ make update 3) $ make update
Use wget to retrieve various other files that GNU make relies on, Use wget to retrieve various other files that GNU make relies on,
@@ -106,7 +109,6 @@ to the point where you can run "make".
NB: You may need GNU make to correctly perform this step; if you use NB: You may need GNU make to correctly perform this step; if you use
a platform-local make you may get problems with missing files in doc/. a platform-local make you may get problems with missing files in doc/.
At this point you have successfully brought your Git copy of the GNU At this point you have successfully brought your Git copy of the GNU
make source directory up to the point where it can be treated make source directory up to the point where it can be treated
more-or-less like the official package you would get from ftp.gnu.org. more-or-less like the official package you would get from ftp.gnu.org.
@@ -158,29 +160,48 @@ Steps to Release
---------------- ----------------
Here are the things that need to be done (in more or less this order) Here are the things that need to be done (in more or less this order)
before making an official release: before making an official release. If something breaks such that you need to
change code, be sure to start over again sufficiently that everything is
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 configure.ac file with the new release number.
* Update the EDITION value in the doc/make.texi file.
* Update the NEWS file with the release number and date. * Update the NEWS file with the release number and date.
* Ensure the Savannah bug list URL in the NEWS file uses the correct
"Fixed Release" ID number.
* Run "make distcheck" to be sure it all works.
* Run "make check-alt-config" to be sure alternative configurations work
* Run "make update-makeweb" to get a copy of the GNU make web pages
* Run "make update-gnuweb" to get a copy of the GNU website boilerplate pages
* Update the web page boilerplate if necessary:
../gnu-www/www/server/standards/patch-from-parent ../make-web/make.html \
../gnu-www/www/server/standards/boilerplate.html
* Run "make gendocs" (requires gnulib) to generate the manual files for
the GNU make web pages.
* Follow the directions from gendocs for the web page repository
* run "make tag-release" to create a Git tag for the release
* Push everything:
git push --tags origin master
Manage the Savannah project for GNU make:
>>> This is only for real releases, not release candidate builds <<<
* In Savannah modify the "Value", "Rank", and "Description" values for the * In Savannah modify the "Value", "Rank", and "Description" values for the
current "SCM" entry in both "Component Version" and "Fix Release" fields current "SCM" entry in both "Component Version" and "Fix Release" fields
to refer to the new release, for "Bugs" and "Patches". to refer to the new release. The "Rank" field should be 10 less than the
* Update the Savannah bug list URL in the NEWS file to use the correct previous release so it orders properly.
"Fixed Release" ID number.
* In Savannah create a new entry for the "Component Version" and "Fix * In Savannah create a new entry for the "Component Version" and "Fix
Release" fields: Release" fields:
- Value: SCM - Value: SCM
- Rank: 20 - Rank: 20
- Descr: Fixed in Git; will be available in the next version of Make. - Descr: Fixed in Git; will be available in the next version of Make.
* Run "make distcheck" to be sure it all works.
* git tag -u <GPGID> <VER> where GPGID is my GPG key fingerprint, Start the next release:
and VER is the release version.
* Push everything: * Update configure.ac and add a ".90" to the release number.
git push --tags origin master * Update the NEWS file with a new section for the release / date.
* Create the new release in the Savannah "Bugs" Administration for * Update the Savannah URL for the bugs fixed in the NEWS section.
both the "Component Version" and "Fixed Release" fields.
* Create the new release in the Savannah "Patches" Administration for
the "Fixed Release" field.
Publishing a Package Publishing a Package
@@ -224,15 +245,22 @@ Create the announcement in a text file, then sign it with GPG.
gpg --clearsign <announcement.txt> gpg --clearsign <announcement.txt>
Upload to gnu.org, then login and send from my account there. Or, use your mail client's PGP/GPG signing capabilities.
To: bug-make@gnu.org, help-make@gnu.org, make-w32@gnu.org Announce the release:
CC: info-gnu@gnu.org
BCC: make-alpha@gnu.org
Add a news item to the Savannah project site. * For release candidate builds:
To: bug-make@gnu.org
CC: coordinator@translationproject.org
BCC: help-make@gnu.org, make-w32@gnu.org, make-alpha@gnu.org
Add an update to freshmeat.net. * For release builds
To: info-gnu@gnu.org, bug-make@gnu.org
CC: coordinator@translationproject.org
BCC: help-make@gnu.org, make-w32@gnu.org, make-alpha@gnu.org
* Add a news item to the Savannah project site.
* Add an update to freecode.com (nee freshmeat.net)
Appendix A - For The Brave Appendix A - For The Brave

View File

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

View File

@@ -3,7 +3,7 @@
# NOTE: If you have no 'make' program at all to process this makefile, # NOTE: If you have no 'make' program at all to process this makefile,
# run 'build.sh' instead. # run 'build.sh' instead.
# #
# Copyright (C) 1995-2013 Free Software Foundation, Inc. # Copyright (C) 1995-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/* Running commands on Amiga /* Running commands on Amiga
Copyright (C) 1995-2013 Free Software Foundation, Inc. Copyright (C) 1995-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -42,7 +42,7 @@ MyExecute (char **argv)
buffer = AllocMem (len, MEMF_ANY); buffer = AllocMem (len, MEMF_ANY);
if (!buffer) if (!buffer)
fatal (NILF, "MyExecute: Cannot allocate space for calling a command"); O (fatal, NILF, "MyExecute: Cannot allocate space for calling a command\n");
ptr = buffer; ptr = buffer;

View File

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

65
ar.c
View File

@@ -1,5 +1,5 @@
/* Interface to 'ar' archives for GNU Make. /* Interface to 'ar' archives for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
@@ -43,7 +43,7 @@ ar_name (const char *name)
return 0; return 0;
if (p[1] == '(' && end[-1] == ')') if (p[1] == '(' && end[-1] == ')')
fatal (NILF, _("attempt to use unsupported feature: '%s'"), name); OS (fatal, NILF, _("attempt to use unsupported feature: '%s'"), name);
return 1; return 1;
} }
@@ -120,7 +120,7 @@ ar_member_date (const char *name)
int int
ar_touch (const char *name) ar_touch (const char *name)
{ {
error (NILF, _("touch archive member is not available on VMS")); O (error, NILF, _("touch archive member is not available on VMS"));
return -1; return -1;
} }
#else #else
@@ -144,24 +144,24 @@ ar_touch (const char *name)
switch (ar_member_touch (arname, memname)) switch (ar_member_touch (arname, memname))
{ {
case -1: case -1:
error (NILF, _("touch: Archive '%s' does not exist"), arname); OS (error, NILF, _("touch: Archive '%s' does not exist"), arname);
break; break;
case -2: case -2:
error (NILF, _("touch: '%s' is not a valid archive"), arname); OS (error, NILF, _("touch: '%s' is not a valid archive"), arname);
break; break;
case -3: case -3:
perror_with_name ("touch: ", arname); perror_with_name ("touch: ", arname);
break; break;
case 1: case 1:
error (NILF, OSS (error, NILF,
_("touch: Member '%s' does not exist in '%s'"), memname, arname); _("touch: Member '%s' does not exist in '%s'"), memname, arname);
break; break;
case 0: case 0:
val = 0; val = 0;
break; break;
default: default:
error (NILF, OS (error, NILF,
_("touch: Bad return code from ar_member_touch on '%s'"), name); _("touch: Bad return code from ar_member_touch on '%s'"), name);
} }
free (arname); free (arname);
@@ -172,10 +172,20 @@ ar_touch (const char *name)
/* State of an 'ar_glob' run, passed to 'ar_glob_match'. */ /* State of an 'ar_glob' run, passed to 'ar_glob_match'. */
/* On VMS, (object) modules in libraries do not have suffixes. That is, to
find a match for a pattern, the pattern must not have any suffix. So the
suffix of the pattern is saved and the pattern is stripped (ar_glob).
If there is a match and the match, which is a module name, is added to
the chain, the saved suffix is added back to construct a source filename
(ar_glob_match). */
struct ar_glob_state struct ar_glob_state
{ {
const char *arname; const char *arname;
const char *pattern; const char *pattern;
#ifdef VMS
char *suffix;
#endif
unsigned int size; unsigned int size;
struct nameseq *chain; struct nameseq *chain;
unsigned int n; unsigned int n;
@@ -196,7 +206,13 @@ ar_glob_match (int desc UNUSED, const char *mem, int truncated UNUSED,
{ {
/* We have a match. Add it to the chain. */ /* We have a match. Add it to the chain. */
struct nameseq *new = xcalloc (state->size); struct nameseq *new = xcalloc (state->size);
new->name = strcache_add (concat (4, state->arname, "(", mem, ")")); #ifdef VMS
if (state->suffix)
new->name = strcache_add(
concat(5, state->arname, "(", mem, state->suffix, ")"));
else
#endif
new->name = strcache_add(concat(4, state->arname, "(", mem, ")"));
new->next = state->chain; new->next = state->chain;
state->chain = new; state->chain = new;
++state->n; ++state->n;
@@ -248,7 +264,9 @@ ar_glob (const char *arname, const char *member_pattern, unsigned int size)
struct nameseq *n; struct nameseq *n;
const char **names; const char **names;
unsigned int i; unsigned int i;
#ifdef VMS
char *vms_member_pattern;
#endif
if (! glob_pattern_p (member_pattern, 1)) if (! glob_pattern_p (member_pattern, 1))
return 0; return 0;
@@ -256,11 +274,36 @@ ar_glob (const char *arname, const char *member_pattern, unsigned int size)
ar_glob_match will accumulate them in STATE.chain. */ ar_glob_match will accumulate them in STATE.chain. */
state.arname = arname; state.arname = arname;
state.pattern = member_pattern; state.pattern = member_pattern;
#ifdef VMS
{
/* In a copy of the pattern, find the suffix, save it and remove it from
the pattern */
char *lastdot;
vms_member_pattern = xstrdup(member_pattern);
lastdot = strrchr(vms_member_pattern, '.');
state.suffix = lastdot;
if (lastdot)
{
state.suffix = xstrdup(lastdot);
*lastdot = 0;
}
state.pattern = vms_member_pattern;
}
#endif
state.size = size; state.size = size;
state.chain = 0; state.chain = 0;
state.n = 0; state.n = 0;
ar_scan (arname, ar_glob_match, &state); ar_scan (arname, ar_glob_match, &state);
#ifdef VMS
/* Deallocate any duplicated string */
free(vms_member_pattern);
if (state.suffix)
{
free(state.suffix);
}
#endif
if (state.chain == 0) if (state.chain == 0)
return 0; return 0;

287
arscan.c
View File

@@ -1,5 +1,5 @@
/* Library function for scanning an archive file. /* Library function for scanning an archive file.
Copyright (C) 1987-2013 Free Software Foundation, Inc. Copyright (C) 1987-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -16,6 +16,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h" #include "makeint.h"
#ifdef TEST
/* Hack, the real error() routine eventually pulls in die from main.c */
#define error(a, b, c, d)
#endif
#ifdef HAVE_FCNTL_H #ifdef HAVE_FCNTL_H
#include <fcntl.h> #include <fcntl.h>
#else #else
@@ -30,99 +35,139 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include <credef.h> #include <credef.h>
#include <descrip.h> #include <descrip.h>
#include <ctype.h> #include <ctype.h>
#include <ssdef.h>
#include <stsdef.h>
#include <rmsdef.h>
globalvalue unsigned int LBR$_HDRTRUNC;
#if __DECC #if __DECC
#include <unixlib.h> #include <unixlib.h>
#include <lbr$routines.h> #include <lbr$routines.h>
#endif #endif
const char *
vmsify (const char *name, int type);
/* Time conversion from VMS to Unix
Conversion from local time (stored in library) to GMT (needed for gmake)
Note: The tm_gmtoff element is a VMS extension to the ANSI standard. */
static time_t
vms_time_to_unix(void *vms_time)
{
struct tm *tmp;
time_t unix_time;
unix_time = decc$fix_time(vms_time);
tmp = localtime(&unix_time);
unix_time -= tmp->tm_gmtoff;
return unix_time;
}
/* VMS library routines need static variables for callback */
static void *VMS_lib_idx; static void *VMS_lib_idx;
static char *VMS_saved_memname; static const void *VMS_saved_arg;
static time_t VMS_member_date;
static long int (*VMS_function) (); static long int (*VMS_function) ();
static long int VMS_function_ret;
/* This is a callback procedure for lib$get_index */
static int static int
VMS_get_member_info (struct dsc$descriptor_s *module, unsigned long *rfa) VMS_get_member_info(struct dsc$descriptor_s *module, unsigned long *rfa)
{ {
int status, i; int status, i;
long int fnval; const int truncated = 0; /* Member name may be truncated */
time_t member_date; /* Member date */
char *filename;
unsigned int buffer_length; /* Actual buffer length */
time_t val; /* Unused constants - Make does not actually use most of these */
const int file_desc = -1; /* archive file descriptor for reading the data */
const int header_position = 0; /* Header position */
const int data_position = 0; /* Data position in file */
const int data_size = 0; /* Data size */
const int uid = 0; /* member gid */
const int gid = 0; /* member gid */
const int mode = 0; /* member protection mode */
/* End of unused constants */
static struct dsc$descriptor_s bufdesc = static struct dsc$descriptor_s bufdesc =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL }; { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
/* Only need the module definition */
struct mhddef *mhd; struct mhddef *mhd;
char filename[128];
bufdesc.dsc$a_pointer = filename; /* If a previous callback is non-zero, just return that status */
bufdesc.dsc$w_length = sizeof (filename); if (VMS_function_ret)
status = lbr$set_module (&VMS_lib_idx, rfa, &bufdesc,
&bufdesc.dsc$w_length, 0);
if (! (status & 1))
{ {
error (NILF, _("lbr$set_module() failed to extract module info, status = %d"), return SS$_NORMAL;
status);
lbr$close (&VMS_lib_idx);
return 0;
} }
mhd = (struct mhddef *) filename; /* lbr_set_module returns more than just the module header. So allocate
a buffer which is big enough: the maximum LBR$C_MAXHDRSIZ. That's at
least bigger than the size of struct mhddef.
If the request is too small, a buffer truncated warning is issued so
it can be reissued with a larger buffer.
We do not care if the buffer is truncated, so that is still a success. */
mhd = xmalloc(LBR$C_MAXHDRSIZ);
bufdesc.dsc$a_pointer = (char *) mhd;
bufdesc.dsc$w_length = LBR$C_MAXHDRSIZ;
#ifdef __DECC status = lbr$set_module(&VMS_lib_idx, rfa, &bufdesc, &buffer_length, 0);
/* John Fowler <jfowler@nyx.net> writes this is needed in his environment,
* but that decc$fix_time() isn't documented to work this way. Let me
* know if this causes problems in other VMS environments.
*/
{
/* Modified by M. Gehre at 11-JAN-2008 because old formula is wrong:
* val = decc$fix_time (&mhd->mhd$l_datim) + timezone - daylight*3600;
* a) daylight specifies, if the timezone has daylight saving enabled, not
* if it is active
* b) what we need is the information, if daylight saving was active, if
* the library module was replaced. This information we get using the
* localtime function
*/
struct tm *tmp; if ((status != LBR$_HDRTRUNC) && !$VMS_STATUS_SUCCESS(status))
{
ON(error, NILF,
_("lbr$set_module() failed to extract module info, status = %d"),
status);
/* Conversion from VMS time to C time */ lbr$close(&VMS_lib_idx);
val = decc$fix_time (&mhd->mhd$l_datim);
/* return status;
* Conversion from local time (stored in library) to GMT (needed for gmake) }
* Note: The tm_gmtoff element is a VMS extension to the ANSI standard.
*/ #ifdef TEST
tmp = localtime (&val); /* When testing this code, it is useful to know the length returned */
val -= tmp->tm_gmtoff; printf("Input length = %d, actual = %d\n",
} bufdesc.dsc$w_length, buffer_length);
#endif #endif
/* Conversion from VMS time to C time.
VMS defectlet - mhddef is sub-optimal, for the time, it has a 32 bit
longword, mhd$l_datim, and a 32 bit fill instead of two longwords, or
equivalent. */
member_date = vms_time_to_unix(&mhd->mhd$l_datim);
free(mhd);
/* Here we have a problem. The module name on VMS does not have
a file type, but the filename pattern in the "VMS_saved_arg"
may have one.
But only the method being called knows how to interpret the
filename pattern.
There are currently two different formats being used.
This means that we need a VMS specific code in those methods
to handle it. */
filename = xmalloc(module->dsc$w_length + 1);
/* TODO: We may need an option to preserve the case of the module
For now force the module name to lower case */
for (i = 0; i < module->dsc$w_length; i++) for (i = 0; i < module->dsc$w_length; i++)
filename[i] = _tolower ((unsigned char)module->dsc$a_pointer[i]); filename[i] = _tolower((unsigned char )module->dsc$a_pointer[i]);
filename[i] = '\0'; filename[i] = '\0';
VMS_member_date = (time_t) -1; VMS_function_ret = (*VMS_function)(file_desc, filename, truncated,
header_position, data_position, data_size, member_date, uid, gid, mode,
VMS_saved_arg);
fnval = free(filename);
(*VMS_function) (-1, filename, 0, 0, 0, 0, val, 0, 0, 0, return SS$_NORMAL;
VMS_saved_memname);
if (fnval)
{
VMS_member_date = fnval;
return 0;
}
else
return 1;
} }
/* Takes three arguments ARCHIVE, FUNCTION and ARG. /* Takes three arguments ARCHIVE, FUNCTION and ARG.
Open the archive named ARCHIVE, find its members one by one, Open the archive named ARCHIVE, find its members one by one,
@@ -153,60 +198,89 @@ VMS_get_member_info (struct dsc$descriptor_s *module, unsigned long *rfa)
Returns 0 if have scanned successfully. */ Returns 0 if have scanned successfully. */
long int long int
ar_scan (const char *archive, ar_member_func_t function, const void *arg) ar_scan (const char *archive, ar_member_func_t function, const void *varg)
{ {
char *p; char *vms_archive;
static struct dsc$descriptor_s libdesc = static struct dsc$descriptor_s libdesc =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL }; { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
unsigned long func = LBR$C_READ; const unsigned long func = LBR$C_READ;
unsigned long type = LBR$C_TYP_UNK; const unsigned long type = LBR$C_TYP_UNK;
unsigned long index = 1; const unsigned long index = 1;
unsigned long lib_idx;
int status; int status;
status = lbr$ini_control (&VMS_lib_idx, &func, &type, 0); VMS_saved_arg = varg;
if (! (status & 1)) /* Null archive string can show up in test and cause an access violation */
if (archive == NULL)
{ {
error (NILF, _("lbr$ini_control() failed with status = %d"), status); /* Null filenames do not exist */
return -2;
}
/* there is no such descriptor with "const char *dsc$a_pointer" */
libdesc.dsc$a_pointer = (char *)archive;
libdesc.dsc$w_length = strlen (archive);
status = lbr$open (&VMS_lib_idx, &libdesc, 0, 0, 0, 0, 0);
if (! (status & 1))
{
error (NILF, _("unable to open library '%s' to lookup member '%s'"),
archive, (char *)arg);
return -1; return -1;
} }
VMS_saved_memname = (char *)arg; /* archive path name must be in VMS format */
vms_archive = (char *) vmsify(archive, 0);
/* For comparison, delete .obj from arg name. */ status = lbr$ini_control(&VMS_lib_idx, &func, &type, 0);
p = strrchr (VMS_saved_memname, '.'); if (!$VMS_STATUS_SUCCESS(status))
if (p) {
*p = '\0'; ON(error, NILF, _("lbr$ini_control() failed with status = %d"), status);
return -2;
}
libdesc.dsc$a_pointer = vms_archive;
libdesc.dsc$w_length = strlen(vms_archive);
status = lbr$open(&VMS_lib_idx, &libdesc, 0, NULL, 0, NULL, 0);
if (!$VMS_STATUS_SUCCESS(status))
{
/* TODO: A library format failure could mean that this is a file
generated by the GNU AR utility and in that case, we need to
take the UNIX codepath. This will also take a change to the
GNV AR wrapper program. */
switch (status)
{
case RMS$_FNF:
/* Archive does not exist */
return -1;
default:
#ifndef TEST
OSN(error, NILF,
_("unable to open library '%s' to lookup member status %d"),
archive, status);
#endif
/* For library format errors, specification says to return -2 */
return -2;
}
}
VMS_function = function; VMS_function = function;
VMS_member_date = (time_t) -1; /* Clear the return status, as we are supposed to stop calling the
lbr$get_index (&VMS_lib_idx, &index, VMS_get_member_info, 0); callback function if it becomes non-zero, and this is a static
variable. */
VMS_function_ret = 0;
/* Undo the damage. */ status = lbr$get_index(&VMS_lib_idx, &index, VMS_get_member_info, NULL, 0);
if (p)
*p = '.';
lbr$close (&VMS_lib_idx); lbr$close(&VMS_lib_idx);
return VMS_member_date > 0 ? VMS_member_date : 0; /* Unless a failure occurred in the lbr$ routines, return the
the status from the 'function' routine. */
if ($VMS_STATUS_SUCCESS(status))
{
return VMS_function_ret;
}
/* This must be something wrong with the library and an error
message should already have been printed. */
return -2;
} }
#else /* !VMS */ #else /* !VMS */
@@ -251,10 +325,10 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
#endif #endif
#ifndef WINDOWS32 #ifndef WINDOWS32
# ifndef __BEOS__ # if !defined (__ANDROID__) && !defined (__BEOS__)
# include <ar.h> # include <ar.h>
# else # else
/* BeOS 5 doesn't have <ar.h> but has archives in the same format /* These platforms don't have <ar.h> but have archives in the same format
* as many other Unices. This was taken from GNU binutils for BeOS. * as many other Unices. This was taken from GNU binutils for BeOS.
*/ */
# define ARMAG "!<arch>\n" /* String that begins an archive file. */ # define ARMAG "!<arch>\n" /* String that begins an archive file. */
@@ -751,9 +825,32 @@ ar_name_equal (const char *name, const char *mem, int truncated)
#endif /* !__hpux && !cray */ #endif /* !__hpux && !cray */
#endif /* !AIAMAG */ #endif /* !AIAMAG */
} }
#endif /* !VMS */
return !strcmp (name, mem); return !strcmp (name, mem);
#else
/* VMS members do not have suffixes, but the filenames usually
have.
Do we need to strip VMS disk/directory format paths?
Most VMS compilers etc. by default are case insensitive
but produce uppercase external names, incl. module names.
However the VMS librarian (ar) and the linker by default
are case sensitive: they take what they get, usually
uppercase names. So for the non-default settings of the
compilers etc. there is a need to have a case sensitive
mode. */
{
int len;
len = strlen(mem);
int match;
char *dot;
if ((dot=strrchr(name,'.')))
match = (len == dot - name) && !strncasecmp(name, mem, len);
else
match = !strcasecmp (name, mem);
return match;
}
#endif /* !VMS */
} }
#ifndef VMS #ifndef VMS

View File

@@ -2,7 +2,7 @@
# Shell script to build GNU Make in the absence of any 'make' program. # Shell script to build GNU Make in the absence of any 'make' program.
# @configure_input@ # @configure_input@
# Copyright (C) 1993-2013 Free Software Foundation, Inc. # Copyright (C) 1993-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under
@@ -22,11 +22,11 @@
srcdir='@srcdir@' srcdir='@srcdir@'
CC='@CC@' CC='@CC@'
CFLAGS='@CFLAGS@' CFLAGS='@CFLAGS@ @GUILE_CFLAGS@'
CPPFLAGS='@CPPFLAGS@' CPPFLAGS='@CPPFLAGS@'
LDFLAGS='@LDFLAGS@' LDFLAGS='@AM_LDFLAGS@ @LDFLAGS@'
ALLOCA='@ALLOCA@' ALLOCA='@ALLOCA@'
LOADLIBES='@LIBS@ @LIBINTL@' LOADLIBES='@LIBS@ @GUILE_LIBS@ @LIBINTL@'
eval extras=\'@LIBOBJS@\' eval extras=\'@LIBOBJS@\'
REMOTE='@REMOTE@' REMOTE='@REMOTE@'
GLOBLIB='@GLOBLIB@' GLOBLIB='@GLOBLIB@'
@@ -46,7 +46,7 @@ includedir=${prefix}/include
localedir=${prefix}/share/locale localedir=${prefix}/share/locale
aliaspath=${localedir}${PATH_SEPARATOR}. aliaspath=${localedir}${PATH_SEPARATOR}.
defines="-DALIASPATH=\"${aliaspath}\" -DLOCALEDIR=\"${localedir}\" -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\""' @DEFS@' defines="-DLOCALEDIR=\"${localedir}\" -DLIBDIR=\"${libdir}\" -DINCLUDEDIR=\"${includedir}\""' @DEFS@'
# Exit as soon as any command fails. # Exit as soon as any command fails.
set -e set -e

View File

@@ -1,5 +1,5 @@
@echo off @echo off
rem Copyright (C) 1996-2013 Free Software Foundation, Inc. rem Copyright (C) 1996-2014 Free Software Foundation, Inc.
rem This file is part of GNU Make. rem This file is part of GNU Make.
rem rem
rem GNU Make is free software; you can redistribute it and/or modify it under rem GNU Make is free software; you can redistribute it and/or modify it under
@@ -30,7 +30,6 @@ copy config.h.W32 config.h
rem Guile configuration rem Guile configuration
set GUILECFLAGS= set GUILECFLAGS=
set GUILELIBS= set GUILELIBS=
set GUILESRC=
set NOGUILE= set NOGUILE=
set OPT=-O2 set OPT=-O2
set COMPILER= set COMPILER=
@@ -79,7 +78,6 @@ GoTo GuileDone
echo "pkg-config not found, building without Guile" echo "pkg-config not found, building without Guile"
:GuileDone :GuileDone
if not "%GUILECFLAGS%" == "" echo "Guile found, building with Guile" if not "%GUILECFLAGS%" == "" echo "Guile found, building with Guile"
if not "%GUILECFLAGS%" == "" set GUILESRC=guile.c
if not "%GUILECFLAGS%" == "" set GUILECFLAGS=%GUILECFLAGS% -DHAVE_GUILE if not "%GUILECFLAGS%" == "" set GUILECFLAGS=%GUILECFLAGS% -DHAVE_GUILE
if "%COMPILER%" == "gcc" if "%OPT%" == "-O0" echo "Building without compiler optimizations" if "%COMPILER%" == "gcc" if "%OPT%" == "-O0" echo "Building without compiler optimizations"
cd w32\subproc cd w32\subproc
@@ -162,8 +160,7 @@ cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D
echo WinDebug\fnmatch.obj >>link.dbg echo WinDebug\fnmatch.obj >>link.dbg
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c .\w32\pathstuff.c cl.exe /nologo /MT /W4 /GX /Zi /YX /Od /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c .\w32\pathstuff.c
echo WinDebug\pathstuff.obj >>link.dbg echo WinDebug\pathstuff.obj >>link.dbg
if "%GUILESRC%" == "" GoTo LinkDbg cl.exe /nologo /MT /W4 /GX /Zi /YX /Od %GUILECFLAGS% /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c guile.c
cl.exe /nologo /MT /W4 /GX /Zi /YX /Od %GUILECFLAGS%% /I . /I glob /I w32/include /D _DEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinDebug/ /Fp.\WinDebug/%make%.pch /Fo.\WinDebug/ /Fd.\WinDebug/%make%.pdb /c guile.c
echo WinDebug\guile.obj >>link.dbg echo WinDebug\guile.obj >>link.dbg
:LinkDbg :LinkDbg
echo off echo off
@@ -241,8 +238,7 @@ cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WIND
echo WinRel\fnmatch.obj >>link.rel echo WinRel\fnmatch.obj >>link.rel
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c .\w32\pathstuff.c cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c .\w32\pathstuff.c
echo WinRel\pathstuff.obj >>link.rel echo WinRel\pathstuff.obj >>link.rel
if "%GUILESRC%" == "" GoTo LinkRel cl.exe /nologo /MT /W4 /GX /YX /O2 %GUILECFLAGS% /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c guile.c
cl.exe /nologo /MT /W4 /GX /YX /O2 /I . /I glob /I w32/include /D NDEBUG /D WINDOWS32 /D WIN32 /D _CONSOLE /D HAVE_CONFIG_H /FR.\WinRel/ /Fp.\WinRel/%make%.pch /Fo.\WinRel/ /c guile.c
echo WinRel\guile.obj >>link.rel echo WinRel\guile.obj >>link.rel
:LinkRel :LinkRel
echo off echo off
@@ -288,18 +284,13 @@ gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ./glob/fnmatch.c -o fnmatch.o gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ./glob/fnmatch.c -o fnmatch.o
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ./w32/pathstuff.c -o pathstuff.o gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ./w32/pathstuff.c -o pathstuff.o
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ./w32/compat/posixfcn.c -o posixfcn.o gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c ./w32/compat/posixfcn.c -o posixfcn.o
@echo off
set GUILEOBJ=
if "%GUILESRC%" == "" GoTo LinkGCC
set GUILEOBJ=guile.o
echo on
gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% %GUILECFLAGS% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c guile.c gcc -mthreads -Wall -gdwarf-2 -g3 %OPT% %GUILECFLAGS% -I. -I./glob -I./w32/include -DWINDOWS32 -DHAVE_CONFIG_H -c guile.c
:LinkGCC :LinkGCC
@echo off @echo off
Rem The version NN of libgnumake-NN.dll.a should be bumped whenever Rem The version NN of libgnumake-NN.dll.a should be bumped whenever
Rem the API changes in binary-incompatible manner. Rem the API changes in binary-incompatible manner.
@echo on @echo on
gcc -mthreads -gdwarf-2 -g3 -o gnumake.exe variable.o rule.o remote-stub.o commands.o file.o getloadavg.o default.o signame.o expand.o dir.o main.o getopt1.o %GUILEOBJ% job.o output.o read.o version.o getopt.o arscan.o remake.o misc.o hash.o strcache.o ar.o function.o vpath.o implicit.o loadapi.o load.o glob.o fnmatch.o pathstuff.o posixfcn.o w32_misc.o sub_proc.o w32err.o %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -Wl,--out-implib=libgnumake-1.dll.a gcc -mthreads -gdwarf-2 -g3 -o gnumake.exe variable.o rule.o remote-stub.o commands.o file.o getloadavg.o default.o signame.o expand.o dir.o main.o getopt1.o guile.o job.o output.o read.o version.o getopt.o arscan.o remake.o misc.o hash.o strcache.o ar.o function.o vpath.o implicit.o loadapi.o load.o glob.o fnmatch.o pathstuff.o posixfcn.o w32_misc.o sub_proc.o w32err.o %GUILELIBS% -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -luuid -lodbc32 -lodbccp32 -Wl,--out-implib=libgnumake-1.dll.a
@GoTo BuildEnd @GoTo BuildEnd
:Usage :Usage
echo Usage: %0 [options] [gcc] echo Usage: %0 [options] [gcc]
@@ -310,8 +301,6 @@ echo. --without-guile Do not compile Guile support even if found
echo. --help Display these instructions and exit echo. --help Display these instructions and exit
:BuildEnd :BuildEnd
@echo off @echo off
set GUILEOBJ=
set GUILESRC=
set GUILELIBS= set GUILELIBS=
set GUILECFLAGS= set GUILECFLAGS=
set PKGMSC= set PKGMSC=

View File

@@ -1,5 +1,5 @@
/* Command processing for GNU Make. /* Command processing for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -14,8 +14,6 @@ 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 You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>. */ this program. If not, see <http://www.gnu.org/licenses/>. */
#include <dlfcn.h>
#include "makeint.h" #include "makeint.h"
#include "filedef.h" #include "filedef.h"
#include "dep.h" #include "dep.h"
@@ -403,7 +401,7 @@ chop_commands (struct commands *cmds)
CMDS->any_recurse flag. */ CMDS->any_recurse flag. */
if (nlines > USHRT_MAX) if (nlines > USHRT_MAX)
fatal (&cmds->fileinfo, _("Recipe has too many lines (%ud)"), nlines); ON (fatal, &cmds->fileinfo, _("Recipe has too many lines (%ud)"), nlines);
cmds->ncommand_lines = nlines; cmds->ncommand_lines = nlines;
cmds->command_lines = lines; cmds->command_lines = lines;
@@ -587,7 +585,7 @@ fatal_error_signal (int sig)
if (sig == SIGQUIT) if (sig == SIGQUIT)
/* We don't want to send ourselves SIGQUIT, because it will /* We don't want to send ourselves SIGQUIT, because it will
cause a core dump. Just exit instead. */ cause a core dump. Just exit instead. */
exit (EXIT_FAILURE); exit (MAKE_TROUBLE);
#endif #endif
#ifdef WINDOWS32 #ifdef WINDOWS32
@@ -627,11 +625,13 @@ delete_target (struct file *file, const char *on_behalf_of)
if (ar_member_date (file->name) != file_date) if (ar_member_date (file->name) != file_date)
{ {
if (on_behalf_of) if (on_behalf_of)
error (NILF, _("*** [%s] Archive member '%s' may be bogus; not deleted"), OSS (error, NILF,
on_behalf_of, file->name); _("*** [%s] Archive member '%s' may be bogus; not deleted"),
on_behalf_of, file->name);
else else
error (NILF, _("*** Archive member '%s' may be bogus; not deleted"), OS (error, NILF,
file->name); _("*** Archive member '%s' may be bogus; not deleted"),
file->name);
} }
return; return;
} }
@@ -643,9 +643,10 @@ delete_target (struct file *file, const char *on_behalf_of)
&& FILE_TIMESTAMP_STAT_MODTIME (file->name, st) != file->last_mtime) && FILE_TIMESTAMP_STAT_MODTIME (file->name, st) != file->last_mtime)
{ {
if (on_behalf_of) if (on_behalf_of)
error (NILF, _("*** [%s] Deleting file '%s'"), on_behalf_of, file->name); OSS (error, NILF,
_("*** [%s] Deleting file '%s'"), on_behalf_of, file->name);
else else
error (NILF, _("*** Deleting file '%s'"), file->name); OS (error, NILF, _("*** Deleting file '%s'"), file->name);
if (unlink (file->name) < 0 if (unlink (file->name) < 0
&& errno != ENOENT) /* It disappeared; so what. */ && errno != ENOENT) /* It disappeared; so what. */
perror_with_name ("unlink: ", file->name); perror_with_name ("unlink: ", file->name);

View File

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

View File

@@ -1,5 +1,5 @@
/* config.h -- hand-massaged for Amiga -*-C-*- /* config.h -- hand-massaged for Amiga -*-C-*-
Copyright (C) 1995-2013 Free Software Foundation, Inc. Copyright (C) 1995-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -318,6 +318,12 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define if you have the kstat library (-lkstat). */ /* Define if you have the kstat library (-lkstat). */
/* #undef HAVE_LIBKSTAT */ /* #undef HAVE_LIBKSTAT */
/* Define to 1 if you have the `isatty' function. */
/* #undef HAVE_ISATTY */
/* Define to 1 if you have the `ttyname' function. */
/* #undef HAVE_TTYNAME */
/* Define if you have the sun library (-lsun). */ /* Define if you have the sun library (-lsun). */
/* #undef HAVE_LIBSUN */ /* #undef HAVE_LIBSUN */

View File

@@ -1,6 +1,6 @@
/* config.h-vms. Generated by hand by Klaus Kämpf <kkaempf@rmi.de> -*-C-*- /* config.h-vms. Generated by hand by Klaus Kämpf <kkaempf@rmi.de> -*-C-*-
Copyright (C) 1996-2013 Free Software Foundation, Inc. Copyright (C) 1996-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -18,6 +18,12 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* config.h. Generated automatically by configure. */ /* config.h. Generated automatically by configure. */
/* config.h.in. Generated automatically from configure.ac by autoheader. */ /* config.h.in. Generated automatically from configure.ac by autoheader. */
/* Pull in types.h here to get __CRTL_VER defined for old versions of the
compiler which don't define it. */
#ifdef __DECC
# include <types.h>
#endif
/* Define to 1 if on AIX 3. /* Define to 1 if on AIX 3.
System headers sometimes define this. System headers sometimes define this.
We just want to avoid a redefinition error message. */ We just want to avoid a redefinition error message. */
@@ -356,6 +362,12 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the sun library (-lsun). */ /* Define to 1 if you have the sun library (-lsun). */
/* #undef HAVE_LIBSUN */ /* #undef HAVE_LIBSUN */
/* Define to 1 if you have the `isatty' function. */
/* #undef HAVE_ISATTY */
/* Define to 1 if you have the `ttyname' function. */
/* #undef HAVE_TTYNAME */
/* Use high resolution file timestamps if nonzero. */ /* Use high resolution file timestamps if nonzero. */
#define FILE_TIMESTAMP_HI_RES 0 #define FILE_TIMESTAMP_HI_RES 0
@@ -372,15 +384,9 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* #undef HAVE_VMSDIR_H */ /* #undef HAVE_VMSDIR_H */
/* #undef _DIRENT_HAVE_D_NAMLEN */ /* #undef _DIRENT_HAVE_D_NAMLEN */
/* On older systems without 7.0 backport of CRTL the first one is defined */ /* On older systems without 7.0 backport of CRTL use non-VMS code for opendir() etc. */
#ifdef __CRTL_VER #if __CRTL_VER < 70000000
# if __CRTL_VER < 70000000 # define HAVE_VMSDIR_H 1
# define HAVE_VMSDIR_H 1
# endif
#else
# if __VMS_VER < 70000000
# define HAVE_VMSDIR_H 1
# endif
#endif #endif
#if defined(HAVE_VMSDIR_H) && defined(HAVE_DIRENT_H) #if defined(HAVE_VMSDIR_H) && defined(HAVE_DIRENT_H)
@@ -414,5 +420,13 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Output sync sypport */ /* Output sync sypport */
#define NO_OUTPUT_SYNC #define NO_OUTPUT_SYNC
/* Define to 1 to write even short single-line actions into a VMS/DCL command
file; this also enables exporting make environment variables into the
(sub-)process, which executes the action.
The usual make rules apply whether a shell variable - here a DCL symbol or
VMS logical [see CRTL getenv()] - is added to the make environment and
is exported. */
#define USE_DCL_COM_FILE 1
/* Build host information. */ /* Build host information. */
#define MAKE_HOST "VMS" #define MAKE_HOST "VMS"

View File

@@ -1,6 +1,6 @@
/* config.h.W32 -- hand-massaged config.h file for Windows builds -*-C-*- /* config.h.W32 -- hand-massaged config.h file for Windows builds -*-C-*-
Copyright (C) 1996-2013 Free Software Foundation, Inc. Copyright (C) 1996-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -292,6 +292,13 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define to 1 if you have the 'strsignal' function. */ /* Define to 1 if you have the 'strsignal' function. */
/* #undef HAVE_STRSIGNAL */ /* #undef HAVE_STRSIGNAL */
/* Define to 1 if you have the `isatty' function. */
#define HAVE_ISATTY 1
/* Define to 1 if you have the `ttyname' function. */
#define HAVE_TTYNAME 1
char *ttyname (int);
/* Define to 1 if 'n_un.n_name' is a member of 'struct nlist'. */ /* Define to 1 if 'n_un.n_name' is a member of 'struct nlist'. */
/* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */ /* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */

1
config/.gitignore vendored
View File

@@ -1,3 +1,4 @@
ar-lib
compile compile
config.guess config.guess
config.rpath config.rpath

View File

@@ -33,7 +33,7 @@
* Makefile.am: New file. * Makefile.am: New file.
Copyright (C) 2002-2013 Free Software Foundation, Inc. Copyright (C) 2002-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the

View File

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

View File

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

View File

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

View File

@@ -1,6 +1,6 @@
# Process this file with autoconf to produce a configure script. # Process this file with autoconf to produce a configure script.
# #
# Copyright (C) 1993-2013 Free Software Foundation, Inc. # Copyright (C) 1993-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # 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 # You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>. # this program. If not, see <http://www.gnu.org/licenses/>.
AC_INIT([GNU make],[4.0],[bug-make@gnu.org]) AC_INIT([GNU make],[4.1],[bug-make@gnu.org])
AC_PREREQ([2.62]) AC_PREREQ([2.62])
@@ -26,9 +26,13 @@ AC_CONFIG_SRCDIR([vpath.c])
AC_CONFIG_HEADERS([config.h]) AC_CONFIG_HEADERS([config.h])
# Automake setup # Automake setup
AM_INIT_AUTOMAKE([1.11.1 silent-rules]) # We have to enable "foreign" because ChangeLog is auto-generated
# We cannot enable -Werror because gettext 0.18.1 has invalid content
# When we update gettext to 0.18.3 or better we can add it again.
AM_INIT_AUTOMAKE([1.11.1 silent-rules foreign -Wall])
# Checks for programs. # Checks for programs.
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC AC_PROG_CC
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_RANLIB AC_PROG_RANLIB
@@ -37,6 +41,9 @@ AC_CHECK_PROG([AR], [ar], [ar], [ar])
# Perl is needed for the test suite (only) # Perl is needed for the test suite (only)
AC_CHECK_PROG([PERL], [perl], [perl], [perl]) AC_CHECK_PROG([PERL], [perl], [perl], [perl])
# Needed for w32/Makefile.am
AM_PROG_AR
# Specialized system macros # Specialized system macros
AC_CANONICAL_HOST AC_CANONICAL_HOST
AC_AIX AC_AIX
@@ -44,7 +51,6 @@ AC_ISC_POSIX
AC_MINIX AC_MINIX
# Enable gettext, in "external" mode. # Enable gettext, in "external" mode.
AM_GNU_GETTEXT_VERSION([0.18.1]) AM_GNU_GETTEXT_VERSION([0.18.1])
AM_GNU_GETTEXT([external]) AM_GNU_GETTEXT([external])
@@ -134,7 +140,7 @@ AC_CHECK_FUNCS([strdup strndup mkstemp mktemp fdopen fileno \
dup dup2 getcwd realpath sigsetmask sigaction \ dup dup2 getcwd realpath sigsetmask sigaction \
getgroups seteuid setegid setlinebuf setreuid setregid \ getgroups seteuid setegid setlinebuf setreuid setregid \
getrlimit setrlimit setvbuf pipe strerror strsignal \ getrlimit setrlimit setvbuf pipe strerror strsignal \
lstat readlink atexit]) lstat readlink atexit isatty ttyname])
# We need to check declarations, not just existence, because on Tru64 this # We need to check declarations, not just existence, because on Tru64 this
# function is not declared without special flags, which themselves cause # function is not declared without special flags, which themselves cause
@@ -243,8 +249,8 @@ AS_IF([test "$PATH_SEPARATOR" = ';'],
AC_SUBST([REMOTE]) REMOTE=stub AC_SUBST([REMOTE]) REMOTE=stub
use_customs=false use_customs=false
AC_ARG_WITH([customs], AC_ARG_WITH([customs],
[ AC_HELP_STRING([--with-customs=DIR], [AC_HELP_STRING([--with-customs=DIR],
[enable remote jobs via Customs--see README.customs])], [enable remote jobs via Customs--see README.customs])],
[ AS_CASE([$withval], [n|no], [:], [ AS_CASE([$withval], [n|no], [:],
[make_cppflags="$CPPFLAGS" [make_cppflags="$CPPFLAGS"
AS_CASE([$withval], AS_CASE([$withval],
@@ -317,20 +323,20 @@ AC_ARG_ENABLE([load],
[make_cv_load="$enableval" user_load="$enableval"], [make_cv_load="$enableval" user_load="$enableval"],
[make_cv_load="yes"]) [make_cv_load="yes"])
AS_CASE([/$ac_cv_func_dlopen/$ac_cv_func_dlsym/$ac_cv_func_dlerror/], AS_CASE([/$ac_cv_have_decl_dlopen/$ac_cv_have_decl_dlsym/$ac_cv_have_decl_dlerror/],
[*/no/*], [make_cv_load=no]) [*/no/*], [make_cv_load=no])
# We might need -ldl
AS_IF([test "$make_cv_load" = yes], [
AC_SEARCH_LIBS([dlopen], [dl], [], [make_cv_load=])
])
AS_CASE([/$make_cv_load/$user_load/], AS_CASE([/$make_cv_load/$user_load/],
[*/no/*], [make_cv_load=no], [*/no/*], [make_cv_load=no],
[AC_DEFINE(MAKE_LOAD, 1, [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.])
]) ])
# We might need -ldl
AS_IF([test "$make_cv_load" = yes], [
AC_SEARCH_LIBS([dlopen], [dl], [], [make_cv_load=])
])
# If we want load support, we might need to link with export-dynamic. # If we want load support, we might need to link with export-dynamic.
# See if we can figure it out. Unfortunately this is very difficult. # See if we can figure it out. Unfortunately this is very difficult.
# For example passing -rdynamic to the SunPRO linker gives a warning # For example passing -rdynamic to the SunPRO linker gives a warning
@@ -498,7 +504,7 @@ AS_IF([test "x$make_cv_load" = xno && test "x$user_load" = xyes],
# Specify what files are to be created. # Specify what files are to be created.
AC_CONFIG_FILES([Makefile glob/Makefile po/Makefile.in config/Makefile \ AC_CONFIG_FILES([Makefile glob/Makefile po/Makefile.in config/Makefile \
doc/Makefile w32/Makefile]) doc/Makefile w32/Makefile tests/config-flags.pm])
# OK, do it! # OK, do it!

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
/* Data base of default implicit rules for GNU Make. /* Data base of default implicit rules for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -38,9 +38,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
static char default_suffixes[] static char default_suffixes[]
#ifdef VMS #ifdef VMS
= ".exe .olb .ln .obj .c .cxx .cc .pas .p .for .f .r .y .l .mar \ /* VMS should include all UNIX/POSIX + some VMS extensions */
.s .ss .i .ii .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \ = ".out .exe .a .olb .hlb .tlb .mlb .ln .o .obj .c .cxx .cc .cpp .pas .p \
.w .ch .cweb .web .com .sh .elc .el"; .for .f .r .y .l .ym .yl .mar .s .ss .i .ii .mod .sym .def .h .info .dvi \
.tex .texinfo .texi .txinfo .mem .hlp .brn .rnh .rno .rnt .rnx .w .ch .cweb \
.web .com .sh .elc .el";
#elif defined(__EMX__) #elif defined(__EMX__)
= ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \ = ".out .a .ln .o .c .cc .C .cpp .p .f .F .m .r .y .l .ym .yl .s .S \
.mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \ .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
@@ -53,19 +55,35 @@ static char default_suffixes[]
static struct pspec default_pattern_rules[] = static struct pspec default_pattern_rules[] =
{ {
#ifdef VMS
{ "(%)", "%", { "(%)", "%",
"@if f$$search(\"$@\") .eqs. \"\" then $(LIBRARY)/CREATE/"
"$(or "
"$(patsubst %,TEXT,$(filter %.tlb %.TLB,$@)),"
"$(patsubst %,HELP,$(filter %.hlb %.HLB,$@)),"
"$(patsubst %,MACRO,$(filter %.mlb %.MLB,$@)),"
"$(and "
"$(patsubst %,SHARE,$(filter %.olb %.OLB,$@)),"
"$(patsubst %,SHARE,$(filter %.exe %.EXE,$<))),"
"OBJECT)"
" $@\n"
"$(AR) $(ARFLAGS) $@ $<" }, "$(AR) $(ARFLAGS) $@ $<" },
#else
{ "(%)", "%",
"$(AR) $(ARFLAGS) $@ $<" },
#endif
/* The X.out rules are only in BSD's default set because /* The X.out rules are only in BSD's default set because
BSD Make has no null-suffix rules, so 'foo.out' and BSD Make has no null-suffix rules, so 'foo.out' and
'foo' are the same thing. */ 'foo' are the same thing. */
#ifdef VMS #ifdef VMS
{ "%.exe", "%", { "%.exe", "%",
"copy $< $@" }, "$(CP) $< $@" },
#else
#endif
{ "%.out", "%", { "%.out", "%",
"@rm -f $@ \n cp $< $@" }, "@rm -f $@ \n cp $< $@" },
#endif
/* Syntax is "ctangle foo.w foo.ch foo.c". */ /* Syntax is "ctangle foo.w foo.ch foo.c". */
{ "%.c", "%.w %.ch", { "%.c", "%.w %.ch",
"$(CTANGLE) $^ $@" }, "$(CTANGLE) $^ $@" },
@@ -78,18 +96,20 @@ static struct pspec default_pattern_rules[] =
static struct pspec default_terminal_rules[] = static struct pspec default_terminal_rules[] =
{ {
#ifdef VMS #ifdef VMS
/* RCS. */ /* RCS. */
{ "%", "%$$5lv", /* Multinet style */ { "%", "%$$5lv", /* Multinet style */
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" }, "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
{ "%", "[.$$rcs]%$$5lv", /* Multinet style */ { "%", "[.$$rcs]%$$5lv", /* Multinet style */
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" }, "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
{ "%", "%_v", /* Normal style */ { "%", "%_v", /* Normal style */
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" }, "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
{ "%", "[.rcs]%_v", /* Normal style */ { "%", "[.rcs]%_v", /* Normal style */
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" }, "if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
/* SCCS. */ /* SCCS. */
/* ain't no SCCS on vms */ /* ain't no SCCS on vms */
#else #else
/* RCS. */ /* RCS. */
{ "%", "%,v", { "%", "%,v",
@@ -108,7 +128,7 @@ static struct pspec default_terminal_rules[] =
{ 0, 0, 0 } { 0, 0, 0 }
}; };
static char *default_suffix_rules[] = static const char *default_suffix_rules[] =
{ {
#ifdef VMS #ifdef VMS
".obj.exe", ".obj.exe",
@@ -149,6 +169,8 @@ static char *default_suffix_rules[] =
"$(COMPILE.c)/noprep/noobj/machine /list=$@ $<", "$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
".c.obj", ".c.obj",
"$(COMPILE.c) /obj=$@ $<", "$(COMPILE.c) /obj=$@ $<",
".c.o",
"$(COMPILE.c) /obj=$@ $<",
".cc.ii", ".cc.ii",
"$(COMPILE.cc)/prep /list=$@ $<", "$(COMPILE.cc)/prep /list=$@ $<",
".cc.ss", ".cc.ss",
@@ -157,12 +179,20 @@ static char *default_suffix_rules[] =
"$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<", "$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
".cc.obj", ".cc.obj",
"$(COMPILE.cc) /obj=$@ $<", "$(COMPILE.cc) /obj=$@ $<",
".cc.o",
"$(COMPILE.cc) /obj=$@ $<",
".cxx.obj", ".cxx.obj",
"$(COMPILE.cxx) /obj=$@ $<", "$(COMPILE.cxx) /obj=$@ $<",
".cxx.o",
"$(COMPILE.cxx) /obj=$@ $<",
".for.obj", ".for.obj",
"$(COMPILE.for) /obj=$@ $<", "$(COMPILE.for) /obj=$@ $<",
".for.o",
"$(COMPILE.for) /obj=$@ $<",
".pas.obj", ".pas.obj",
"$(COMPILE.pas) /obj=$@ $<", "$(COMPILE.pas) /obj=$@ $<",
".pas.o",
"$(COMPILE.pas) /obj=$@ $<",
".y.c", ".y.c",
"$(YACC.y) $< \n rename y_tab.c $@", "$(YACC.y) $< \n rename y_tab.c $@",
@@ -322,7 +352,8 @@ static const char *default_variables[] =
#ifdef __VAX #ifdef __VAX
"ARCH", "VAX", "ARCH", "VAX",
#endif #endif
"AR", "library/obj", "AR", "library",
"LIBRARY", "library",
"ARFLAGS", "/replace", "ARFLAGS", "/replace",
"AS", "macro", "AS", "macro",
"MACRO", "macro", "MACRO", "macro",
@@ -332,15 +363,21 @@ static const char *default_variables[] =
"CC", "cc", "CC", "cc",
#endif #endif
"CD", "builtin_cd", "CD", "builtin_cd",
"MAKE", "make", "ECHO", "builtin_echo",
"ECHO", "write sys$$output \"",
#ifdef GCC_IS_NATIVE #ifdef GCC_IS_NATIVE
"C++", "gcc/plus", "C++", "gcc/plus",
"CXX", "gcc/plus", "CXX", "gcc/plus",
#else #else
"C++", "cxx", "C++", "cxx",
"CXX", "cxx", "CXX", "cxx",
#ifndef __ia64
"CXXLD", "cxxlink", "CXXLD", "cxxlink",
"CXXLINK", "cxxlink",
#else
/* CXXLINK is not used on VMS/IA64 */
"CXXLD", "link",
"CXXLINK", "link",
#endif
#endif #endif
"CO", "co", "CO", "co",
"CPP", "$(CC) /preprocess_only", "CPP", "$(CC) /preprocess_only",
@@ -393,6 +430,7 @@ static const char *default_variables[] =
"MV", "rename/new_version", "MV", "rename/new_version",
"CP", "copy", "CP", "copy",
".LIBPATTERNS", "%.olb lib%.a",
#else /* !VMS */ #else /* !VMS */
@@ -523,6 +561,8 @@ static const char *default_variables[] =
".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a", ".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
#elif defined(__APPLE__) #elif defined(__APPLE__)
".LIBPATTERNS", "lib%.dylib lib%.a", ".LIBPATTERNS", "lib%.dylib lib%.a",
#elif defined(__CYGWIN__) || defined(WINDOWS32)
".LIBPATTERNS", "lib%.dll.a %.dll.a lib%.a %.lib lib%.dll %.dll",
#else #else
".LIBPATTERNS", "lib%.so lib%.a", ".LIBPATTERNS", "lib%.so lib%.a",
#endif #endif
@@ -546,8 +586,8 @@ set_default_suffixes (void)
else else
{ {
struct dep *d; struct dep *d;
char *p = default_suffixes; const char *p = default_suffixes;
suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ (&p, struct dep), suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ ((char **)&p, struct dep),
NULL); NULL);
for (d = suffix_file->deps; d; d = d->next) for (d = suffix_file->deps; d; d = d->next)
d->file->builtin = 1; d->file->builtin = 1;
@@ -564,7 +604,7 @@ set_default_suffixes (void)
void void
install_default_suffix_rules (void) install_default_suffix_rules (void)
{ {
char **s; const char **s;
if (no_builtin_rules_flag) if (no_builtin_rules_flag)
return; return;
@@ -576,7 +616,7 @@ install_default_suffix_rules (void)
assert (f->cmds == 0); assert (f->cmds == 0);
f->cmds = xmalloc (sizeof (struct commands)); f->cmds = xmalloc (sizeof (struct commands));
f->cmds->fileinfo.filenm = 0; f->cmds->fileinfo.filenm = 0;
f->cmds->commands = s[1]; f->cmds->commands = xstrdup (s[1]);
f->cmds->command_lines = 0; f->cmds->command_lines = 0;
f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT; f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
f->builtin = 1; f->builtin = 1;

2
dep.h
View File

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

13
dir.c
View File

@@ -1,5 +1,5 @@
/* Directory hashing for GNU Make. /* Directory hashing for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -674,7 +674,7 @@ dir_contents_file_exists_p (struct directory_contents *dir,
if (d == 0) if (d == 0)
{ {
if (errno) if (errno)
fatal (NILF, "INTERNAL: readdir: %s\n", strerror (errno)); pfatal_with_name ("INTERNAL: readdir");
break; break;
} }
@@ -1172,13 +1172,6 @@ read_dirstream (__ptr_t stream)
return 0; return 0;
} }
static void
ansi_free (void *p)
{
if (p)
free (p);
}
/* On 64 bit ReliantUNIX (5.44 and above) in LFS mode, stat() is actually a /* On 64 bit ReliantUNIX (5.44 and above) in LFS mode, stat() is actually a
* macro for stat64(). If stat is a macro, make a local wrapper function to * macro for stat64(). If stat is a macro, make a local wrapper function to
* invoke it. * invoke it.
@@ -1224,7 +1217,7 @@ dir_setup_glob (glob_t *gl)
{ {
gl->gl_opendir = open_dirstream; gl->gl_opendir = open_dirstream;
gl->gl_readdir = read_dirstream; gl->gl_readdir = read_dirstream;
gl->gl_closedir = ansi_free; gl->gl_closedir = free;
gl->gl_stat = local_stat; gl->gl_stat = local_stat;
/* We don't bother setting gl_lstat, since glob never calls it. /* We don't bother setting gl_lstat, since glob never calls it.
The slot is only there for compatibility with 4.4 BSD. */ The slot is only there for compatibility with 4.4 BSD. */

2
doc/.gitignore vendored
View File

@@ -1,3 +1,5 @@
manual/
gendocs_template
fdl.texi fdl.texi
make-stds.texi make-stds.texi
stamp-vti stamp-vti

View File

@@ -1,5 +1,5 @@
# -*-Makefile-*-, or close enough # -*-Makefile-*-, or close enough
# Copyright (C) 2000-2013 Free Software Foundation, Inc. # Copyright (C) 2000-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under
@@ -22,14 +22,3 @@ info_TEXINFOS = make.texi
make_TEXINFOS = fdl.texi make-stds.texi make_TEXINFOS = fdl.texi make-stds.texi
CLEANFILES = make*.html CLEANFILES = make*.html
## ----------------------------- ##
## Other documentation formats. ##
## ----------------------------- ##
html: make_1.html
make_1.html: $(info_TEXINFOS) $(make_TEXINFOS)
$(TEXI2HTML) $(TEXI2HTML_FLAGS) $(srcdir)/make.texi
.PHONY: html

View File

@@ -3,7 +3,7 @@
@setfilename make.info @setfilename make.info
@include version.texi @include version.texi
@set EDITION 0.72 @set EDITION 0.73
@settitle GNU @code{make} @settitle GNU @code{make}
@setchapternewpage odd @setchapternewpage odd
@@ -26,7 +26,7 @@ of @cite{The GNU Make Manual}, for GNU @code{make} version @value{VERSION}.
Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, Copyright @copyright{} 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995,
1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 1996, 1997, 1998, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007,
2008, 2009, 2010, 2011, 2012, 2013 Free Software Foundation, Inc. 2008, 2009, 2010, 2011, 2012, 2013, 2014 Free Software Foundation, Inc.
@quotation @quotation
Permission is granted to copy, distribute and/or modify this document Permission is granted to copy, distribute and/or modify this document
@@ -304,7 +304,7 @@ Using Implicit Rules
* Using Implicit:: How to use an existing implicit rule * Using Implicit:: How to use an existing implicit rule
to get the recipes for updating a file. to get the recipes for updating a file.
* Catalogue of Rules:: A list of built-in implicit rules. * Catalogue of Rules:: A list of built-in rules.
* Implicit Variables:: How to change what predefined rules do. * Implicit Variables:: How to change what predefined rules do.
* Chained Rules:: How to use a chain of implicit rules. * Chained Rules:: How to use a chain of implicit rules.
* Pattern Rules:: How to define new implicit rules. * Pattern Rules:: How to define new implicit rules.
@@ -1528,7 +1528,7 @@ A rule is always expanded the same way, regardless of the form:
@example @example
@var{immediate} : @var{immediate} ; @var{deferred} @var{immediate} : @var{immediate} ; @var{deferred}
@var{deferred} @var{deferred}
@end example @end example
That is, the target and prerequisite sections are expanded immediately, That is, the target and prerequisite sections are expanded immediately,
@@ -2584,30 +2584,14 @@ will be executed every time you say @samp{make clean}.
@cindex @code{rm} (shell command) @cindex @code{rm} (shell command)
@findex .PHONY @findex .PHONY
The phony target will cease to work if anything ever does create a file In this example, the @file{clean} target will not work properly if a
named @file{clean} in this directory. Since it has no prerequisites, the file named @file{clean} is ever created in this directory. Since it
file @file{clean} would inevitably be considered up to date, and its has no prerequisites, @file{clean} would always be considered up to
recipe would not be executed. To avoid this problem, you can explicitly date and its recipe would not be executed. To avoid this problem you
declare the target to be phony, using the special target @code{.PHONY} can explicitly declare the target to be phony by making it a
prerequisite of the special target @code{.PHONY}
(@pxref{Special Targets, ,Special Built-in Target Names}) as follows: (@pxref{Special Targets, ,Special Built-in Target Names}) as follows:
@example
.PHONY : clean
@end example
@noindent
Once this is done, @samp{make clean} will run the recipe regardless of
whether there is a file named @file{clean}.
Since it knows that phony targets do not name actual files that could be
remade from other files, @code{make} skips the implicit rule search for
phony targets (@pxref{Implicit Rules}). This is why declaring a target
phony is good for performance, even if you are not worried about the
actual file existing.
Thus, you first write the line that states that @code{clean} is a
phony target, then you write the rule, like this:
@example @example
@group @group
.PHONY: clean .PHONY: clean
@@ -2616,12 +2600,16 @@ clean:
@end group @end group
@end example @end example
Another example of the usefulness of phony targets is in conjunction @noindent
with recursive invocations of @code{make} (for more information, see Once this is done, @samp{make clean} will run the recipe regardless of
@ref{Recursion, ,Recursive Use of @code{make}}). In this case the whether there is a file named @file{clean}.
makefile will often contain a variable which lists a number of
sub-directories to be built. One way to handle this is with one rule Phony targets are also useful in conjunction with recursive
whose recipe is a shell loop over the sub-directories, like this: invocations of @code{make} (@pxref{Recursion, ,Recursive Use of @code{make}}).
In this situation the makefile will often contain a variable which
lists a number of sub-directories to be built. A simplistic way to
handle this is to define one rule with a recipe that loops over the
sub-directories, like this:
@example @example
@group @group
@@ -2644,9 +2632,9 @@ you cannot take advantage of @code{make}'s ability to build targets in
parallel (@pxref{Parallel, ,Parallel Execution}), since there is only parallel (@pxref{Parallel, ,Parallel Execution}), since there is only
one rule. one rule.
By declaring the sub-directories as phony targets (you must do this as By declaring the sub-directories as @code{.PHONY} targets (you must do
the sub-directory obviously always exists; otherwise it won't be built) this as the sub-directory obviously always exists; otherwise it won't
you can remove these problems: be built) you can remove these problems:
@example @example
@group @group
@@ -2668,6 +2656,11 @@ built until after the @file{baz} sub-directory is complete; this kind of
relationship declaration is particularly important when attempting relationship declaration is particularly important when attempting
parallel builds. parallel builds.
The implicit rule search (@pxref{Implicit Rules}) is skipped for
@code{.PHONY} targets. This is why declaring a target as
@code{.PHONY} is good for performance, even if you are not worried
about the actual file existing.
A phony target should not be a prerequisite of a real target file; if it A phony target should not be a prerequisite of a real target file; if it
is, its recipe will be run every time @code{make} goes to update that is, its recipe will be run every time @code{make} goes to update that
file. As long as a phony target is never a prerequisite of a real file. As long as a phony target is never a prerequisite of a real
@@ -5809,7 +5802,7 @@ CFLAGS += -pg # enable profiling
@noindent @noindent
The first line defines the @code{CFLAGS} variable with a reference to another The first line defines the @code{CFLAGS} variable with a reference to another
variable, @code{includes}. (@code{CFLAGS} is used by the rules for C variable, @code{includes}. (@code{CFLAGS} is used by the rules for C
compilation; @pxref{Catalogue of Rules, ,Catalogue of Implicit Rules}.) compilation; @pxref{Catalogue of Rules, ,Catalogue of Built-In Rules}.)
Using @samp{=} for the definition makes @code{CFLAGS} a recursively-expanded Using @samp{=} for the definition makes @code{CFLAGS} a recursively-expanded
variable, meaning @w{@samp{$(includes) -O}} is @emph{not} expanded when variable, meaning @w{@samp{$(includes) -O}} is @emph{not} expanded when
@code{make} processes the definition of @code{CFLAGS}. Thus, @code{includes} @code{make} processes the definition of @code{CFLAGS}. Thus, @code{includes}
@@ -6328,6 +6321,28 @@ will contain the number of times this instance has restarted. Note
this is not the same as recursion (counted by the @code{MAKELEVEL} this is not the same as recursion (counted by the @code{MAKELEVEL}
variable). You should not set, modify, or export this variable. variable). You should not set, modify, or export this variable.
@vindex MAKE_TERMOUT @r{(whether stdout is a terminal)}
@vindex MAKE_TERMERR @r{(whether stderr is a terminal)}
@item MAKE_TERMOUT
@itemx MAKE_TERMERR
When @code{make} starts it will check whether stdout and stderr will
show their output on a terminal. If so, it will set
@code{MAKE_TERMOUT} and @code{MAKE_TERMERR}, respectively, to the name
of the terminal device (or @code{true} if this cannot be determined).
If set these variables will be marked for export. These variables
will not be changed by @code{make} and they will not be modified if
already set.
These values can be used (particularly in combination with output
synchronization (@pxref{Parallel Output, ,Output During Parallel
Execution}) to determine whether @code{make} itself is writing to a
terminal; they can be tested to decide whether to force recipe
commands to generate colorized output for example.
If you invoke a sub-@code{make} and redirect its stdout or stderr it
is your responsibility to reset or unexport these variables as well,
if your makefiles rely on them.
@vindex .RECIPEPREFIX @r{(change the recipe prefix character)} @vindex .RECIPEPREFIX @r{(change the recipe prefix character)}
@item .RECIPEPREFIX @item .RECIPEPREFIX
The first character of the value of this variable is used as the The first character of the value of this variable is used as the
@@ -7516,7 +7531,7 @@ exist.
The syntax of the @code{file} function is: The syntax of the @code{file} function is:
@example @example
$(file @var{op} @var{filename},@var{text}) $(file @var{op} @var{filename}[,@var{text}])
@end example @end example
The operator @var{op} can be either @code{>} which indicates overwrite The operator @var{op} can be either @code{>} which indicates overwrite
@@ -7528,8 +7543,9 @@ When the @code{file} function is expanded all its arguments are
expanded first, then the file indicated by @var{filename} will be expanded first, then the file indicated by @var{filename} will be
opened in the mode described by @var{op}. Finally @var{text} will be opened in the mode described by @var{op}. Finally @var{text} will be
written to the file. If @var{text} does not already end in a newline, written to the file. If @var{text} does not already end in a newline,
a final newline will be written. The result of evaluating the even if empty, a final newline will be written. If the @var{text}
@code{file} function is always the empty string. argument is not given, nothing will be written. The result of
evaluating the @code{file} function is always the empty string.
It is a fatal error if the file cannot be opened for writing, or if It is a fatal error if the file cannot be opened for writing, or if
the write operation fails. the write operation fails.
@@ -7556,7 +7572,7 @@ input file, you might write your recipe like this:
@example @example
@group @group
program: $(OBJECTS) program: $(OBJECTS)
$(file >$@@.in,) $(foreach O,$^,$(file >>$@@.in,$O)) $(file >$@@.in) $(foreach O,$^,$(file >>$@@.in,$O))
$(CMD) $(CMDFLAGS) @@$@@.in $(CMD) $(CMDFLAGS) @@$@@.in
@@rm $@@.in @@rm $@@.in
@end group @end group
@@ -8934,7 +8950,7 @@ retained for compatibility.
@menu @menu
* Using Implicit:: How to use an existing implicit rule * Using Implicit:: How to use an existing implicit rule
to get the recipes for updating a file. to get the recipes for updating a file.
* Catalogue of Rules:: A list of built-in implicit rules. * Catalogue of Rules:: A list of built-in rules.
* Implicit Variables:: How to change what predefined rules do. * Implicit Variables:: How to change what predefined rules do.
* Chained Rules:: How to use a chain of implicit rules. * Chained Rules:: How to use a chain of implicit rules.
* Pattern Rules:: How to define new implicit rules. * Pattern Rules:: How to define new implicit rules.
@@ -8986,7 +9002,7 @@ compiler; and so on.
Of course, when you write the makefile, you know which implicit rule you Of course, when you write the makefile, you know which implicit rule you
want @code{make} to use, and you know it will choose that one because you want @code{make} to use, and you know it will choose that one because you
know which possible prerequisite files are supposed to exist. know which possible prerequisite files are supposed to exist.
@xref{Catalogue of Rules, ,Catalogue of Implicit Rules}, @xref{Catalogue of Rules, ,Catalogue of Built-In Rules},
for a catalogue of all the predefined implicit rules. for a catalogue of all the predefined implicit rules.
Above, we said an implicit rule applies if the required prerequisites ``exist Above, we said an implicit rule applies if the required prerequisites ``exist
@@ -9016,7 +9032,7 @@ make an object file, a @file{.o} file, from a Pascal source file, a
@file{.p} file. For example, if @file{foo.c} also exists, the implicit @file{.p} file. For example, if @file{foo.c} also exists, the implicit
rule to make an object file from a C source file is used instead, rule to make an object file from a C source file is used instead,
because it appears before the Pascal rule in the list of predefined because it appears before the Pascal rule in the list of predefined
implicit rules (@pxref{Catalogue of Rules, , Catalogue of Implicit implicit rules (@pxref{Catalogue of Rules, , Catalogue of Built-In
Rules}). Rules}).
If you do not want an implicit rule to be used for a target that has no If you do not want an implicit rule to be used for a target that has no
@@ -9024,7 +9040,7 @@ recipe, you can give that target an empty recipe by writing a semicolon
(@pxref{Empty Recipes, ,Defining Empty Recipes}). (@pxref{Empty Recipes, ,Defining Empty Recipes}).
@node Catalogue of Rules, Implicit Variables, Using Implicit, Implicit Rules @node Catalogue of Rules, Implicit Variables, Using Implicit, Implicit Rules
@section Catalogue of Implicit Rules @section Catalogue of Built-In Rules
@cindex implicit rule, predefined @cindex implicit rule, predefined
@cindex rule, implicit, predefined @cindex rule, implicit, predefined
@@ -11572,7 +11588,7 @@ functionality in that it will check out SCCS files for makefiles.
@item @item
Various new built-in implicit rules. Various new built-in implicit rules.
@xref{Catalogue of Rules, ,Catalogue of Implicit Rules}. @xref{Catalogue of Rules, ,Catalogue of Built-In Rules}.
@item @item
Load dynamic objects which can modify the behavior of @code{make}. Load dynamic objects which can modify the behavior of @code{make}.
@@ -11695,7 +11711,7 @@ special treatment.
This appendix summarizes the directives, text manipulation functions, This appendix summarizes the directives, text manipulation functions,
and special variables which GNU @code{make} understands. and special variables which GNU @code{make} understands.
@xref{Special Targets}, @ref{Catalogue of Rules, ,Catalogue of Implicit Rules}, @xref{Special Targets}, @ref{Catalogue of Rules, ,Catalogue of Built-In Rules},
and @ref{Options Summary, ,Summary of Options}, and @ref{Options Summary, ,Summary of Options},
for other summaries. for other summaries.

View File

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

View File

@@ -1,5 +1,5 @@
/* Variable expansion functions for GNU Make. /* Variable expansion functions for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -121,9 +121,9 @@ recursively_expand_for_file (struct variable *v, struct file *file)
{ {
if (!v->exp_count) if (!v->exp_count)
/* Expanding V causes infinite recursion. Lose. */ /* Expanding V causes infinite recursion. Lose. */
fatal (*expanding_var, OS (fatal, *expanding_var,
_("Recursive variable '%s' references itself (eventually)"), _("Recursive variable '%s' references itself (eventually)"),
v->name); v->name);
--v->exp_count; --v->exp_count;
} }
@@ -266,7 +266,7 @@ variable_expand_string (char *line, const char *string, long length)
end = strchr (beg, closeparen); end = strchr (beg, closeparen);
if (end == 0) if (end == 0)
/* Unterminated variable reference. */ /* Unterminated variable reference. */
fatal (*expanding_var, _("unterminated variable reference")); O (fatal, *expanding_var, _("unterminated variable reference"));
p1 = lindex (beg, end, '$'); p1 = lindex (beg, end, '$');
if (p1 != 0) if (p1 != 0)
{ {
@@ -377,7 +377,6 @@ variable_expand_string (char *line, const char *string, long length)
Look up the value of the variable. */ Look up the value of the variable. */
o = reference_variable (o, beg, end - beg); o = reference_variable (o, beg, end - beg);
if (abeg)
free (abeg); free (abeg);
} }
break; break;
@@ -447,8 +446,7 @@ expand_argument (const char *str, const char *end)
r = allocated_variable_expand (tmp); r = allocated_variable_expand (tmp);
if (alloc) free (alloc);
free (alloc);
return r; return r;
} }

35
file.c
View File

@@ -1,5 +1,5 @@
/* Target file management for GNU Make. /* Target file management for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -261,22 +261,25 @@ rehash_file (struct file *from_file, const char *to_hname)
to_file->cmds = from_file->cmds; to_file->cmds = from_file->cmds;
else if (from_file->cmds != to_file->cmds) else if (from_file->cmds != to_file->cmds)
{ {
size_t l = strlen (from_file->name);
/* We have two sets of commands. We will go with the /* We have two sets of commands. We will go with the
one given in the rule explicitly mentioning this name, one given in the rule explicitly mentioning this name,
but give a message to let the user know what's going on. */ but give a message to let the user know what's going on. */
if (to_file->cmds->fileinfo.filenm != 0) if (to_file->cmds->fileinfo.filenm != 0)
error (&from_file->cmds->fileinfo, error (&from_file->cmds->fileinfo,
l + strlen (to_file->cmds->fileinfo.filenm) + INTSTR_LENGTH,
_("Recipe was specified for file '%s' at %s:%lu,"), _("Recipe was specified for file '%s' at %s:%lu,"),
from_file->name, to_file->cmds->fileinfo.filenm, from_file->name, to_file->cmds->fileinfo.filenm,
to_file->cmds->fileinfo.lineno); to_file->cmds->fileinfo.lineno);
else else
error (&from_file->cmds->fileinfo, error (&from_file->cmds->fileinfo, l,
_("Recipe for file '%s' was found by implicit rule search,"), _("Recipe for file '%s' was found by implicit rule search,"),
from_file->name); from_file->name);
error (&from_file->cmds->fileinfo, l += strlen (to_hname);
error (&from_file->cmds->fileinfo, l,
_("but '%s' is now considered the same file as '%s'."), _("but '%s' is now considered the same file as '%s'."),
from_file->name, to_hname); from_file->name, to_hname);
error (&from_file->cmds->fileinfo, error (&from_file->cmds->fileinfo, l,
_("Recipe for '%s' will be ignored in favor of the one for '%s'."), _("Recipe for '%s' will be ignored in favor of the one for '%s'."),
to_hname, from_file->name); to_hname, from_file->name);
} }
@@ -297,13 +300,14 @@ rehash_file (struct file *from_file, const char *to_hname)
merge_variable_set_lists (&to_file->variables, from_file->variables); merge_variable_set_lists (&to_file->variables, from_file->variables);
if (to_file->double_colon && from_file->is_target && !from_file->double_colon) if (to_file->double_colon && from_file->is_target && !from_file->double_colon)
fatal (NILF, _("can't rename single-colon '%s' to double-colon '%s'"), OSS (fatal, NILF, _("can't rename single-colon '%s' to double-colon '%s'"),
from_file->name, to_hname); from_file->name, to_hname);
if (!to_file->double_colon && from_file->double_colon) if (!to_file->double_colon && from_file->double_colon)
{ {
if (to_file->is_target) if (to_file->is_target)
fatal (NILF, _("can't rename double-colon '%s' to single-colon '%s'"), OSS (fatal, NILF,
from_file->name, to_hname); _("can't rename double-colon '%s' to single-colon '%s'"),
from_file->name, to_hname);
else else
to_file->double_colon = from_file->double_colon; to_file->double_colon = from_file->double_colon;
} }
@@ -393,7 +397,8 @@ remove_intermediates (int sig)
if (!f->dontcare) if (!f->dontcare)
{ {
if (sig) if (sig)
error (NILF, _("*** Deleting intermediate file '%s'"), f->name); OS (error, NILF,
_("*** Deleting intermediate file '%s'"), f->name);
else else
{ {
if (! doneany) if (! doneany)
@@ -803,10 +808,11 @@ file_timestamp_cons (const char *fname, time_t stamp, long int ns)
&& product <= ts && ts <= ORDINARY_MTIME_MAX)) && product <= ts && ts <= ORDINARY_MTIME_MAX))
{ {
char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1]; char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
const char *f = fname ? fname : _("Current time");
ts = s <= OLD_MTIME ? ORDINARY_MTIME_MIN : ORDINARY_MTIME_MAX; ts = s <= OLD_MTIME ? ORDINARY_MTIME_MIN : ORDINARY_MTIME_MAX;
file_timestamp_sprintf (buf, ts); file_timestamp_sprintf (buf, ts);
error (NILF, _("%s: Timestamp out of range; substituting %s"), OSS (error, NILF,
fname ? fname : _("Current time"), buf); _("%s: Timestamp out of range; substituting %s"), f, buf);
} }
return ts; return ts;
@@ -1046,9 +1052,10 @@ print_file_data_base (void)
/* Verify the integrity of the data base of files. */ /* Verify the integrity of the data base of files. */
#define VERIFY_CACHED(_p,_n) \ #define VERIFY_CACHED(_p,_n) \
do{\ do{ \
if (_p->_n && _p->_n[0] && !strcache_iscached (_p->_n)) \ if (_p->_n && _p->_n[0] && !strcache_iscached (_p->_n)) \
error (NULL, _("%s: Field '%s' not cached: %s"), _p->name, # _n, _p->_n); \ error (NULL, strlen (_p->name) + CSTRLEN (# _n) + strlen (_p->_n), \
_("%s: Field '%s' not cached: %s"), _p->name, # _n, _p->_n); \
}while(0) }while(0)
static void static void

View File

@@ -1,5 +1,5 @@
/* Definition of target file data structures for GNU Make. /* Definition of target file data structures for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -143,7 +143,7 @@ void print_file_data_base (void);
& ((1 << FILE_TIMESTAMP_LO_BITS) - 1))) & ((1 << FILE_TIMESTAMP_LO_BITS) - 1)))
/* Upper bound on length of string "YYYY-MM-DD HH:MM:SS.NNNNNNNNN" /* Upper bound on length of string "YYYY-MM-DD HH:MM:SS.NNNNNNNNN"
representing a file timestamp. The upper bound is not necessarily 19, representing a file timestamp. The upper bound is not necessarily 29,
since the year might be less than -999 or greater than 9999. since the year might be less than -999 or greater than 9999.
Subtract one for the sign bit if in case file timestamps can be negative; Subtract one for the sign bit if in case file timestamps can be negative;

View File

@@ -1,5 +1,5 @@
/* Builtin function expansion for GNU Make. /* Builtin function expansion for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -519,8 +519,25 @@ func_notdir_suffix (char *o, char **argv, const char *funcname)
int is_suffix = funcname[0] == 's'; int is_suffix = funcname[0] == 's';
int is_notdir = !is_suffix; int is_notdir = !is_suffix;
int stop = MAP_PATHSEP | (is_suffix ? MAP_DOT : 0); int stop = MAP_DIRSEP | (is_suffix ? MAP_DOT : 0);
#ifdef VMS
/* For VMS list_iterator points to a comma separated list. To use the common
[find_]next_token, create a local copy and replace the commas with
spaces. Obviously, there is a problem if there is a ',' in the VMS filename
(can only happen on ODS5), the same problem as with spaces in filenames,
which seems to be present in make on all platforms. */
char *vms_list_iterator = alloca(strlen(list_iterator) + 1);
int i;
for (i = 0; list_iterator[i]; i++)
if (list_iterator[i] == ',')
vms_list_iterator[i] = ' ';
else
vms_list_iterator[i] = list_iterator[i];
vms_list_iterator[i] = list_iterator[i];
while ((p2 = find_next_token((const char**) &vms_list_iterator, &len)) != 0)
#else
while ((p2 = find_next_token (&list_iterator, &len)) != 0) while ((p2 = find_next_token (&list_iterator, &len)) != 0)
#endif
{ {
const char *p = p2 + len - 1; const char *p = p2 + len - 1;
@@ -548,7 +565,11 @@ func_notdir_suffix (char *o, char **argv, const char *funcname)
if (is_notdir || p >= p2) if (is_notdir || p >= p2)
{ {
#ifdef VMS
o = variable_buffer_output (o, ",", 1);
#else
o = variable_buffer_output (o, " ", 1); o = variable_buffer_output (o, " ", 1);
#endif
doneany = 1; doneany = 1;
} }
} }
@@ -572,8 +593,21 @@ func_basename_dir (char *o, char **argv, const char *funcname)
int is_basename = funcname[0] == 'b'; int is_basename = funcname[0] == 'b';
int is_dir = !is_basename; int is_dir = !is_basename;
int stop = MAP_PATHSEP | (is_basename ? MAP_DOT : 0) | MAP_NUL; int stop = MAP_DIRSEP | (is_basename ? MAP_DOT : 0) | MAP_NUL;
#ifdef VMS
/* As in func_notdir_suffix ... */
char *vms_p3 = alloca(strlen(p3) + 1);
int i;
for (i = 0; p3[i]; i++)
if (p3[i] == ',')
vms_p3[i] = ' ';
else
vms_p3[i] = p3[i];
vms_p3[i] = p3[i];
while ((p2 = find_next_token((const char**) &vms_p3, &len)) != 0)
#else
while ((p2 = find_next_token (&p3, &len)) != 0) while ((p2 = find_next_token (&p3, &len)) != 0)
#endif
{ {
const char *p = p2 + len - 1; const char *p = p2 + len - 1;
while (p >= p2 && ! STOP_SET (*p, stop)) while (p >= p2 && ! STOP_SET (*p, stop))
@@ -602,7 +636,11 @@ func_basename_dir (char *o, char **argv, const char *funcname)
/* The entire name is the basename. */ /* The entire name is the basename. */
o = variable_buffer_output (o, p2, len); o = variable_buffer_output (o, p2, len);
#ifdef VMS
o = variable_buffer_output (o, ",", 1);
#else
o = variable_buffer_output (o, " ", 1); o = variable_buffer_output (o, " ", 1);
#endif
doneany = 1; doneany = 1;
} }
@@ -726,7 +764,7 @@ check_numeric (const char *s, const char *msg)
break; break;
if (s <= end || end - beg < 0) if (s <= end || end - beg < 0)
fatal (*expanding_var, "%s: '%s'", msg, beg); OSS (fatal, *expanding_var, "%s: '%s'", msg, beg);
} }
@@ -743,8 +781,8 @@ func_word (char *o, char **argv, const char *funcname UNUSED)
i = atoi (argv[0]); i = atoi (argv[0]);
if (i == 0) if (i == 0)
fatal (*expanding_var, O (fatal, *expanding_var,
_("first argument to 'word' function must be greater than 0")); _("first argument to 'word' function must be greater than 0"));
end_p = argv[1]; end_p = argv[1];
while ((p = find_next_token (&end_p, 0)) != 0) while ((p = find_next_token (&end_p, 0)) != 0)
@@ -770,8 +808,8 @@ func_wordlist (char *o, char **argv, const char *funcname UNUSED)
start = atoi (argv[0]); start = atoi (argv[0]);
if (start < 1) if (start < 1)
fatal (*expanding_var, ON (fatal, *expanding_var,
"invalid first argument to 'wordlist' function: '%d'", start); "invalid first argument to 'wordlist' function: '%d'", start);
count = atoi (argv[1]) - start + 1; count = atoi (argv[1]) - start + 1;
@@ -1082,10 +1120,10 @@ func_error (char *o, char **argv, const char *funcname)
switch (*funcname) switch (*funcname)
{ {
case 'e': case 'e':
fatal (reading_file, "%s", msg); OS (fatal, reading_file, "%s", msg);
case 'w': case 'w':
error (reading_file, "%s", msg); OS (error, reading_file, "%s", msg);
break; break;
case 'i': case 'i':
@@ -1094,7 +1132,7 @@ func_error (char *o, char **argv, const char *funcname)
break; break;
default: default:
fatal (*expanding_var, "Internal error: func_error: '%s'", funcname); OS (fatal, *expanding_var, "Internal error: func_error: '%s'", funcname);
} }
/* The warning function expands to the empty string. */ /* The warning function expands to the empty string. */
@@ -1416,7 +1454,7 @@ int shell_function_pid = 0, shell_function_completed;
int int
windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp) windows32_openpipe (int *pipedes, int errfd, pid_t *pid_p, char **command_argv, char **envp)
{ {
SECURITY_ATTRIBUTES saAttr; SECURITY_ATTRIBUTES saAttr;
HANDLE hIn = INVALID_HANDLE_VALUE; HANDLE hIn = INVALID_HANDLE_VALUE;
@@ -1457,11 +1495,12 @@ windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp
} }
if (hIn == INVALID_HANDLE_VALUE) if (hIn == INVALID_HANDLE_VALUE)
{ {
error (NILF, _("windows32_openpipe: DuplicateHandle(In) failed (e=%ld)\n"), e); ON (error, NILF,
_("windows32_openpipe: DuplicateHandle(In) failed (e=%ld)\n"), e);
return -1; return -1;
} }
} }
tmpErr = GetStdHandle (STD_ERROR_HANDLE); tmpErr = (HANDLE)_get_osfhandle (errfd);
if (DuplicateHandle (GetCurrentProcess (), tmpErr, if (DuplicateHandle (GetCurrentProcess (), tmpErr,
GetCurrentProcess (), &hErr, GetCurrentProcess (), &hErr,
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE) 0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE)
@@ -1480,14 +1519,15 @@ windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp
} }
if (hErr == INVALID_HANDLE_VALUE) if (hErr == INVALID_HANDLE_VALUE)
{ {
error (NILF, _("windows32_openpipe: DuplicateHandle(Err) failed (e=%ld)\n"), e); ON (error, NILF,
_("windows32_openpipe: DuplicateHandle(Err) failed (e=%ld)\n"), e);
return -1; return -1;
} }
} }
if (! CreatePipe (&hChildOutRd, &hChildOutWr, &saAttr, 0)) if (! CreatePipe (&hChildOutRd, &hChildOutWr, &saAttr, 0))
{ {
error (NILF, _("CreatePipe() failed (e=%ld)\n"), GetLastError()); ON (error, NILF, _("CreatePipe() failed (e=%ld)\n"), GetLastError());
return -1; return -1;
} }
@@ -1495,7 +1535,7 @@ windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp
if (!hProcess) if (!hProcess)
{ {
error (NILF, _("windows32_openpipe(): process_init_fd() failed\n")); O (error, NILF, _("windows32_openpipe(): process_init_fd() failed\n"));
return -1; return -1;
} }
@@ -1608,7 +1648,7 @@ char *
func_shell_base (char *o, char **argv, int trim_newlines) func_shell_base (char *o, char **argv, int trim_newlines)
{ {
fprintf (stderr, "This platform does not support shell\n"); fprintf (stderr, "This platform does not support shell\n");
die (EXIT_FAILURE); die (MAKE_TROUBLE);
return NULL; return NULL;
} }
@@ -1689,7 +1729,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
return o; return o;
} }
#elif defined(WINDOWS32) #elif defined(WINDOWS32)
windows32_openpipe (pipedes, &pid, command_argv, envp); windows32_openpipe (pipedes, errfd, &pid, command_argv, envp);
/* Restore the value of just_print_flag. */ /* Restore the value of just_print_flag. */
just_print_flag = j_p_f; just_print_flag = j_p_f;
@@ -1950,7 +1990,7 @@ func_not (char *o, char **argv, char *funcname UNUSED)
#ifdef HAVE_DOS_PATHS #ifdef HAVE_DOS_PATHS
# ifdef __CYGWIN__ # ifdef __CYGWIN__
# define IS_ABSOLUTE(n) ((n[0] && n[1] == ':') || STOP_SET (n[0], MAP_PATHSEP)) # define IS_ABSOLUTE(n) ((n[0] && n[1] == ':') || STOP_SET (n[0], MAP_DIRSEP))
# else # else
# define IS_ABSOLUTE(n) (n[0] && n[1] == ':') # define IS_ABSOLUTE(n) (n[0] && n[1] == ':')
# endif # endif
@@ -1984,9 +2024,9 @@ abspath (const char *name, char *apath)
strcpy (apath, starting_directory); strcpy (apath, starting_directory);
#ifdef HAVE_DOS_PATHS #ifdef HAVE_DOS_PATHS
if (STOP_SET (name[0], MAP_PATHSEP)) if (STOP_SET (name[0], MAP_DIRSEP))
{ {
if (STOP_SET (name[1], MAP_PATHSEP)) if (STOP_SET (name[1], MAP_DIRSEP))
{ {
/* A UNC. Don't prepend a drive letter. */ /* A UNC. Don't prepend a drive letter. */
apath[0] = name[0]; apath[0] = name[0];
@@ -2006,8 +2046,8 @@ abspath (const char *name, char *apath)
else else
{ {
#if defined(__CYGWIN__) && defined(HAVE_DOS_PATHS) #if defined(__CYGWIN__) && defined(HAVE_DOS_PATHS)
if (STOP_SET (name[0], MAP_PATHSEP)) if (STOP_SET (name[0], MAP_DIRSEP))
root_len = 1; root_len = 1;
#endif #endif
strncpy (apath, name, root_len); strncpy (apath, name, root_len);
apath[root_len] = '\0'; apath[root_len] = '\0';
@@ -2015,7 +2055,7 @@ abspath (const char *name, char *apath)
/* Get past the root, since we already copied it. */ /* Get past the root, since we already copied it. */
name += root_len; name += root_len;
#ifdef HAVE_DOS_PATHS #ifdef HAVE_DOS_PATHS
if (! STOP_SET (apath[root_len - 1], MAP_PATHSEP)) if (! STOP_SET (apath[root_len - 1], MAP_DIRSEP))
{ {
/* Convert d:foo into d:./foo and increase root_len. */ /* Convert d:foo into d:./foo and increase root_len. */
apath[2] = '.'; apath[2] = '.';
@@ -2035,11 +2075,11 @@ abspath (const char *name, char *apath)
unsigned long len; unsigned long len;
/* Skip sequence of multiple path-separators. */ /* Skip sequence of multiple path-separators. */
while (STOP_SET (*start, MAP_PATHSEP)) while (STOP_SET (*start, MAP_DIRSEP))
++start; ++start;
/* Find end of path component. */ /* Find end of path component. */
for (end = start; ! STOP_SET (*end, MAP_PATHSEP|MAP_NUL); ++end) for (end = start; ! STOP_SET (*end, MAP_DIRSEP|MAP_NUL); ++end)
; ;
len = end - start; len = end - start;
@@ -2052,12 +2092,12 @@ abspath (const char *name, char *apath)
{ {
/* Back up to previous component, ignore if at root already. */ /* Back up to previous component, ignore if at root already. */
if (dest > apath + root_len) if (dest > apath + root_len)
for (--dest; ! STOP_SET (dest[-1], MAP_PATHSEP); --dest) for (--dest; ! STOP_SET (dest[-1], MAP_DIRSEP); --dest)
; ;
} }
else else
{ {
if (! STOP_SET (dest[-1], MAP_PATHSEP)) if (! STOP_SET (dest[-1], MAP_DIRSEP))
*dest++ = '/'; *dest++ = '/';
if (dest + len >= apath_limit) if (dest + len >= apath_limit)
@@ -2070,7 +2110,7 @@ abspath (const char *name, char *apath)
} }
/* Unless it is root strip trailing separator. */ /* Unless it is root strip trailing separator. */
if (dest > apath + root_len && STOP_SET (dest[-1], MAP_PATHSEP)) if (dest > apath + root_len && STOP_SET (dest[-1], MAP_DIRSEP))
--dest; --dest;
*dest = '\0'; *dest = '\0';
@@ -2148,20 +2188,25 @@ func_file (char *o, char **argv, const char *funcname UNUSED)
fp = fopen (fn, mode); fp = fopen (fn, mode);
if (fp == NULL) if (fp == NULL)
fatal (reading_file, _("open: %s: %s"), fn, strerror (errno)); {
else const char *err = strerror (errno);
OSS (fatal, reading_file, _("open: %s: %s"), fn, err);
}
if (argv[1])
{ {
int l = strlen (argv[1]); int l = strlen (argv[1]);
int nl = (l == 0 || argv[1][l-1] != '\n'); int nl = l == 0 || argv[1][l-1] != '\n';
if (fputs (argv[1], fp) == EOF || (nl && fputc ('\n', fp) == EOF)) if (fputs (argv[1], fp) == EOF || (nl && fputc ('\n', fp) == EOF))
fatal (reading_file, _("write: %s: %s"), fn, strerror (errno)); {
const char *err = strerror (errno);
fclose (fp); OSS (fatal, reading_file, _("write: %s: %s"), fn, err);
}
} }
fclose (fp);
} }
else else
fatal (reading_file, _("Invalid file operation: %s"), fn); OS (fatal, reading_file, _("Invalid file operation: %s"), fn);
return o; return o;
} }
@@ -2275,7 +2320,7 @@ expand_builtin_function (char *o, int argc, char **argv,
char *p; char *p;
if (argc < (int)entry_p->minimum_args) if (argc < (int)entry_p->minimum_args)
fatal (*expanding_var, fatal (*expanding_var, strlen (entry_p->name),
_("insufficient number of arguments (%d) to function '%s'"), _("insufficient number of arguments (%d) to function '%s'"),
argc, entry_p->name); argc, entry_p->name);
@@ -2287,8 +2332,8 @@ expand_builtin_function (char *o, int argc, char **argv,
return o; return o;
if (!entry_p->fptr.func_ptr) if (!entry_p->fptr.func_ptr)
fatal (*expanding_var, OS (fatal, *expanding_var,
_("unimplemented on this platform: function '%s'"), entry_p->name); _("unimplemented on this platform: function '%s'"), entry_p->name);
if (!entry_p->alloc_fn) if (!entry_p->alloc_fn)
return entry_p->fptr.func_ptr (o, argv, entry_p->name); return entry_p->fptr.func_ptr (o, argv, entry_p->name);
@@ -2350,7 +2395,7 @@ handle_function (char **op, const char **stringp)
break; break;
if (count >= 0) if (count >= 0)
fatal (*expanding_var, fatal (*expanding_var, strlen (entry_p->name),
_("unterminated call to function '%s': missing '%c'"), _("unterminated call to function '%s': missing '%c'"),
entry_p->name, closeparen); entry_p->name, closeparen);
@@ -2418,7 +2463,7 @@ handle_function (char **op, const char **stringp)
if (entry_p->expand_args) if (entry_p->expand_args)
for (argvp=argv; *argvp != 0; ++argvp) for (argvp=argv; *argvp != 0; ++argvp)
free (*argvp); free (*argvp);
else if (abeg) else
free (abeg); free (abeg);
return 1; return 1;
@@ -2543,17 +2588,17 @@ define_new_function (const gmk_floc *flocp, const char *name,
len = e - name; len = e - name;
if (len == 0) if (len == 0)
fatal (flocp, _("Empty function name\n")); O (fatal, flocp, _("Empty function name"));
if (*name == '.' || *e != '\0') if (*name == '.' || *e != '\0')
fatal (flocp, _("Invalid function name: %s\n"), name); OS (fatal, flocp, _("Invalid function name: %s"), name);
if (len > 255) if (len > 255)
fatal (flocp, _("Function name too long: %s\n"), name); OS (fatal, flocp, _("Function name too long: %s"), name);
if (min > 255) if (min > 255)
fatal (flocp, _("Invalid minimum argument count (%d) for function %s\n"), ONS (fatal, flocp,
min, name); _("Invalid minimum argument count (%d) for function %s"), min, name);
if (max > 255 || (max && max < min)) if (max > 255 || (max && max < min))
fatal (flocp, _("Invalid maximum argument count (%d) for function %s\n"), ONS (fatal, flocp,
max, name); _("Invalid maximum argument count (%d) for function %s"), max, name);
ent = xmalloc (sizeof (struct function_table_entry)); ent = xmalloc (sizeof (struct function_table_entry));
ent->name = name; ent->name = name;

View File

@@ -1,5 +1,5 @@
/* Get the system load averages. /* Get the system load averages.
Copyright (C) 1985-2013 Free Software Foundation, Inc. Copyright (C) 1985-2014 Free Software Foundation, Inc.
GNU Make is free software; you can redistribute it and/or modify it under the 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 terms of the GNU General Public License as published by the Free Software

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,3 +1,9 @@
2013-10-20 Paul Smith <psmith@gnu.org>
* glob.c (glob): Cherry-pick a471e96a5352a5f0bde6d32dd36d33524811a2b1
from git://sourceware.org/git/glibc.git to fix SV 18123,
https://sourceware.org/bugzilla/show_bug.cgi?id=10278
2008-09-28 Juan Manuel Guerrero <juan.guerrero@gmx.de> 2008-09-28 Juan Manuel Guerrero <juan.guerrero@gmx.de>
* glob.c (my_realloc) [__DJGPP__]: Don't define, and don't * glob.c (my_realloc) [__DJGPP__]: Don't define, and don't

View File

@@ -377,6 +377,11 @@ glob (pattern, flags, errfunc, pglob)
return -1; return -1;
} }
/* POSIX requires all slashes to be matched. This means that with
a trailing slash we must match only directories. */
if (pattern[0] && pattern[strlen (pattern) - 1] == '/')
flags |= GLOB_ONLYDIR;
if (flags & GLOB_BRACE) if (flags & GLOB_BRACE)
{ {
const char *begin = strchr (pattern, '{'); const char *begin = strchr (pattern, '{');

View File

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

View File

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

15
guile.c
View File

@@ -1,5 +1,5 @@
/* GNU Guile interface for GNU Make. /* GNU Guile interface for GNU Make.
Copyright (C) 2011-2013 Free Software Foundation, Inc. Copyright (C) 2011-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -15,6 +15,9 @@ You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>. */ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "makeint.h" #include "makeint.h"
#ifdef HAVE_GUILE
#include "gnumake.h" #include "gnumake.h"
#include "debug.h" #include "debug.h"
@@ -144,3 +147,13 @@ guile_gmake_setup (const gmk_floc *flocp UNUSED)
return 1; return 1;
} }
#else
int
guile_gmake_setup (const gmk_floc *flocp UNUSED)
{
return 1;
}
#endif

2
hash.c
View File

@@ -48,7 +48,7 @@ hash_init (struct hash_table *ht, unsigned long size,
{ {
fprintf (stderr, _("can't allocate %lu bytes for hash table: memory exhausted"), fprintf (stderr, _("can't allocate %lu bytes for hash table: memory exhausted"),
ht->ht_size * (unsigned long) sizeof (struct token *)); ht->ht_size * (unsigned long) sizeof (struct token *));
exit (1); exit (MAKE_TROUBLE);
} }
ht->ht_capacity = ht->ht_size - (ht->ht_size / 16); /* 93.75% loading factor */ ht->ht_capacity = ht->ht_size - (ht->ht_size / 16); /* 93.75% loading factor */

View File

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

383
job.c
View File

@@ -1,5 +1,5 @@
/* Job execution and handling for GNU Make. /* Job execution and handling for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -31,14 +31,14 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef WINDOWS32 #ifdef WINDOWS32
#include <windows.h> #include <windows.h>
char *default_shell = "sh.exe"; const char *default_shell = "sh.exe";
int no_default_sh_exe = 1; int no_default_sh_exe = 1;
int batch_mode_shell = 1; int batch_mode_shell = 1;
HANDLE main_thread; HANDLE main_thread;
#elif defined (_AMIGA) #elif defined (_AMIGA)
char default_shell[] = ""; const char *default_shell = "";
extern int MyExecute (char **); extern int MyExecute (char **);
int batch_mode_shell = 0; int batch_mode_shell = 0;
@@ -48,28 +48,28 @@ int batch_mode_shell = 0;
says so. It is without an explicit path so we get a chance says so. It is without an explicit path so we get a chance
to search the $PATH for it (since MSDOS doesn't have standard to search the $PATH for it (since MSDOS doesn't have standard
directories we could trust). */ directories we could trust). */
char *default_shell = "command.com"; const char *default_shell = "command.com";
int batch_mode_shell = 0; int batch_mode_shell = 0;
#elif defined (__EMX__) #elif defined (__EMX__)
char *default_shell = "/bin/sh"; const char *default_shell = "/bin/sh";
int batch_mode_shell = 0; int batch_mode_shell = 0;
#elif defined (VMS) #elif defined (VMS)
# include <descrip.h> # include <descrip.h>
char default_shell[] = ""; const char *default_shell = "";
int batch_mode_shell = 0; int batch_mode_shell = 0;
#elif defined (__riscos__) #elif defined (__riscos__)
char default_shell[] = ""; const char *default_shell = "";
int batch_mode_shell = 0; int batch_mode_shell = 0;
#else #else
char default_shell[] = "/bin/sh"; const char *default_shell = "/bin/sh";
int batch_mode_shell = 0; int batch_mode_shell = 0;
#endif #endif
@@ -359,7 +359,7 @@ create_batch_file (char const *base, int unixy, int *fd)
*fd = -1; *fd = -1;
if (error_string == NULL) if (error_string == NULL)
error_string = _("Cannot create a temporary file\n"); error_string = _("Cannot create a temporary file\n");
fatal (NILF, error_string); O (fatal, NILF, error_string);
/* not reached */ /* not reached */
return NULL; return NULL;
@@ -474,6 +474,7 @@ child_error (struct child *child,
const struct file *f = child->file; const struct file *f = child->file;
const gmk_floc *flocp = &f->cmds->fileinfo; const gmk_floc *flocp = &f->cmds->fileinfo;
const char *nm; const char *nm;
size_t l = strlen (f->name);
if (ignored && silent_flag) if (ignored && silent_flag)
return; return;
@@ -498,7 +499,10 @@ child_error (struct child *child,
OUTPUT_SET (&child->output); OUTPUT_SET (&child->output);
message (0, _("%s: recipe for target '%s' failed"), nm, f->name); message (0, l + strlen (nm),
_("%s: recipe for target '%s' failed"), nm, f->name);
l += strlen (pre) + strlen (post);
#ifdef VMS #ifdef VMS
if ((exit_code & 1) != 0) if ((exit_code & 1) != 0)
@@ -506,15 +510,23 @@ child_error (struct child *child,
OUTPUT_UNSET (); OUTPUT_UNSET ();
return; return;
} }
/* Check for a Posix compatible VMS style exit code:
error (NILF, _("%s[%s] Error 0x%x%s"), pre, f->name, exit_code, post); decode and print the Posix exit code */
if ((exit_code & 0x35a000) == 0x35a000)
error(NILF, l + INTSTR_LENGTH, _("%s[%s] Error %d%s"), pre, f->name,
((exit_code & 0x7f8) >> 3), post);
else
error(NILF, l + INTSTR_LENGTH, _("%s[%s] Error 0x%x%s"), pre, f->name,
exit_code, post);
#else #else
if (exit_sig == 0) if (exit_sig == 0)
error (NILF, _("%s[%s] Error %d%s"), pre, f->name, exit_code, post); error (NILF, l + INTSTR_LENGTH,
_("%s[%s] Error %d%s"), pre, f->name, exit_code, post);
else else
{ {
const char *s = strsignal (exit_sig); const char *s = strsignal (exit_sig);
error (NILF, _("%s[%s] %s%s%s"), pre, f->name, s, dump, post); error (NILF, l + strlen (s) + strlen (dump),
_("%s[%s] %s%s%s"), pre, f->name, s, dump, post);
} }
#endif /* VMS */ #endif /* VMS */
@@ -606,7 +618,7 @@ reap_children (int block, int err)
Only print this message once no matter how many jobs are left. */ Only print this message once no matter how many jobs are left. */
fflush (stdout); fflush (stdout);
if (!printed) if (!printed)
error (NILF, _("*** Waiting for unfinished jobs....")); O (error, NILF, _("*** Waiting for unfinished jobs...."));
printed = 1; printed = 1;
} }
@@ -975,7 +987,7 @@ reap_children (int block, int err)
if (!err && child_failed && !dontcare && !keep_going_flag && if (!err && child_failed && !dontcare && !keep_going_flag &&
/* fatal_error_signal will die with the right signal. */ /* fatal_error_signal will die with the right signal. */
!handling_fatal_signal) !handling_fatal_signal)
die (2); die (MAKE_FAILURE);
/* Only block for one child. */ /* Only block for one child. */
block = 0; block = 0;
@@ -992,8 +1004,8 @@ free_child (struct child *child)
output_close (&child->output); output_close (&child->output);
if (!jobserver_tokens) if (!jobserver_tokens)
fatal (NILF, "INTERNAL: Freeing child %p (%s) but no tokens left!\n", ONS (fatal, NILF, "INTERNAL: Freeing child %p (%s) but no tokens left!\n",
child, child->file->name); child, child->file->name);
/* If we're using the jobserver and this child is not the only outstanding /* If we're using the jobserver and this child is not the only outstanding
job, put a token back into the pipe for it. */ job, put a token back into the pipe for it. */
@@ -1004,8 +1016,9 @@ free_child (struct child *child)
if (! release_jobserver_semaphore ()) if (! release_jobserver_semaphore ())
{ {
DWORD err = GetLastError (); DWORD err = GetLastError ();
fatal (NILF, _("release jobserver semaphore: (Error %ld: %s)"), const char *estr = map_windows32_error_to_string (err);
err, map_windows32_error_to_string (err)); ONS (fatal, NILF,
_("release jobserver semaphore: (Error %ld: %s)"), err, estr);
} }
DB (DB_JOBS, (_("Released token for child %p (%s).\n"), child, child->file->name)); DB (DB_JOBS, (_("Released token for child %p (%s).\n"), child, child->file->name));
@@ -1108,10 +1121,20 @@ set_child_handler_action_flags (int set_handler, int set_alarm)
/* If we're about to enter the read(), set an alarm to wake up in a /* If we're about to enter the read(), set an alarm to wake up in a
second so we can check if the load has dropped and we can start more second so we can check if the load has dropped and we can start more
work. On the way out, turn off the alarm and set SIG_DFL. */ work. On the way out, turn off the alarm and set SIG_DFL. */
alarm (set_handler ? 1 : 0); if (set_handler)
sa.sa_handler = set_handler ? job_noop : SIG_DFL; {
sa.sa_flags = 0; sa.sa_handler = job_noop;
sigaction (SIGALRM, &sa, NULL); sa.sa_flags = 0;
sigaction (SIGALRM, &sa, NULL);
alarm (1);
}
else
{
alarm (0);
sa.sa_handler = SIG_DFL;
sa.sa_flags = 0;
sigaction (SIGALRM, &sa, NULL);
}
} }
#endif #endif
} }
@@ -1137,6 +1160,8 @@ start_job_command (struct child *child)
char *argv; char *argv;
#else #else
char **argv; char **argv;
int outfd = FD_STDOUT;
int errfd = FD_STDERR;
#endif #endif
/* If we have a completely empty commandset, stop now. */ /* If we have a completely empty commandset, stop now. */
@@ -1194,6 +1219,30 @@ start_job_command (struct child *child)
char *end = 0; char *end = 0;
#ifdef VMS #ifdef VMS
argv = p; argv = p;
/* Although construct_command_argv contains some code for VMS, it was/is
not called/used. Please note, for VMS argv is a string (not an array
of strings) which contains the complete command line, which for
multi-line variables still includes the newlines. So detect newlines
and set 'end' (which is used for child->command_ptr) instead of
(re-)writing construct_command_argv */
if (!one_shell)
{
char *s = p;
int instring = 0;
while (*s)
{
if (*s == '"')
instring = !instring;
else if (*s == '\\' && !instring && *(s+1) != 0)
s++;
else if (*s == '\n' && !instring)
{
end = s;
break;
}
++s;
}
}
#else #else
argv = construct_command_argv (p, &end, child->file, argv = construct_command_argv (p, &end, child->file,
child->file->cmds->lines_flags[child->command_line - 1], child->file->cmds->lines_flags[child->command_line - 1],
@@ -1277,7 +1326,7 @@ start_job_command (struct child *child)
/* Print the command if appropriate. */ /* Print the command if appropriate. */
if (just_print_flag || trace_flag if (just_print_flag || trace_flag
|| (!(flags & COMMANDS_SILENT) && !silent_flag)) || (!(flags & COMMANDS_SILENT) && !silent_flag))
message (0, "%s", p); OS (message, 0, "%s", p);
/* Tell update_goal_chain that a command has been started on behalf of /* Tell update_goal_chain that a command has been started on behalf of
this target. It is important that this happens here and not in this target. It is important that this happens here and not in
@@ -1426,6 +1475,16 @@ start_job_command (struct child *child)
parent_environ = environ; parent_environ = environ;
#ifndef NO_OUTPUT_SYNC
/* Divert child output if output_sync in use. */
if (child->output.syncout)
{
if (child->output.out >= 0)
outfd = child->output.out;
if (child->output.err >= 0)
errfd = child->output.err;
}
#endif
# ifdef __EMX__ # ifdef __EMX__
/* If we aren't running a recursive command and we have a jobserver /* If we aren't running a recursive command and we have a jobserver
pipe, close it before exec'ing. */ pipe, close it before exec'ing. */
@@ -1439,7 +1498,7 @@ start_job_command (struct child *child)
/* Never use fork()/exec() here! Use spawn() instead in exec_command() */ /* Never use fork()/exec() here! Use spawn() instead in exec_command() */
child->pid = child_execute_job (child->good_stdin ? FD_STDIN : bad_stdin, child->pid = child_execute_job (child->good_stdin ? FD_STDIN : bad_stdin,
FD_STDOUT, FD_STDERR, outfd, errfd,
argv, child->environment); argv, child->environment);
if (child->pid < 0) if (child->pid < 0)
{ {
@@ -1464,9 +1523,6 @@ start_job_command (struct child *child)
environ = parent_environ; /* Restore value child may have clobbered. */ environ = parent_environ; /* Restore value child may have clobbered. */
if (child->pid == 0) if (child->pid == 0)
{ {
int outfd = FD_STDOUT;
int errfd = FD_STDERR;
/* We are the child side. */ /* We are the child side. */
unblock_sigs (); unblock_sigs ();
@@ -1485,16 +1541,6 @@ start_job_command (struct child *child)
if (stack_limit.rlim_cur) if (stack_limit.rlim_cur)
setrlimit (RLIMIT_STACK, &stack_limit); setrlimit (RLIMIT_STACK, &stack_limit);
#endif #endif
/* Divert child output if output_sync in use. */
if (child->output.syncout)
{
if (child->output.out >= 0)
outfd = child->output.out;
if (child->output.err >= 0)
errfd = child->output.err;
}
child_execute_job (child->good_stdin ? FD_STDIN : bad_stdin, child_execute_job (child->good_stdin ? FD_STDIN : bad_stdin,
outfd, errfd, argv, child->environment); outfd, errfd, argv, child->environment);
} }
@@ -1593,14 +1639,18 @@ start_job_command (struct child *child)
sync_Path_environment (); sync_Path_environment ();
#ifndef NO_OUTPUT_SYNC #ifndef NO_OUTPUT_SYNC
/* Divert child output if output_sync in use. Don't capture /* Divert child output if output_sync in use. */
recursive make output unless we are synchronizing "make" mode. */ if (child->output.syncout)
if (child->output.syncout) {
hPID = process_easy (argv, child->environment, if (child->output.out >= 0)
child->output.out, child->output.err); outfd = child->output.out;
else if (child->output.err >= 0)
errfd = child->output.err;
}
#else
outfd = errfd = -1;
#endif #endif
hPID = process_easy (argv, child->environment, -1, -1); hPID = process_easy (argv, child->environment, outfd, errfd);
if (hPID != INVALID_HANDLE_VALUE) if (hPID != INVALID_HANDLE_VALUE)
child->pid = (pid_t) hPID; child->pid = (pid_t) hPID;
@@ -1940,7 +1990,7 @@ new_job (struct file *file)
/* There must be at least one child already, or we have no business /* There must be at least one child already, or we have no business
waiting for a token. */ waiting for a token. */
if (!children) if (!children)
fatal (NILF, "INTERNAL: no children as we go to sleep on read\n"); O (fatal, NILF, "INTERNAL: no children as we go to sleep on read\n");
#ifdef WINDOWS32 #ifdef WINDOWS32
/* On Windows we simply wait for the jobserver semaphore to become /* On Windows we simply wait for the jobserver semaphore to become
@@ -1950,8 +2000,10 @@ new_job (struct file *file)
if (got_token < 0) if (got_token < 0)
{ {
DWORD err = GetLastError (); DWORD err = GetLastError ();
fatal (NILF, _("semaphore or child process wait: (Error %ld: %s)"), const char *estr = map_windows32_error_to_string (err);
err, map_windows32_error_to_string (err)); ONS (fatal, NILF,
_("semaphore or child process wait: (Error %ld: %s)"),
err, estr);
} }
#else #else
/* Set interruptible system calls, and read() for a job token. */ /* Set interruptible system calls, and read() for a job token. */
@@ -2000,10 +2052,11 @@ new_job (struct file *file)
} }
if (newer[0] == '\0') if (newer[0] == '\0')
message (0, _("%s: target '%s' does not exist"), nm, c->file->name); OSS (message, 0,
_("%s: target '%s' does not exist"), nm, c->file->name);
else else
message (0, _("%s: update target '%s' due to: %s"), nm, OSSS (message, 0,
c->file->name, newer); _("%s: update target '%s' due to: %s"), nm, c->file->name, newer);
free (newer); free (newer);
} }
@@ -2114,8 +2167,8 @@ load_too_high (void)
{ {
if (errno == 0) if (errno == 0)
/* An errno value of zero means getloadavg is just unsupported. */ /* An errno value of zero means getloadavg is just unsupported. */
error (NILF, O (error, NILF,
_("cannot enforce load limits on this operating system")); _("cannot enforce load limits on this operating system"));
else else
perror_with_name (_("cannot enforce load limit: "), "getloadavg"); perror_with_name (_("cannot enforce load limit: "), "getloadavg");
} }
@@ -2196,7 +2249,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
{ {
save_stdin = dup (FD_STDIN); save_stdin = dup (FD_STDIN);
if (save_stdin < 0) if (save_stdin < 0)
fatal (NILF, _("no more file handles: could not duplicate stdin\n")); O (fatal, NILF, _("no more file handles: could not duplicate stdin\n"));
CLOSE_ON_EXEC (save_stdin); CLOSE_ON_EXEC (save_stdin);
dup2 (stdin_fd, FD_STDIN); dup2 (stdin_fd, FD_STDIN);
@@ -2207,7 +2260,8 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
{ {
save_stdout = dup (FD_STDOUT); save_stdout = dup (FD_STDOUT);
if (save_stdout < 0) if (save_stdout < 0)
fatal (NILF, _("no more file handles: could not duplicate stdout\n")); O (fatal, NILF,
_("no more file handles: could not duplicate stdout\n"));
CLOSE_ON_EXEC (save_stdout); CLOSE_ON_EXEC (save_stdout);
dup2 (stdout_fd, FD_STDOUT); dup2 (stdout_fd, FD_STDOUT);
@@ -2220,7 +2274,8 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
{ {
save_stderr = dup (FD_STDERR); save_stderr = dup (FD_STDERR);
if (save_stderr < 0) if (save_stderr < 0)
fatal (NILF, _("no more file handles: could not duplicate stderr\n")); O (fatal, NILF,
_("no more file handles: could not duplicate stderr\n"));
CLOSE_ON_EXEC (save_stderr); CLOSE_ON_EXEC (save_stderr);
} }
@@ -2235,7 +2290,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
if (save_stdin >= 0) if (save_stdin >= 0)
{ {
if (dup2 (save_stdin, FD_STDIN) != FD_STDIN) if (dup2 (save_stdin, FD_STDIN) != FD_STDIN)
fatal (NILF, _("Could not restore stdin\n")); O (fatal, NILF, _("Could not restore stdin\n"));
else else
close (save_stdin); close (save_stdin);
} }
@@ -2243,7 +2298,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
if (save_stdout >= 0) if (save_stdout >= 0)
{ {
if (dup2 (save_stdout, FD_STDOUT) != FD_STDOUT) if (dup2 (save_stdout, FD_STDOUT) != FD_STDOUT)
fatal (NILF, _("Could not restore stdout\n")); O (fatal, NILF, _("Could not restore stdout\n"));
else else
close (save_stdout); close (save_stdout);
} }
@@ -2251,7 +2306,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
if (save_stderr >= 0) if (save_stderr >= 0)
{ {
if (dup2 (save_stderr, FD_STDERR) != FD_STDERR) if (dup2 (save_stderr, FD_STDERR) != FD_STDERR)
fatal (NILF, _("Could not restore stderr\n")); O (fatal, NILF, _("Could not restore stderr\n"));
else else
close (save_stderr); close (save_stderr);
} }
@@ -2400,13 +2455,13 @@ exec_command (char **argv, char **envp)
switch (errno) switch (errno)
{ {
case ENOENT: case ENOENT:
error (NILF, _("%s: Command not found"), argv[0]); OS (error, NILF, _("%s: Command not found"), argv[0]);
break; break;
case ENOEXEC: case ENOEXEC:
{ {
/* The file is not executable. Try it as a shell script. */ /* The file is not executable. Try it as a shell script. */
extern char *getenv (); extern char *getenv ();
char *shell; const char *shell;
char **new_argv; char **new_argv;
int argc; int argc;
int i=1; int i=1;
@@ -2434,7 +2489,7 @@ exec_command (char **argv, char **envp)
# endif # endif
new_argv = alloca ((1 + argc + 1) * sizeof (char *)); new_argv = alloca ((1 + argc + 1) * sizeof (char *));
new_argv[0] = shell; new_argv[0] = (char *)shell;
# ifdef __EMX__ # ifdef __EMX__
if (!unixy_shell) if (!unixy_shell)
@@ -2460,7 +2515,7 @@ exec_command (char **argv, char **envp)
execvp (shell, new_argv); execvp (shell, new_argv);
# endif # endif
if (errno == ENOENT) if (errno == ENOENT)
error (NILF, _("%s: Shell program not found"), shell); OS (error, NILF, _("%s: Shell program not found"), shell);
else else
perror_with_name ("execvp: ", shell); perror_with_name ("execvp: ", shell);
break; break;
@@ -2469,7 +2524,7 @@ exec_command (char **argv, char **envp)
# ifdef __EMX__ # ifdef __EMX__
case EINVAL: case EINVAL:
/* this nasty error was driving me nuts :-( */ /* this nasty error was driving me nuts :-( */
error (NILF, _("spawnvpe: environment space might be exhausted")); O (error, NILF, _("spawnvpe: environment space might be exhausted"));
/* FALLTHROUGH */ /* FALLTHROUGH */
# endif # endif
@@ -2487,7 +2542,8 @@ exec_command (char **argv, char **envp)
#endif /* !VMS */ #endif /* !VMS */
} }
#else /* On Amiga */ #else /* On Amiga */
void exec_command (char **argv) void
exec_command (char **argv)
{ {
MyExecute (argv); MyExecute (argv);
} }
@@ -2504,7 +2560,7 @@ void clean_tmp (void)
avoid using a shell. This routine handles only ' quoting, and " quoting avoid using a shell. This routine handles only ' quoting, and " quoting
when no backslash, $ or ' characters are seen in the quotes. Starting when no backslash, $ or ' characters are seen in the quotes. Starting
quotes may be escaped with a backslash. If any of the characters in quotes may be escaped with a backslash. If any of the characters in
sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[] sh_chars is seen, or any of the builtin commands listed in sh_cmds
is the first word of a line, the shell is used. is the first word of a line, the shell is used.
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE. If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
@@ -2519,9 +2575,9 @@ void clean_tmp (void)
is overridden. */ is overridden. */
static char ** static char **
construct_command_argv_internal (char *line, char **restp, char *shell, construct_command_argv_internal (char *line, char **restp, const char *shell,
char *shellflags, char *ifs, int flags, const char *shellflags, const char *ifs,
char **batch_filename UNUSED) int flags, char **batch_filename UNUSED)
{ {
#ifdef __MSDOS__ #ifdef __MSDOS__
/* MSDOS supports both the stock DOS shell and ports of Unixy shells. /* MSDOS supports both the stock DOS shell and ports of Unixy shells.
@@ -2546,61 +2602,58 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
DOS_CHARS also include characters special to 4DOS/NDOS, so we DOS_CHARS also include characters special to 4DOS/NDOS, so we
won't have to tell one from another and have one more set of won't have to tell one from another and have one more set of
commands and special characters. */ commands and special characters. */
static char sh_chars_dos[] = "*?[];|<>%^&()"; static const char *sh_chars_dos = "*?[];|<>%^&()";
static char *sh_cmds_dos[] = { "break", "call", "cd", "chcp", "chdir", "cls", static const char *sh_cmds_dos[] =
"copy", "ctty", "date", "del", "dir", "echo", { "break", "call", "cd", "chcp", "chdir", "cls", "copy", "ctty", "date",
"erase", "exit", "for", "goto", "if", "md", "del", "dir", "echo", "erase", "exit", "for", "goto", "if", "md",
"mkdir", "path", "pause", "prompt", "rd", "mkdir", "path", "pause", "prompt", "rd", "rmdir", "rem", "ren",
"rmdir", "rem", "ren", "rename", "set", "rename", "set", "shift", "time", "type", "ver", "verify", "vol", ":",
"shift", "time", "type", "ver", "verify", 0 };
"vol", ":", 0 };
static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^"; static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^";
static char *sh_cmds_sh[] = { "cd", "echo", "eval", "exec", "exit", "login", static const char *sh_cmds_sh[] =
"logout", "set", "umask", "wait", "while", { "cd", "echo", "eval", "exec", "exit", "login", "logout", "set", "umask",
"for", "case", "if", ":", ".", "break", "wait", "while", "for", "case", "if", ":", ".", "break", "continue",
"continue", "export", "read", "readonly", "export", "read", "readonly", "shift", "times", "trap", "switch",
"shift", "times", "trap", "switch", "unset", "unset", "ulimit", 0 };
"ulimit", 0 };
const char *sh_chars;
const char **sh_cmds;
char *sh_chars;
char **sh_cmds;
#elif defined (__EMX__) #elif defined (__EMX__)
static char sh_chars_dos[] = "*?[];|<>%^&()"; static const char *sh_chars_dos = "*?[];|<>%^&()";
static char *sh_cmds_dos[] = { "break", "call", "cd", "chcp", "chdir", "cls", static const char *sh_cmds_dos[] =
"copy", "ctty", "date", "del", "dir", "echo", { "break", "call", "cd", "chcp", "chdir", "cls", "copy", "ctty", "date",
"erase", "exit", "for", "goto", "if", "md", "del", "dir", "echo", "erase", "exit", "for", "goto", "if", "md",
"mkdir", "path", "pause", "prompt", "rd", "mkdir", "path", "pause", "prompt", "rd", "rmdir", "rem", "ren",
"rmdir", "rem", "ren", "rename", "set", "rename", "set", "shift", "time", "type", "ver", "verify", "vol", ":",
"shift", "time", "type", "ver", "verify", 0 };
"vol", ":", 0 };
static char sh_chars_os2[] = "*?[];|<>%^()\"'&"; static const char *sh_chars_os2 = "*?[];|<>%^()\"'&";
static char *sh_cmds_os2[] = { "call", "cd", "chcp", "chdir", "cls", "copy", static const char *sh_cmds_os2[] =
"date", "del", "detach", "dir", "echo", { "call", "cd", "chcp", "chdir", "cls", "copy", "date", "del", "detach",
"endlocal", "erase", "exit", "for", "goto", "if", "dir", "echo", "endlocal", "erase", "exit", "for", "goto", "if", "keys",
"keys", "md", "mkdir", "move", "path", "pause", "md", "mkdir", "move", "path", "pause", "prompt", "rd", "rem", "ren",
"prompt", "rd", "rem", "ren", "rename", "rmdir", "rename", "rmdir", "set", "setlocal", "shift", "start", "time", "type",
"set", "setlocal", "shift", "start", "time", "ver", "verify", "vol", ":", 0 };
"type", "ver", "verify", "vol", ":", 0 };
static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^~'"; static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^~'";
static char *sh_cmds_sh[] = { "echo", "cd", "eval", "exec", "exit", "login", static const char *sh_cmds_sh[] =
"logout", "set", "umask", "wait", "while", { "echo", "cd", "eval", "exec", "exit", "login", "logout", "set", "umask",
"for", "case", "if", ":", ".", "break", "wait", "while", "for", "case", "if", ":", ".", "break", "continue",
"continue", "export", "read", "readonly", "export", "read", "readonly", "shift", "times", "trap", "switch",
"shift", "times", "trap", "switch", "unset", "unset", 0 };
0 };
char *sh_chars; const char *sh_chars;
char **sh_cmds; const char **sh_cmds;
#elif defined (_AMIGA) #elif defined (_AMIGA)
static char sh_chars[] = "#;\"|<>()?*$`"; static const char *sh_chars = "#;\"|<>()?*$`";
static char *sh_cmds[] = { "cd", "eval", "if", "delete", "echo", "copy", static const char *sh_cmds[] =
"rename", "set", "setenv", "date", "makedir", { "cd", "eval", "if", "delete", "echo", "copy", "rename", "set", "setenv",
"skip", "else", "endif", "path", "prompt", "date", "makedir", "skip", "else", "endif", "path", "prompt", "unset",
"unset", "unsetenv", "version", "unsetenv", "version", 0 };
0 };
#elif defined (WINDOWS32) #elif defined (WINDOWS32)
/* We used to have a double quote (") in sh_chars_dos[] below, but /* We used to have a double quote (") in sh_chars_dos[] below, but
that caused any command line with quoted file names be run that caused any command line with quoted file names be run
@@ -2609,49 +2662,54 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
can handle quoted file names just fine, removing the quote lifts can handle quoted file names just fine, removing the quote lifts
the limit from a very frequent use case, because using quoted the limit from a very frequent use case, because using quoted
file names is commonplace on MS-Windows. */ file names is commonplace on MS-Windows. */
static char sh_chars_dos[] = "|&<>"; static const char *sh_chars_dos = "|&<>";
static char *sh_cmds_dos[] = { "assoc", "break", "call", "cd", "chcp", static const char *sh_cmds_dos[] =
"chdir", "cls", "color", "copy", "ctty", { "assoc", "break", "call", "cd", "chcp", "chdir", "cls", "color", "copy",
"date", "del", "dir", "echo", "echo.", "ctty", "date", "del", "dir", "echo", "echo.", "endlocal", "erase",
"endlocal", "erase", "exit", "for", "ftype", "exit", "for", "ftype", "goto", "if", "if", "md", "mkdir", "move",
"goto", "if", "if", "md", "mkdir", "move", "path", "pause", "prompt", "rd", "rem", "ren", "rename", "rmdir",
"path", "pause", "prompt", "rd", "rem", "ren", "set", "setlocal", "shift", "time", "title", "type", "ver", "verify",
"rename", "rmdir", "set", "setlocal", "vol", ":", 0 };
"shift", "time", "title", "type", "ver",
"verify", "vol", ":", 0 }; static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^";
static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^"; static const char *sh_cmds_sh[] =
static char *sh_cmds_sh[] = { "cd", "eval", "exec", "exit", "login", { "cd", "eval", "exec", "exit", "login", "logout", "set", "umask", "wait",
"logout", "set", "umask", "wait", "while", "for", "while", "for", "case", "if", ":", ".", "break", "continue", "export",
"case", "if", ":", ".", "break", "continue", "read", "readonly", "shift", "times", "trap", "switch", "test",
"export", "read", "readonly", "shift", "times",
"trap", "switch", "test",
#ifdef BATCH_MODE_ONLY_SHELL #ifdef BATCH_MODE_ONLY_SHELL
"echo", "echo",
#endif #endif
0 }; 0 };
char* sh_chars;
char** sh_cmds; const char *sh_chars;
const char **sh_cmds;
#elif defined(__riscos__) #elif defined(__riscos__)
static char sh_chars[] = ""; static const char *sh_chars = "";
static char *sh_cmds[] = { 0 }; static const char *sh_cmds[] = { 0 };
#else /* must be UNIX-ish */ #else /* must be UNIX-ish */
static char sh_chars[] = "#;\"*?[]&|<>(){}$`^~!"; static const char *sh_chars = "#;\"*?[]&|<>(){}$`^~!";
static char *sh_cmds[] = { ".", ":", "break", "case", "cd", "continue", static const char *sh_cmds[] =
"eval", "exec", "exit", "export", "for", "if", { ".", ":", "break", "case", "cd", "continue", "eval", "exec", "exit",
"login", "logout", "read", "readonly", "set", "export", "for", "if", "login", "logout", "read", "readonly", "set",
"shift", "switch", "test", "times", "trap", "shift", "switch", "test", "times", "trap", "ulimit", "umask", "unset",
"ulimit", "umask", "unset", "wait", "while", 0 }; "wait", "while", 0 };
# ifdef HAVE_DOS_PATHS # ifdef HAVE_DOS_PATHS
/* This is required if the MSYS/Cygwin ports (which do not define /* This is required if the MSYS/Cygwin ports (which do not define
WINDOWS32) are compiled with HAVE_DOS_PATHS defined, which uses WINDOWS32) are compiled with HAVE_DOS_PATHS defined, which uses
sh_chars_sh[] directly (see below). */ sh_chars_sh directly (see below). The value must be identical
static char *sh_chars_sh = sh_chars; to that of sh_chars immediately above. */
static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^~!";
# endif /* HAVE_DOS_PATHS */ # endif /* HAVE_DOS_PATHS */
#endif #endif
int i; int i;
char *p; char *p;
char *ap; #ifndef NDEBUG
char *end; char *end;
#endif
char *ap;
const char *cap;
const char *cp;
int instring, word_has_equals, seen_nonequals, last_argument_was_empty; int instring, word_has_equals, seen_nonequals, last_argument_was_empty;
char **new_argv = 0; char **new_argv = 0;
char *argstr = 0; char *argstr = 0;
@@ -2693,10 +2751,8 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
slow_flag = strcmp ((s1 ? s1 : ""), (s2 ? s2 : "")); slow_flag = strcmp ((s1 ? s1 : ""), (s2 ? s2 : ""));
if (s1) free (s1);
free (s1); free (s2);
if (s2)
free (s2);
} }
if (slow_flag) if (slow_flag)
goto slow; goto slow;
@@ -2736,12 +2792,12 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
#endif /* !__MSDOS__ && !__EMX__ */ #endif /* !__MSDOS__ && !__EMX__ */
#endif /* not WINDOWS32 */ #endif /* not WINDOWS32 */
if (ifs != 0) if (ifs)
for (ap = ifs; *ap != '\0'; ++ap) for (cap = ifs; *cap != '\0'; ++cap)
if (*ap != ' ' && *ap != '\t' && *ap != '\n') if (*cap != ' ' && *cap != '\t' && *cap != '\n')
goto slow; goto slow;
if (shellflags != 0) if (shellflags)
if (shellflags[0] != '-' if (shellflags[0] != '-'
|| ((shellflags[1] != 'c' || shellflags[2] != '\0') || ((shellflags[1] != 'c' || shellflags[2] != '\0')
&& (shellflags[1] != 'e' || shellflags[2] != 'c' || shellflags[3] != '\0'))) && (shellflags[1] != 'e' || shellflags[2] != 'c' || shellflags[3] != '\0')))
@@ -2754,7 +2810,9 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
/* All the args can fit in a buffer as big as LINE is. */ /* All the args can fit in a buffer as big as LINE is. */
ap = new_argv[0] = argstr = xmalloc (i); ap = new_argv[0] = argstr = xmalloc (i);
#ifndef NDEBUG
end = ap + i; end = ap + i;
#endif
/* I is how many complete arguments have been found. */ /* I is how many complete arguments have been found. */
i = 0; i = 0;
@@ -3229,11 +3287,11 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
we don't escape them, construct_command_argv_internal will we don't escape them, construct_command_argv_internal will
recursively call itself ad nauseam, or until stack overflow, recursively call itself ad nauseam, or until stack overflow,
whichever happens first. */ whichever happens first. */
for (p = shell; *p != '\0'; ++p) for (cp = shell; *cp != '\0'; ++cp)
{ {
if (strchr (sh_chars, *p) != 0) if (strchr (sh_chars, *cp) != 0)
*(ap++) = '\\'; *(ap++) = '\\';
*(ap++) = *p; *(ap++) = *cp;
} }
*(ap++) = ' '; *(ap++) = ' ';
if (shellflags) if (shellflags)
@@ -3441,7 +3499,8 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
} }
#else #else
else else
fatal (NILF, _("%s (line %d) Bad shell context (!unixy && !batch_mode_shell)\n"), fatal (NILF, CSTRLEN (__FILE__) + INTSTR_LENGTH,
_("%s (line %d) Bad shell context (!unixy && !batch_mode_shell)\n"),
__FILE__, __LINE__); __FILE__, __LINE__);
#endif #endif
@@ -3457,7 +3516,7 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
avoid using a shell. This routine handles only ' quoting, and " quoting avoid using a shell. This routine handles only ' quoting, and " quoting
when no backslash, $ or ' characters are seen in the quotes. Starting when no backslash, $ or ' characters are seen in the quotes. Starting
quotes may be escaped with a backslash. If any of the characters in quotes may be escaped with a backslash. If any of the characters in
sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[] sh_chars is seen, or any of the builtin commands listed in sh_cmds
is the first word of a line, the shell is used. is the first word of a line, the shell is used.
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE. If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.

6
job.h
View File

@@ -1,5 +1,5 @@
/* Definitions for managing subprocesses in GNU Make. /* Definitions for managing subprocesses in GNU Make.
Copyright (C) 1992-2013 Free Software Foundation, Inc. Copyright (C) 1992-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -39,8 +39,8 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef NO_OUTPUT_SYNC #ifdef NO_OUTPUT_SYNC
# define RECORD_SYNC_MUTEX(m) \ # define RECORD_SYNC_MUTEX(m) \
error (NILF, \ O (error, NILF, \
_("-O[TYPE] (--output-sync[=TYPE]) is not configured for this build.")); _("-O[TYPE] (--output-sync[=TYPE]) is not configured for this build."));
#else #else
# ifdef WINDOWS32 # ifdef WINDOWS32
/* For emulations in w32/compat/posixfcn.c. */ /* For emulations in w32/compat/posixfcn.c. */

37
load.c
View File

@@ -1,5 +1,5 @@
/* Loading dynamic objects for GNU Make. /* Loading dynamic objects for GNU Make.
Copyright (C) 2012-2013 Free Software Foundation, Inc. Copyright (C) 2012-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -30,6 +30,11 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include "filedef.h" #include "filedef.h"
#include "variable.h" #include "variable.h"
/* Tru64 V4.0 does not have this flag */
#ifndef RTLD_GLOBAL
# define RTLD_GLOBAL 0
#endif
struct load_list struct load_list
{ {
struct load_list *next; struct load_list *next;
@@ -50,7 +55,10 @@ load_object (const gmk_floc *flocp, int noerror,
{ {
global_dl = dlopen (NULL, RTLD_NOW|RTLD_GLOBAL); global_dl = dlopen (NULL, RTLD_NOW|RTLD_GLOBAL);
if (! global_dl) if (! global_dl)
fatal (flocp, _("Failed to open global symbol table: %s"), dlerror ()); {
const char *err = dlerror ();
OS (fatal, flocp, _("Failed to open global symbol table: %s"), err);
}
} }
symp = (load_func_t) dlsym (global_dl, symname); symp = (load_func_t) dlsym (global_dl, symname);
@@ -74,23 +82,28 @@ load_object (const gmk_floc *flocp, int noerror,
/* Still no? Then fail. */ /* Still no? Then fail. */
if (! dlp) if (! dlp)
{ {
const char *err = dlerror ();
if (noerror) if (noerror)
DB (DB_BASIC, ("%s", dlerror ())); DB (DB_BASIC, ("%s", err));
else else
error (flocp, "%s", dlerror ()); OS (error, flocp, "%s", err);
return NULL; return NULL;
} }
/* Assert that the GPL license symbol is defined. */ /* Assert that the GPL license symbol is defined. */
symp = (load_func_t) dlsym (dlp, "plugin_is_GPL_compatible"); symp = (load_func_t) dlsym (dlp, "plugin_is_GPL_compatible");
if (! symp) if (! symp)
fatal (flocp, _("Loaded object %s is not declared to be GPL compatible"), OS (fatal, flocp,
ldname); _("Loaded object %s is not declared to be GPL compatible"),
ldname);
symp = (load_func_t) dlsym (dlp, symname); symp = (load_func_t) dlsym (dlp, symname);
if (! symp) if (! symp)
fatal (flocp, _("Failed to load symbol %s from %s: %s"), {
symname, ldname, dlerror ()); const char *err = dlerror ();
OSSS (fatal, flocp, _("Failed to load symbol %s from %s: %s"),
symname, ldname, err);
}
/* Add this symbol to a trivial lookup table. This is not efficient but /* Add this symbol to a trivial lookup table. This is not efficient but
it's highly unlikely we'll be loading lots of objects, and we only it's highly unlikely we'll be loading lots of objects, and we only
@@ -133,12 +146,13 @@ load_file (const gmk_floc *flocp, const char **ldname, int noerror)
++fp; ++fp;
if (fp == ep) if (fp == ep)
fatal (flocp, _("Empty symbol name for load: %s"), *ldname); OS (fatal, flocp, _("Empty symbol name for load: %s"), *ldname);
/* Make a copy of the ldname part. */ /* Make a copy of the ldname part. */
memcpy (new, *ldname, l); memcpy (new, *ldname, l);
new[l] = '\0'; new[l] = '\0';
*ldname = new; *ldname = new;
nmlen = l;
/* Make a copy of the symbol name part. */ /* Make a copy of the symbol name part. */
symname = new + l + 1; symname = new + l + 1;
@@ -226,7 +240,8 @@ int
load_file (const gmk_floc *flocp, const char **ldname, int noerror) load_file (const gmk_floc *flocp, const char **ldname, int noerror)
{ {
if (! noerror) if (! noerror)
fatal (flocp, _("The 'load' operation is not supported on this platform.")); O (fatal, flocp,
_("The 'load' operation is not supported on this platform."));
return 0; return 0;
} }
@@ -234,7 +249,7 @@ load_file (const gmk_floc *flocp, const char **ldname, int noerror)
void void
unload_file (const char *name) unload_file (const char *name)
{ {
fatal (NILF, "INTERNAL: Cannot unload when load is not supported!"); O (fatal, NILF, "INTERNAL: Cannot unload when load is not supported!");
} }
#endif /* MAKE_LOAD */ #endif /* MAKE_LOAD */

View File

@@ -1,5 +1,5 @@
/* API for GNU Make dynamic objects. /* API for GNU Make dynamic objects.
Copyright (C) 2013 Free Software Foundation, Inc. Copyright (C) 2013-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -39,9 +39,18 @@ gmk_free (char *s)
void void
gmk_eval (const char *buffer, const gmk_floc *floc) gmk_eval (const char *buffer, const gmk_floc *floc)
{ {
char *s = xstrdup (buffer); /* Preserve existing variable buffer context. */
char *pbuf;
unsigned int plen;
char *s;
install_variable_buffer (&pbuf, &plen);
s = xstrdup (buffer);
eval_buffer (s, floc); eval_buffer (s, floc);
free (s); free (s);
restore_variable_buffer (pbuf, plen);
} }
/* Expand a string and return an allocated buffer. /* Expand a string and return an allocated buffer.

424
main.c
View File

@@ -1,5 +1,5 @@
/* Argument parsing and main program of GNU Make. /* Argument parsing and main program of GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -77,8 +77,8 @@ double atof ();
static void clean_jobserver (int status); static void clean_jobserver (int status);
static void print_data_base (void); static void print_data_base (void);
static void print_version (void); static void print_version (void);
static void decode_switches (int argc, char **argv, int env); static void decode_switches (int argc, const char **argv, int env);
static void decode_env_switches (char *envar, unsigned int len); static void decode_env_switches (const char *envar, unsigned int len);
static struct variable *define_makeflags (int all, int makefile); static struct variable *define_makeflags (int all, int makefile);
static char *quote_for_env (char *out, const char *in); static char *quote_for_env (char *out, const char *in);
static void initialize_global_hash_tables (void); static void initialize_global_hash_tables (void);
@@ -94,7 +94,8 @@ struct command_switch
{ {
flag, /* Turn int flag on. */ flag, /* Turn int flag on. */
flag_off, /* Turn int flag off. */ flag_off, /* Turn int flag off. */
string, /* One string per switch. */ string, /* One string per invocation. */
strlist, /* One string per switch. */
filename, /* A string containing a file name. */ filename, /* A string containing a file name. */
positive_int, /* A positive integer. */ positive_int, /* A positive integer. */
floating, /* A floating-point number (double). */ floating, /* A floating-point number (double). */
@@ -110,7 +111,7 @@ struct command_switch
const void *noarg_value; /* Pointer to value used if no arg given. */ const void *noarg_value; /* Pointer to value used if no arg given. */
const void *default_value; /* Pointer to default value. */ const void *default_value; /* Pointer to default value. */
char *long_name; /* Long option name. */ const char *long_name; /* Long option name. */
}; };
/* True if C is a switch value that corresponds to a short option. */ /* True if C is a switch value that corresponds to a short option. */
@@ -118,7 +119,7 @@ struct command_switch
#define short_option(c) ((c) <= CHAR_MAX) #define short_option(c) ((c) <= CHAR_MAX)
/* The structure used to hold the list of strings given /* The structure used to hold the list of strings given
in command switches of a type that takes string arguments. */ in command switches of a type that takes strlist arguments. */
struct stringlist struct stringlist
{ {
@@ -157,7 +158,7 @@ int db_level = 0;
/* Synchronize output (--output-sync). */ /* Synchronize output (--output-sync). */
static struct stringlist *output_sync_option = 0; char *output_sync_option = 0;
#ifdef WINDOWS32 #ifdef WINDOWS32
/* Suspend make in main for a short time to allow debugger to attach */ /* Suspend make in main for a short time to allow debugger to attach */
@@ -234,7 +235,7 @@ static unsigned int inf_jobs = 0;
/* File descriptors for the jobs pipe. */ /* File descriptors for the jobs pipe. */
static struct stringlist *jobserver_fds = 0; char *jobserver_fds = 0;
int job_fds[2] = { -1, -1 }; int job_fds[2] = { -1, -1 };
int job_rfd = -1; int job_rfd = -1;
@@ -242,7 +243,7 @@ int job_rfd = -1;
/* Handle for the mutex used on Windows to synchronize output of our /* Handle for the mutex used on Windows to synchronize output of our
children under -O. */ children under -O. */
static struct stringlist *sync_mutex = 0; char *sync_mutex = 0;
/* Maximum load average at which multiple jobs will be run. /* Maximum load average at which multiple jobs will be run.
Negative values mean unlimited, while zero means limit to Negative values mean unlimited, while zero means limit to
@@ -436,14 +437,14 @@ static const struct command_switch switches[] =
{ 'W', filename, &new_files, 0, 0, 0, 0, 0, "what-if" }, { 'W', filename, &new_files, 0, 0, 0, 0, 0, "what-if" },
/* These are long-style options. */ /* These are long-style options. */
{ CHAR_MAX+1, string, &db_flags, 1, 1, 0, "basic", 0, "debug" }, { CHAR_MAX+1, strlist, &db_flags, 1, 1, 0, "basic", 0, "debug" },
{ CHAR_MAX+2, string, &jobserver_fds, 1, 1, 0, 0, 0, "jobserver-fds" }, { CHAR_MAX+2, string, &jobserver_fds, 1, 1, 0, 0, 0, "jobserver-fds" },
{ CHAR_MAX+3, flag, &trace_flag, 1, 1, 0, 0, 0, "trace" }, { CHAR_MAX+3, flag, &trace_flag, 1, 1, 0, 0, 0, "trace" },
{ CHAR_MAX+4, flag, &inhibit_print_directory_flag, 1, 1, 0, 0, 0, { CHAR_MAX+4, flag, &inhibit_print_directory_flag, 1, 1, 0, 0, 0,
"no-print-directory" }, "no-print-directory" },
{ CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0, { CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
"warn-undefined-variables" }, "warn-undefined-variables" },
{ CHAR_MAX+6, string, &eval_strings, 1, 0, 0, 0, 0, "eval" }, { CHAR_MAX+6, strlist, &eval_strings, 1, 0, 0, 0, 0, "eval" },
{ CHAR_MAX+7, string, &sync_mutex, 1, 1, 0, 0, 0, "sync-mutex" }, { CHAR_MAX+7, string, &sync_mutex, 1, 1, 0, 0, 0, "sync-mutex" },
{ 0, 0, 0, 0, 0, 0, 0, 0, 0 } { 0, 0, 0, 0, 0, 0, 0, 0, 0 }
}; };
@@ -479,7 +480,13 @@ static struct command_variable *command_variables;
/* The name we were invoked with. */ /* The name we were invoked with. */
#ifdef WINDOWS32
/* On MS-Windows, we chop off the .exe suffix in 'main', so this
cannot be 'const'. */
char *program; char *program;
#else
const char *program;
#endif
/* Our current directory before processing any -C options. */ /* Our current directory before processing any -C options. */
@@ -619,11 +626,11 @@ initialize_stopchar_map ()
stopchar_map[(int)'-'] = MAP_USERFUNC; stopchar_map[(int)'-'] = MAP_USERFUNC;
stopchar_map[(int)'_'] = MAP_USERFUNC; stopchar_map[(int)'_'] = MAP_USERFUNC;
stopchar_map[(int)'/'] = MAP_PATHSEP; stopchar_map[(int)'/'] = MAP_DIRSEP;
#if defined(VMS) #if defined(VMS)
stopchar_map[(int)']'] = MAP_PATHSEP; stopchar_map[(int)']'] = MAP_DIRSEP;
#elif defined(HAVE_DOS_PATHS) #elif defined(HAVE_DOS_PATHS)
stopchar_map[(int)'\\'] = MAP_PATHSEP; stopchar_map[(int)'\\'] = MAP_DIRSEP;
#endif #endif
for (i = 1; i <= UCHAR_MAX; ++i) for (i = 1; i <= UCHAR_MAX; ++i)
@@ -638,46 +645,41 @@ initialize_stopchar_map ()
} }
static const char * static const char *
expand_command_line_file (char *name) expand_command_line_file (const char *name)
{ {
const char *cp; const char *cp;
char *expanded = 0; char *expanded = 0;
if (name[0] == '\0') if (name[0] == '\0')
fatal (NILF, _("empty string invalid as file name")); O (fatal, NILF, _("empty string invalid as file name"));
if (name[0] == '~') if (name[0] == '~')
{ {
expanded = tilde_expand (name); expanded = tilde_expand (name);
if (expanded != 0) if (expanded && expanded[0] != '\0')
name = expanded; name = expanded;
} }
/* This is also done in parse_file_seq, so this is redundant /* This is also done in parse_file_seq, so this is redundant
for names read from makefiles. It is here for names passed for names read from makefiles. It is here for names passed
on the command line. */ on the command line. */
while (name[0] == '.' && name[1] == '/' && name[2] != '\0') while (name[0] == '.' && name[1] == '/')
{ {
name += 2; name += 2;
while (*name == '/') while (name[0] == '/')
/* Skip following slashes: ".//foo" is "foo", not "/foo". */ /* Skip following slashes: ".//foo" is "foo", not "/foo". */
++name; ++name;
} }
if (*name == '\0') if (name[0] == '\0')
{ {
/* It was all slashes! Move back to the dot and truncate /* Nothing else but one or more "./", maybe plus slashes! */
it after the first slash, so it becomes just "./". */ name = "./";
do
--name;
while (name[0] != '.');
name[2] = '\0';
} }
cp = strcache_add (name); cp = strcache_add (name);
if (expanded) free (expanded);
free (expanded);
return cp; return cp;
} }
@@ -731,7 +733,8 @@ decode_debug_flags (void)
db_level |= DB_BASIC | DB_VERBOSE; db_level |= DB_BASIC | DB_VERBOSE;
break; break;
default: default:
fatal (NILF, _("unknown debug level specification '%s'"), p); OS (fatal, NILF,
_("unknown debug level specification '%s'"), p);
} }
while (*(++p) != '\0') while (*(++p) != '\0')
@@ -756,40 +759,23 @@ decode_debug_flags (void)
static void static void
decode_output_sync_flags (void) decode_output_sync_flags (void)
{ {
const char **pp; if (output_sync_option)
if (!output_sync_option)
return;
for (pp=output_sync_option->list; *pp; ++pp)
{ {
const char *p = *pp; if (streq (output_sync_option, "none"))
if (streq (p, "none"))
output_sync = OUTPUT_SYNC_NONE; output_sync = OUTPUT_SYNC_NONE;
else if (streq (p, "line")) else if (streq (output_sync_option, "line"))
output_sync = OUTPUT_SYNC_LINE; output_sync = OUTPUT_SYNC_LINE;
else if (streq (p, "target")) else if (streq (output_sync_option, "target"))
output_sync = OUTPUT_SYNC_TARGET; output_sync = OUTPUT_SYNC_TARGET;
else if (streq (p, "recurse")) else if (streq (output_sync_option, "recurse"))
output_sync = OUTPUT_SYNC_RECURSE; output_sync = OUTPUT_SYNC_RECURSE;
else else
fatal (NILF, _("unknown output-sync type '%s'"), p); OS (fatal, NILF,
_("unknown output-sync type '%s'"), output_sync_option);
} }
if (sync_mutex) if (sync_mutex)
{ RECORD_SYNC_MUTEX (sync_mutex);
const char *mp;
unsigned int idx;
for (idx = 1; idx < sync_mutex->idx; idx++)
if (!streq (sync_mutex->list[0], sync_mutex->list[idx]))
fatal (NILF, _("internal error: multiple --sync-mutex options"));
/* Now parse the mutex handle string. */
mp = sync_mutex->list[0];
RECORD_SYNC_MUTEX (mp);
}
} }
#ifdef WINDOWS32 #ifdef WINDOWS32
@@ -805,16 +791,10 @@ prepare_mutex_handle_string (sync_handle_t handle)
{ {
if (!sync_mutex) if (!sync_mutex)
{ {
/* 2 hex digits per byte + 2 characters for "0x" + null. */
char hdl_string[2 * sizeof (sync_handle_t) + 2 + 1];
/* Prepare the mutex handle string for our children. */ /* Prepare the mutex handle string for our children. */
sprintf (hdl_string, "0x%x", handle); /* 2 hex digits per byte + 2 characters for "0x" + null. */
sync_mutex = xmalloc (sizeof (struct stringlist)); sync_mutex = xmalloc ((2 * sizeof (sync_handle_t)) + 2 + 1);
sync_mutex->list = xmalloc (sizeof (char *)); sprintf (sync_mutex, "0x%Ix", handle);
sync_mutex->list[0] = xstrdup (hdl_string);
sync_mutex->idx = 1;
sync_mutex->max = 1;
define_makeflags (1, 0); define_makeflags (1, 0);
} }
} }
@@ -909,15 +889,15 @@ find_and_set_default_shell (const char *token)
{ {
int sh_found = 0; int sh_found = 0;
char *atoken = 0; char *atoken = 0;
char *search_token; const char *search_token;
char *tokend; const char *tokend;
PATH_VAR(sh_path); PATH_VAR(sh_path);
extern char *default_shell; extern const char *default_shell;
if (!token) if (!token)
search_token = default_shell; search_token = default_shell;
else else
atoken = search_token = xstrdup (token); search_token = atoken = xstrdup (token);
/* If the user explicitly requests the DOS cmd shell, obey that request. /* If the user explicitly requests the DOS cmd shell, obey that request.
However, make sure that's what they really want by requiring the value However, make sure that's what they really want by requiring the value
@@ -1022,8 +1002,7 @@ find_and_set_default_shell (const char *token)
batch_mode_shell = 1; batch_mode_shell = 1;
#endif #endif
if (atoken) free (atoken);
free (atoken);
return (sh_found); return (sh_found);
} }
@@ -1053,8 +1032,8 @@ main (int argc, char **argv, char **envp)
unsigned int restarts = 0; unsigned int restarts = 0;
unsigned int syncing = 0; unsigned int syncing = 0;
#ifdef WINDOWS32 #ifdef WINDOWS32
char *unix_path = NULL; const char *unix_path = NULL;
char *windows32_path = NULL; const char *windows32_path = NULL;
SetUnhandledExceptionFilter (handle_runtime_exceptions); SetUnhandledExceptionFilter (handle_runtime_exceptions);
@@ -1177,16 +1156,12 @@ main (int argc, char **argv, char **envp)
/* Figure out where this program lives. */ /* Figure out where this program lives. */
if (argv[0] == 0) if (argv[0] == 0)
argv[0] = ""; argv[0] = (char *)"";
if (argv[0][0] == '\0') if (argv[0][0] == '\0')
program = "make"; program = "make";
else else
{ {
#ifdef VMS
program = strrchr (argv[0], ']');
#else
program = strrchr (argv[0], '/'); program = strrchr (argv[0], '/');
#endif
#if defined(__MSDOS__) || defined(__EMX__) #if defined(__MSDOS__) || defined(__EMX__)
if (program == 0) if (program == 0)
program = strrchr (argv[0], '\\'); program = strrchr (argv[0], '\\');
@@ -1216,7 +1191,11 @@ main (int argc, char **argv, char **envp)
} }
#endif #endif
if (program == 0) if (program == 0)
#ifdef VMS
program = vms_progname(argv[0]);
#else
program = argv[0]; program = argv[0];
#endif
else else
++program; ++program;
} }
@@ -1237,7 +1216,7 @@ main (int argc, char **argv, char **envp)
#ifdef HAVE_GETCWD #ifdef HAVE_GETCWD
perror_with_name ("getcwd", ""); perror_with_name ("getcwd", "");
#else #else
error (NILF, "getwd: %s", current_directory); OS (error, NILF, "getwd: %s", current_directory);
#endif #endif
current_directory[0] = '\0'; current_directory[0] = '\0';
directory_before_chdir = 0; directory_before_chdir = 0;
@@ -1285,10 +1264,8 @@ main (int argc, char **argv, char **envp)
define_variable_cname (".FEATURES", features, o_default, 0); define_variable_cname (".FEATURES", features, o_default, 0);
} }
#ifdef HAVE_GUILE
/* Configure GNU Guile support */ /* Configure GNU Guile support */
guile_gmake_setup (NILF); guile_gmake_setup (NILF);
#endif
/* Read in variables from the environment. It is important that this be /* Read in variables from the environment. It is important that this be
done before $(MAKE) is figured out so its definitions will not be done before $(MAKE) is figured out so its definitions will not be
@@ -1301,7 +1278,7 @@ main (int argc, char **argv, char **envp)
for (i = 0; envp[i] != 0; ++i) for (i = 0; envp[i] != 0; ++i)
{ {
struct variable *v; struct variable *v;
char *ep = envp[i]; const char *ep = envp[i];
/* By default, export all variables culled from the environment. */ /* By default, export all variables culled from the environment. */
enum variable_export export = v_export; enum variable_export export = v_export;
unsigned int len; unsigned int len;
@@ -1350,7 +1327,7 @@ main (int argc, char **argv, char **envp)
#ifndef __MSDOS__ #ifndef __MSDOS__
export = v_noexport; export = v_noexport;
#endif #endif
shell_var.name = "SHELL"; shell_var.name = xstrdup ("SHELL");
shell_var.length = 5; shell_var.length = 5;
shell_var.value = xstrdup (ep); shell_var.value = xstrdup (ep);
} }
@@ -1397,7 +1374,6 @@ main (int argc, char **argv, char **envp)
#endif #endif
/* Decode the switches. */ /* Decode the switches. */
decode_env_switches (STRING_SIZE_TUPLE ("GNUMAKEFLAGS")); decode_env_switches (STRING_SIZE_TUPLE ("GNUMAKEFLAGS"));
/* Clear GNUMAKEFLAGS to avoid duplication. */ /* Clear GNUMAKEFLAGS to avoid duplication. */
@@ -1419,7 +1395,20 @@ main (int argc, char **argv, char **envp)
decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS")); decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
#endif #endif
decode_switches (argc, argv, 0); decode_switches (argc, (const char **)argv, 0);
/* Set a variable specifying whether stdout/stdin is hooked to a TTY. */
#ifdef HAVE_ISATTY
if (isatty (fileno (stdout)))
if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMOUT")))
define_variable_cname ("MAKE_TERMOUT", TTYNAME (fileno (stdout)),
o_default, 0)->export = v_export;
if (isatty (fileno (stderr)))
if (! lookup_variable (STRING_SIZE_TUPLE ("MAKE_TERMERR")))
define_variable_cname ("MAKE_TERMERR", TTYNAME (fileno (stderr)),
o_default, 0)->export = v_export;
#endif
/* Reset in case the switches changed our minds. */ /* Reset in case the switches changed our minds. */
syncing = (output_sync == OUTPUT_SYNC_LINE syncing = (output_sync == OUTPUT_SYNC_LINE
@@ -1457,7 +1446,7 @@ main (int argc, char **argv, char **envp)
if (print_version_flag) if (print_version_flag)
{ {
print_version (); print_version ();
die (0); die (MAKE_SUCCESS);
} }
if (ISDB (DB_BASIC)) if (ISDB (DB_BASIC))
@@ -1526,29 +1515,23 @@ main (int argc, char **argv, char **envp)
if (jobserver_fds) if (jobserver_fds)
{ {
const char *cp; /* Make sure the jobserver option has the proper format. */
unsigned int ui; const char *cp = jobserver_fds;
for (ui=1; ui < jobserver_fds->idx; ++ui)
if (!streq (jobserver_fds->list[0], jobserver_fds->list[ui]))
fatal (NILF, _("internal error: multiple --jobserver-fds options"));
/* Now parse the fds string and make sure it has the proper format. */
cp = jobserver_fds->list[0];
#ifdef WINDOWS32 #ifdef WINDOWS32
if (! open_jobserver_semaphore (cp)) if (! open_jobserver_semaphore (cp))
{ {
DWORD err = GetLastError (); DWORD err = GetLastError ();
fatal (NILF, _("internal error: unable to open jobserver semaphore '%s': (Error %ld: %s)"), const char *estr = map_windows32_error_to_string (err);
cp, err, map_windows32_error_to_string (err)); fatal (NILF, strlen (cp) + INTSTR_LENGTH + strlen (estr),
_("internal error: unable to open jobserver semaphore '%s': (Error %ld: %s)"),
cp, err, estr);
} }
DB (DB_JOBS, (_("Jobserver client (semaphore %s)\n"), cp)); DB (DB_JOBS, (_("Jobserver client (semaphore %s)\n"), cp));
#else #else
if (sscanf (cp, "%d,%d", &job_fds[0], &job_fds[1]) != 2) if (sscanf (cp, "%d,%d", &job_fds[0], &job_fds[1]) != 2)
fatal (NILF, OS (fatal, NILF,
_("internal error: invalid --jobserver-fds string '%s'"), cp); _("internal error: invalid --jobserver-fds string '%s'"), cp);
DB (DB_JOBS, DB (DB_JOBS,
(_("Jobserver client (fds %d,%d)\n"), job_fds[0], job_fds[1])); (_("Jobserver client (fds %d,%d)\n"), job_fds[0], job_fds[1]));
@@ -1564,7 +1547,8 @@ main (int argc, char **argv, char **envp)
if (job_slots > 0) if (job_slots > 0)
{ {
if (! restarts) if (! restarts)
error (NILF, _("warning: -jN forced in submake: disabling jobserver mode.")); O (error, NILF,
_("warning: -jN forced in submake: disabling jobserver mode."));
} }
#ifndef WINDOWS32 #ifndef WINDOWS32
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
@@ -1582,8 +1566,8 @@ main (int argc, char **argv, char **envp)
if (errno != EBADF) if (errno != EBADF)
pfatal_with_name (_("dup jobserver")); pfatal_with_name (_("dup jobserver"));
error (NILF, O (error, NILF,
_("warning: jobserver unavailable: using -j1. Add '+' to parent make rule.")); _("warning: jobserver unavailable: using -j1. Add '+' to parent make rule."));
job_slots = 1; job_slots = 1;
job_fds[0] = job_fds[1] = -1; job_fds[0] = job_fds[1] = -1;
} }
@@ -1600,7 +1584,7 @@ main (int argc, char **argv, char **envp)
close (job_fds[1]); close (job_fds[1]);
#endif #endif
job_fds[0] = job_fds[1] = -1; job_fds[0] = job_fds[1] = -1;
free (jobserver_fds->list);
free (jobserver_fds); free (jobserver_fds);
jobserver_fds = 0; jobserver_fds = 0;
} }
@@ -1609,7 +1593,11 @@ main (int argc, char **argv, char **envp)
/* The extra indirection through $(MAKE_COMMAND) is done /* The extra indirection through $(MAKE_COMMAND) is done
for hysterical raisins. */ for hysterical raisins. */
#ifdef VMS
define_variable_cname("MAKE_COMMAND", vms_command(argv[0]), o_default, 0);
#else
define_variable_cname ("MAKE_COMMAND", argv[0], o_default, 0); define_variable_cname ("MAKE_COMMAND", argv[0], o_default, 0);
#endif
define_variable_cname ("MAKE", "$(MAKE_COMMAND)", o_default, 1); define_variable_cname ("MAKE", "$(MAKE_COMMAND)", o_default, 1);
if (command_variables != 0) if (command_variables != 0)
@@ -1724,7 +1712,7 @@ main (int argc, char **argv, char **envp)
#ifdef HAVE_GETCWD #ifdef HAVE_GETCWD
perror_with_name ("getcwd", ""); perror_with_name ("getcwd", "");
#else #else
error (NILF, "getwd: %s", current_directory); OS (error, NILF, "getwd: %s", current_directory);
#endif #endif
starting_directory = 0; starting_directory = 0;
} }
@@ -1746,10 +1734,12 @@ main (int argc, char **argv, char **envp)
and thus re-read the makefiles, we read standard input and thus re-read the makefiles, we read standard input
into a temporary file and read from that. */ into a temporary file and read from that. */
FILE *outfile; FILE *outfile;
char *template, *tmpdir; char *template;
const char *tmpdir;
if (stdin_nm) if (stdin_nm)
fatal (NILF, _("Makefile from standard input specified twice.")); O (fatal, NILF,
_("Makefile from standard input specified twice."));
#ifdef VMS #ifdef VMS
# define DEFAULT_TMPDIR "sys$scratch:" # define DEFAULT_TMPDIR "sys$scratch:"
@@ -1916,7 +1906,7 @@ main (int argc, char **argv, char **envp)
extern int _is_unixy_shell (const char *_path); extern int _is_unixy_shell (const char *_path);
struct variable *shv = lookup_variable (STRING_SIZE_TUPLE ("SHELL")); struct variable *shv = lookup_variable (STRING_SIZE_TUPLE ("SHELL"));
extern int unixy_shell; extern int unixy_shell;
extern char *default_shell; extern const char *default_shell;
if (shv && *shv->value) if (shv && *shv->value)
{ {
@@ -1973,16 +1963,16 @@ main (int argc, char **argv, char **envp)
undefine_default_variables (); undefine_default_variables ();
} }
#if defined (__MSDOS__) || defined (__EMX__) #if defined (__MSDOS__) || defined (__EMX__) || defined (VMS)
if (job_slots != 1 if (job_slots != 1
# ifdef __EMX__ # ifdef __EMX__
&& _osmode != OS2_MODE /* turn off -j if we are in DOS mode */ && _osmode != OS2_MODE /* turn off -j if we are in DOS mode */
# endif # endif
) )
{ {
error (NILF, O (error, NILF,
_("Parallel jobs (-j) are not supported on this platform.")); _("Parallel jobs (-j) are not supported on this platform."));
error (NILF, _("Resetting to single job (-j1) mode.")); O (error, NILF, _("Resetting to single job (-j1) mode."));
job_slots = 1; job_slots = 1;
} }
#endif #endif
@@ -1993,8 +1983,6 @@ main (int argc, char **argv, char **envp)
if (job_slots > 1) if (job_slots > 1)
{ {
char *cp;
#ifdef WINDOWS32 #ifdef WINDOWS32
/* sub_proc.c cannot wait for more than MAXIMUM_WAIT_OBJECTS objects /* sub_proc.c cannot wait for more than MAXIMUM_WAIT_OBJECTS objects
* and one of them is the job-server semaphore object. Limit the * and one of them is the job-server semaphore object. Limit the
@@ -2009,8 +1997,9 @@ main (int argc, char **argv, char **envp)
if (! create_jobserver_semaphore (job_slots - 1)) if (! create_jobserver_semaphore (job_slots - 1))
{ {
DWORD err = GetLastError (); DWORD err = GetLastError ();
fatal (NILF, _("creating jobserver semaphore: (Error %ld: %s)"), const char *estr = map_windows32_error_to_string (err);
err, map_windows32_error_to_string (err)); ONS (fatal, NILF,
_("creating jobserver semaphore: (Error %ld: %s)"), err, estr);
} }
#else #else
char c = '+'; char c = '+';
@@ -2040,28 +2029,22 @@ main (int argc, char **argv, char **envp)
} }
#endif #endif
/* Fill in the jobserver_fds struct for our children. */ /* Fill in the jobserver_fds for our children. */
#ifdef WINDOWS32 #ifdef WINDOWS32
cp = xmalloc (MAX_PATH + 1); jobserver_fds = xmalloc (MAX_PATH + 1);
strcpy (cp, get_jobserver_semaphore_name ()); strcpy (jobserver_fds, get_jobserver_semaphore_name ());
#else #else
cp = xmalloc ((CSTRLEN ("1024") * 2) + 2); jobserver_fds = xmalloc ((INTSTR_LENGTH * 2) + 2);
sprintf (cp, "%d,%d", job_fds[0], job_fds[1]); sprintf (jobserver_fds, "%d,%d", job_fds[0], job_fds[1]);
#endif #endif
jobserver_fds = xmalloc (sizeof (struct stringlist));
jobserver_fds->list = xmalloc (sizeof (char *));
jobserver_fds->list[0] = cp;
jobserver_fds->idx = 1;
jobserver_fds->max = 1;
} }
#endif #endif
#ifndef MAKE_SYMLINKS #ifndef MAKE_SYMLINKS
if (check_symlink_flag) if (check_symlink_flag)
{ {
error (NILF, _("Symbolic links not supported: disabling -L.")); O (error, NILF, _("Symbolic links not supported: disabling -L."));
check_symlink_flag = 0; check_symlink_flag = 0;
} }
#endif #endif
@@ -2138,7 +2121,8 @@ main (int argc, char **argv, char **envp)
FILE_TIMESTAMP *makefile_mtimes = 0; FILE_TIMESTAMP *makefile_mtimes = 0;
unsigned int mm_idx = 0; unsigned int mm_idx = 0;
char **nargv; char **aargv = NULL;
const char **nargv;
int nargc; int nargc;
int orig_db_level = db_level; int orig_db_level = db_level;
enum update_status status; enum update_status status;
@@ -2250,8 +2234,8 @@ main (int argc, char **argv, char **envp)
FILE_TIMESTAMP mtime; FILE_TIMESTAMP mtime;
/* The update failed and this makefile was not /* The update failed and this makefile was not
from the MAKEFILES variable, so we care. */ from the MAKEFILES variable, so we care. */
error (NILF, _("Failed to remake makefile '%s'."), OS (error, NILF, _("Failed to remake makefile '%s'."),
d->file->name); d->file->name);
mtime = file_mtime_no_search (d->file); mtime = file_mtime_no_search (d->file);
any_remade |= (mtime != NONEXISTENT_MTIME any_remade |= (mtime != NONEXISTENT_MTIME
&& mtime != makefile_mtimes[i]); && mtime != makefile_mtimes[i]);
@@ -2262,18 +2246,20 @@ main (int argc, char **argv, char **envp)
/* This makefile was not found at all. */ /* This makefile was not found at all. */
if (! (d->changed & RM_DONTCARE)) if (! (d->changed & RM_DONTCARE))
{ {
const char *dnm = dep_name (d);
size_t l = strlen (dnm);
/* This is a makefile we care about. See how much. */ /* This is a makefile we care about. See how much. */
if (d->changed & RM_INCLUDED) if (d->changed & RM_INCLUDED)
/* An included makefile. We don't need /* An included makefile. We don't need to die, but we
to die, but we do want to complain. */ do want to complain. */
error (NILF, error (NILF, l,
_("Included makefile '%s' was not found."), _("Included makefile '%s' was not found."), dnm);
dep_name (d));
else else
{ {
/* A normal makefile. We must die later. */ /* A normal makefile. We must die later. */
error (NILF, _("Makefile '%s' was not found"), error (NILF, l,
dep_name (d)); _("Makefile '%s' was not found"), dnm);
any_failed = 1; any_failed = 1;
} }
} }
@@ -2284,7 +2270,7 @@ main (int argc, char **argv, char **envp)
if (any_remade) if (any_remade)
goto re_exec; goto re_exec;
if (any_failed) if (any_failed)
die (2); die (MAKE_FAILURE);
break; break;
} }
@@ -2319,13 +2305,15 @@ main (int argc, char **argv, char **envp)
nargc = argc; nargc = argc;
if (stdin_nm) if (stdin_nm)
{ {
nargv = xmalloc ((nargc + 2) * sizeof (char *)); void *m = xmalloc ((nargc + 2) * sizeof (char *));
memcpy (nargv, argv, argc * sizeof (char *)); aargv = m;
nargv[nargc++] = xstrdup (concat (2, "-o", stdin_nm)); memcpy (aargv, argv, argc * sizeof (char *));
nargv[nargc] = 0; aargv[nargc++] = xstrdup (concat (2, "-o", stdin_nm));
aargv[nargc] = 0;
nargv = m;
} }
else else
nargv = argv; nargv = (const char**)argv;
if (directories != 0 && directories->idx > 0) if (directories != 0 && directories->idx > 0)
{ {
@@ -2338,7 +2326,8 @@ main (int argc, char **argv, char **envp)
bad = 0; bad = 0;
} }
if (bad) if (bad)
fatal (NILF, _("Couldn't change back to original directory.")); O (fatal, NILF,
_("Couldn't change back to original directory."));
} }
++restarts; ++restarts;
@@ -2350,7 +2339,7 @@ main (int argc, char **argv, char **envp)
if (ISDB (DB_BASIC)) if (ISDB (DB_BASIC))
{ {
char **p; const char **p;
printf (_("Re-executing[%u]:"), restarts); printf (_("Re-executing[%u]:"), restarts);
for (p = nargv; *p != 0; ++p) for (p = nargv; *p != 0; ++p)
printf (" %s", *p); printf (" %s", *p);
@@ -2429,15 +2418,16 @@ main (int argc, char **argv, char **envp)
exit (WIFEXITED(r) ? WEXITSTATUS(r) : EXIT_FAILURE); exit (WIFEXITED(r) ? WEXITSTATUS(r) : EXIT_FAILURE);
} }
#else #else
exec_command (nargv, environ); exec_command ((char **)nargv, environ);
#endif #endif
free (aargv);
break;
} }
db_level = orig_db_level; db_level = orig_db_level;
/* Free the makefile mtimes (if we allocated any). */ /* Free the makefile mtimes. */
if (makefile_mtimes) free (makefile_mtimes);
free (makefile_mtimes);
} }
/* Set up 'MAKEFLAGS' again for the normal targets. */ /* Set up 'MAKEFLAGS' again for the normal targets. */
@@ -2492,7 +2482,8 @@ main (int argc, char **argv, char **envp)
{ {
/* .DEFAULT_GOAL should contain one target. */ /* .DEFAULT_GOAL should contain one target. */
if (ns->next != 0) if (ns->next != 0)
fatal (NILF, _(".DEFAULT_GOAL contains more than one target")); O (fatal, NILF,
_(".DEFAULT_GOAL contains more than one target"));
f = enter_file (strcache_add (ns->name)); f = enter_file (strcache_add (ns->name));
@@ -2515,9 +2506,9 @@ main (int argc, char **argv, char **envp)
if (!goals) if (!goals)
{ {
if (read_files == 0) if (read_files == 0)
fatal (NILF, _("No targets specified and no makefile found")); O (fatal, NILF, _("No targets specified and no makefile found"));
fatal (NILF, _("No targets")); O (fatal, NILF, _("No targets"));
} }
/* Update the goals. */ /* Update the goals. */
@@ -2546,15 +2537,15 @@ main (int argc, char **argv, char **envp)
/* If we detected some clock skew, generate one last warning */ /* If we detected some clock skew, generate one last warning */
if (clock_skew_detected) if (clock_skew_detected)
error (NILF, O (error, NILF,
_("warning: Clock skew detected. Your build may be incomplete.")); _("warning: Clock skew detected. Your build may be incomplete."));
/* Exit. */ /* Exit. */
die (makefile_status); die (makefile_status);
} }
/* NOTREACHED */ /* NOTREACHED */
exit (0); exit (MAKE_SUCCESS);
} }
/* Parsing of arguments, decoding of switches. */ /* Parsing of arguments, decoding of switches. */
@@ -2599,6 +2590,7 @@ init_switches (void)
break; break;
case string: case string:
case strlist:
case filename: case filename:
case positive_int: case positive_int:
case floating: case floating:
@@ -2626,7 +2618,7 @@ init_switches (void)
/* Non-option argument. It might be a variable definition. */ /* Non-option argument. It might be a variable definition. */
static void static void
handle_non_switch_argument (char *arg, int env) handle_non_switch_argument (const char *arg, int env)
{ {
struct variable *v; struct variable *v;
@@ -2733,7 +2725,7 @@ print_usage (int bad)
They came from the environment if ENV is nonzero. */ They came from the environment if ENV is nonzero. */
static void static void
decode_switches (int argc, char **argv, int env) decode_switches (int argc, const char **argv, int env)
{ {
int bad = 0; int bad = 0;
register const struct command_switch *cs; register const struct command_switch *cs;
@@ -2753,14 +2745,17 @@ decode_switches (int argc, char **argv, int env)
while (optind < argc) while (optind < argc)
{ {
const char *coptarg;
/* Parse the next argument. */ /* Parse the next argument. */
c = getopt_long (argc, argv, options, long_options, (int *) 0); c = getopt_long (argc, (char*const*)argv, options, long_options, NULL);
coptarg = optarg;
if (c == EOF) if (c == EOF)
/* End of arguments, or "--" marker seen. */ /* End of arguments, or "--" marker seen. */
break; break;
else if (c == 1) else if (c == 1)
/* An argument not starting with a dash. */ /* An argument not starting with a dash. */
handle_non_switch_argument (optarg, env); handle_non_switch_argument (coptarg, env);
else if (c == '?') else if (c == '?')
/* Bad option. We will print a usage message and die later. /* Bad option. We will print a usage message and die later.
But continue to parse the other options so the user can But continue to parse the other options so the user can
@@ -2791,13 +2786,14 @@ decode_switches (int argc, char **argv, int env)
break; break;
case string: case string:
case strlist:
case filename: case filename:
if (!doit) if (!doit)
break; break;
if (optarg == 0) if (! coptarg)
optarg = xstrdup (cs->noarg_value); coptarg = xstrdup (cs->noarg_value);
else if (*optarg == '\0') else if (*coptarg == '\0')
{ {
char opt[2] = "c"; char opt[2] = "c";
const char *op = opt; const char *op = opt;
@@ -2807,9 +2803,19 @@ decode_switches (int argc, char **argv, int env)
else else
op = cs->long_name; op = cs->long_name;
error (NILF, _("the '%s%s' option requires a non-empty string argument"), error (NILF, strlen (op),
_("the '%s%s' option requires a non-empty string argument"),
short_option (cs->c) ? "-" : "--", op); short_option (cs->c) ? "-" : "--", op);
bad = 1; bad = 1;
break;
}
if (cs->type == string)
{
char **val = (char **)cs->value_ptr;
free (*val);
*val = xstrdup (coptarg);
break;
} }
sl = *(struct stringlist **) cs->value_ptr; sl = *(struct stringlist **) cs->value_ptr;
@@ -2829,39 +2835,40 @@ decode_switches (int argc, char **argv, int env)
sl->max * sizeof (char *)); sl->max * sizeof (char *));
} }
if (cs->type == filename) if (cs->type == filename)
sl->list[sl->idx++] = expand_command_line_file (optarg); sl->list[sl->idx++] = expand_command_line_file (coptarg);
else else
sl->list[sl->idx++] = optarg; sl->list[sl->idx++] = xstrdup (coptarg);
sl->list[sl->idx] = 0; sl->list[sl->idx] = 0;
break; break;
case positive_int: case positive_int:
/* See if we have an option argument; if we do require that /* See if we have an option argument; if we do require that
it's all digits, not something like "10foo". */ it's all digits, not something like "10foo". */
if (optarg == 0 && argc > optind) if (coptarg == 0 && argc > optind)
{ {
const char *cp; const char *cp;
for (cp=argv[optind]; ISDIGIT (cp[0]); ++cp) for (cp=argv[optind]; ISDIGIT (cp[0]); ++cp)
; ;
if (cp[0] == '\0') if (cp[0] == '\0')
optarg = argv[optind++]; coptarg = argv[optind++];
} }
if (!doit) if (!doit)
break; break;
if (optarg != 0) if (coptarg)
{ {
int i = atoi (optarg); int i = atoi (coptarg);
const char *cp; const char *cp;
/* Yes, I realize we're repeating this in some cases. */ /* Yes, I realize we're repeating this in some cases. */
for (cp = optarg; ISDIGIT (cp[0]); ++cp) for (cp = coptarg; ISDIGIT (cp[0]); ++cp)
; ;
if (i < 1 || cp[0] != '\0') if (i < 1 || cp[0] != '\0')
{ {
error (NILF, _("the '-%c' option requires a positive integer argument"), error (NILF, 0,
_("the '-%c' option requires a positive integer argument"),
cs->c); cs->c);
bad = 1; bad = 1;
} }
@@ -2875,13 +2882,13 @@ decode_switches (int argc, char **argv, int env)
#ifndef NO_FLOAT #ifndef NO_FLOAT
case floating: case floating:
if (optarg == 0 && optind < argc if (coptarg == 0 && optind < argc
&& (ISDIGIT (argv[optind][0]) || argv[optind][0] == '.')) && (ISDIGIT (argv[optind][0]) || argv[optind][0] == '.'))
optarg = argv[optind++]; coptarg = argv[optind++];
if (doit) if (doit)
*(double *) cs->value_ptr *(double *) cs->value_ptr
= (optarg != 0 ? atof (optarg) = (coptarg != 0 ? atof (coptarg)
: *(double *) cs->noarg_value); : *(double *) cs->noarg_value);
break; break;
@@ -2903,7 +2910,7 @@ decode_switches (int argc, char **argv, int env)
if (!env && (bad || print_usage_flag)) if (!env && (bad || print_usage_flag))
{ {
print_usage (bad); print_usage (bad);
die (bad ? 2 : 0); die (bad ? MAKE_FAILURE : MAKE_SUCCESS);
} }
/* If there are any options that need to be decoded do it now. */ /* If there are any options that need to be decoded do it now. */
@@ -2917,12 +2924,12 @@ decode_switches (int argc, char **argv, int env)
decode_switches. */ decode_switches. */
static void static void
decode_env_switches (char *envar, unsigned int len) decode_env_switches (const char *envar, unsigned int len)
{ {
char *varref = alloca (2 + len + 2); char *varref = alloca (2 + len + 2);
char *value, *p; char *value, *p, *buf;
int argc; int argc;
char **argv; const char **argv;
/* Get the variable's value. */ /* Get the variable's value. */
varref[0] = '$'; varref[0] = '$';
@@ -2941,15 +2948,16 @@ decode_env_switches (char *envar, unsigned int len)
/* Allocate a vector that is definitely big enough. */ /* Allocate a vector that is definitely big enough. */
argv = alloca ((1 + len + 1) * sizeof (char *)); argv = alloca ((1 + len + 1) * sizeof (char *));
/* Allocate a buffer to copy the value into while we split it into words
and unquote it. We must use permanent storage for this because
decode_switches may store pointers into the passed argument words. */
p = xmalloc (2 * len);
/* getopt will look at the arguments starting at ARGV[1]. /* getopt will look at the arguments starting at ARGV[1].
Prepend a spacer word. */ Prepend a spacer word. */
argv[0] = 0; argv[0] = 0;
argc = 1; argc = 1;
/* We need a buffer to copy the value into while we split it into words
and unquote it. Set up in case we need to prepend a dash later. */
buf = alloca (1 + len + 1);
buf[0] = '-';
p = buf+1;
argv[argc] = p; argv[argc] = p;
while (*value != '\0') while (*value != '\0')
{ {
@@ -2969,13 +2977,12 @@ decode_env_switches (char *envar, unsigned int len)
} }
*p = '\0'; *p = '\0';
argv[++argc] = 0; argv[++argc] = 0;
assert (p < buf + len + 2);
if (argv[1][0] != '-' && strchr (argv[1], '=') == 0) if (argv[1][0] != '-' && strchr (argv[1], '=') == 0)
/* The first word doesn't start with a dash and isn't a variable /* The first word doesn't start with a dash and isn't a variable
definition. Add a dash and pass it along to decode_switches. We definition, so add a dash. */
need permanent storage for this in case decode_switches saves argv[1] = buf;
pointers into the value. */
argv[1] = xstrdup (concat (2, "-", argv[1]));
/* Parse those words. */ /* Parse those words. */
decode_switches (argc, argv, 1); decode_switches (argc, argv, 1);
@@ -3109,8 +3116,17 @@ define_makeflags (int all, int makefile)
break; break;
#endif #endif
case filename:
case string: case string:
if (all)
{
p = *((char **)cs->value_ptr);
if (p)
ADD_FLAG (p, strlen (p));
}
break;
case filename:
case strlist:
if (all) if (all)
{ {
struct stringlist *sl = *(struct stringlist **) cs->value_ptr; struct stringlist *sl = *(struct stringlist **) cs->value_ptr;
@@ -3241,7 +3257,7 @@ print_version (void)
{ {
static int printed_version = 0; static int printed_version = 0;
char *precede = print_data_base_flag ? "# " : ""; const char *precede = print_data_base_flag ? "# " : "";
if (printed_version) if (printed_version)
/* Do it only once. */ /* Do it only once. */
@@ -3260,7 +3276,7 @@ print_version (void)
year, and none of the rest of it should be translated (including the year, and none of the rest of it should be translated (including the
word "Copyright"), so it hardly seems worth it. */ word "Copyright"), so it hardly seems worth it. */
printf ("%sCopyright (C) 1988-2013 Free Software Foundation, Inc.\n", printf ("%sCopyright (C) 1988-2014 Free Software Foundation, Inc.\n",
precede); precede);
printf (_("%sLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\ printf (_("%sLicense GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>\n\
@@ -3314,9 +3330,9 @@ clean_jobserver (int status)
#endif #endif
{ {
if (status != 2) if (status != 2)
error (NILF, ON (error, NILF,
"INTERNAL: Exiting with %u jobserver tokens (should be 0)!", "INTERNAL: Exiting with %u jobserver tokens (should be 0)!",
jobserver_tokens); jobserver_tokens);
else else
/* Don't write back the "free" token */ /* Don't write back the "free" token */
while (--jobserver_tokens) while (--jobserver_tokens)
@@ -3354,9 +3370,9 @@ clean_jobserver (int status)
#endif #endif
if (tcnt != master_job_slots) if (tcnt != master_job_slots)
error (NILF, ONN (error, NILF,
"INTERNAL: Exiting with %u jobserver tokens available; should be %u!", "INTERNAL: Exiting with %u jobserver tokens available; should be %u!",
tcnt, master_job_slots); tcnt, master_job_slots);
#ifdef WINDOWS32 #ifdef WINDOWS32
free_jobserver_semaphore (); free_jobserver_semaphore ();
@@ -3368,13 +3384,8 @@ clean_jobserver (int status)
sub-makes. Also reset job_slots since it will be put on the command sub-makes. Also reset job_slots since it will be put on the command
line, not in MAKEFLAGS. */ line, not in MAKEFLAGS. */
job_slots = default_job_slots; job_slots = default_job_slots;
if (jobserver_fds) free (jobserver_fds);
{ jobserver_fds = 0;
/* MSVC erroneously warns without a cast here. */
free ((void *)jobserver_fds->list);
free (jobserver_fds);
jobserver_fds = 0;
}
} }
} }
@@ -3415,9 +3426,14 @@ die (int status)
if (output_context) if (output_context)
{ {
assert (output_context == &make_sync); /* die() might be called in a recipe output context due to an
$(error ...) function. */
output_close (output_context);
if (output_context != &make_sync)
output_close (&make_sync);
OUTPUT_UNSET (); OUTPUT_UNSET ();
output_close (&make_sync);
} }
output_close (NULL); output_close (NULL);

View File

@@ -2,10 +2,25 @@
# 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. # tree, not a dist copy.
BUGLIST := bug-make@gnu.org
# These are related to my personal setup.
GPG_FINGERPRINT := 6338B6D4 GPG_FINGERPRINT := 6338B6D4
# SRCROOTDIR is just a handy location to keep source files in
SRCROOTDIR ?= $(HOME)/src
# Where the gnulib project has been locally cloned
GNULIBDIR ?= $(SRCROOTDIR)/gnulib
# 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
MAKEWEBDIR ?= $(SRCROOTDIR)/make/make-web
# We like mondo-warnings! # We like mondo-warnings!
AM_CFLAGS += -Wall -Wextra -Wdeclaration-after-statement -Wshadow -Wpointer-arith -Wbad-function-cast AM_CFLAGS += -Wall -Wwrite-strings -Wextra -Wdeclaration-after-statement -Wshadow -Wpointer-arith -Wbad-function-cast
MAKE_MAINTAINER_MODE := -DMAKE_MAINTAINER_MODE MAKE_MAINTAINER_MODE := -DMAKE_MAINTAINER_MODE
AM_CPPFLAGS += $(MAKE_MAINTAINER_MODE) AM_CPPFLAGS += $(MAKE_MAINTAINER_MODE)
@@ -99,23 +114,40 @@ git-very-clean: git-clean
-$(GIT) clean -fd -$(GIT) clean -fd
# ----------------------------------------------------------------------
# ## ---------------------- ##
# The sections below were stolen from the Makefile.maint used by fileutils, ## Generating ChangeLog. ##
# sh-utils, textutils, CPPI, Bison, and Autoconf. ## ---------------------- ##
gl2cl-date := 2013-10-10
gl2cl := $(GNULIBDIR)/build-aux/gitlog-to-changelog
# Rebuild the changelog whenever a new commit is added
ChangeLog: .check-git-HEAD
if test -f '$(gl2cl)'; then \
'$(gl2cl)' --since='$(gl2cl-date)' > '$@'; \
else \
echo "WARNING: $(gl2cl) is not available. No $@ generated."; \
fi
.PHONY: .check-git-HEAD
.check-git-HEAD:
sha="`git rev-parse HEAD`"; \
[ -f '$@' ] && [ "`cat '$@' 2>/dev/null`" = "$$sha" ] \
|| echo "$$sha" > '$@'
## ---------------- ## ## ---------------- ##
## Updating files. ## ## Updating files. ##
## ---------------- ## ## ---------------- ##
WGET = wget --passive-ftp -nv WGET = wget --passive-ftp -np -nv
ftp-gnu = ftp://ftp.gnu.org/gnu ftp-gnu = ftp://ftp.gnu.org/gnu
move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \ move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
echo $(target) is unchanged; rm -f $(target).t; \ echo $(target) is unchanged; rm -f $(target).t; \
else \ else \
mv $(target).t $(target); \ mv -f $(target).t $(target); \
fi fi
# ------------------- # # ------------------- #
@@ -127,8 +159,7 @@ move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
# http://translation.sf.net/maint/ # http://translation.sf.net/maint/
# ftp://tiger.informatik.hu-berlin.de/pub/po/maint/ # ftp://tiger.informatik.hu-berlin.de/pub/po/maint/
po_wget_flags = --recursive --level=1 --no-directories --no-parent \ po_wget_flags = --recursive --level=1 --no-directories --no-check-certificate
--no-check-certificate
po_repo = http://translationproject.org/latest/$(PACKAGE) po_repo = http://translationproject.org/latest/$(PACKAGE)
.PHONY: do-po-update po-update .PHONY: do-po-update po-update
do-po-update: do-po-update:
@@ -137,7 +168,8 @@ do-po-update:
&& mkdir "$$tmppo" \ && mkdir "$$tmppo" \
&& (cd "$$tmppo" \ && (cd "$$tmppo" \
&& $(WGET) $(po_wget_flags) -A '*.po' $(po_repo)) \ && $(WGET) $(po_wget_flags) -A '*.po' $(po_repo)) \
&& cp "$$tmppo"/*.po $(top_srcdir)/po && rm -rf "$$tmppo" && cp "$$tmppo"/*.po $(top_srcdir)/po \
&& rm -rf "$$tmppo"
cd po && $(MAKE) update-po cd po && $(MAKE) update-po
$(MAKE) po-check $(MAKE) po-check
@@ -198,20 +230,22 @@ check-alt-config: \
checkcfg.CPPFLAGS^-DNO_OUTPUT_SYNC \ checkcfg.CPPFLAGS^-DNO_OUTPUT_SYNC \
checkcfg.CPPFLAGS^-DNO_ARCHIVES checkcfg.CPPFLAGS^-DNO_ARCHIVES
NR_MAKE = $(MAKE)
# Check builds both with build.sh and with make
checkcfg.%: distdir checkcfg.%: distdir
@ rm -rf $(distdir)/_build \ @( rm -rf $(distdir)/_build \
&& mkdir $(distdir)/_build \ && mkdir $(distdir)/_build \
&& cd $(distdir)/_build \ && cd $(distdir)/_build \
&& echo "Testing configure with $(subst ^,=,$*)" \ && echo "Testing configure with $(subst ^,=,$*)" \
&& ../configure --srcdir=.. $(subst ^,=,$*) \ && ../configure --srcdir=.. $(subst ^,=,$*) \
$(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS) \ $(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS) \
CFLAGS='$(AM_CFLAGS)' \ CFLAGS='$(AM_CFLAGS)' \
&& $(MAKE) $(AM_MAKEFLAGS) \ && ./build.sh \
&& $(MAKE) $(AM_MAKEFLAGS) check && ./make $(AM_MAKEFLAGS) check \
&& rm -f *.o make \
&& $(NR_MAKE) $(AM_MAKEFLAGS) \
.PHONY: update && ./make $(AM_MAKEFLAGS) check ) 2>&1 | tee checkcfg.$*.log
update: po-update scm-update
## --------------- ## ## --------------- ##
@@ -221,6 +255,8 @@ update: po-update scm-update
# Before we build a distribution be sure we run our local checks # Before we build a distribution be sure we run our local checks
#distdir: local-check #distdir: local-check
.PHONY: local-check po-check changelog-check
# Checks that don't require Git. Run 'changelog-check' last as # Checks that don't require Git. Run 'changelog-check' last as
# previous test may reveal problems requiring new ChangeLog entries. # previous test may reveal problems requiring new ChangeLog entries.
local-check: po-check changelog-check local-check: po-check changelog-check
@@ -245,10 +281,54 @@ po-check:
rm -f $@-1 $@-2; \ rm -f $@-1 $@-2; \
fi fi
## --------------- ##
## Generate docs. ##
## --------------- ##
.PHONY: update-makeweb gendocs
CVS = cvs
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.
update-makeweb:
[ -d '$(MAKEWEBDIR)' ] || mkdir -p '$(MAKEWEBDIR)'
[ -d '$(MAKEWEBDIR)'/CVS ] \
&& { cd '$(MAKEWEBDIR)' && $(CVS) update; } \
|| { mkdir -p '$(dir $(MAKEWEBDIR))' && cd '$(dir $(MAKEWEBDIR))' \
&& $(CVS) -d $(makeweb-repo) co -d '$(notdir $(MAKEWEBDIR))' make; }
# Get the GNU web page boilerplate etc.
update-gnuweb:
[ -d '$(GNUWEBDIR)' ] || mkdir -p '$(GNUWEBDIR)'
[ -d '$(GNUWEBDIR)/$(gnuweb-dir)'/CVS ] \
&& { cd '$(GNUWEBDIR)/$(gnuweb-dir)' && $(CVS) update; } \
|| { cd '$(GNUWEBDIR)' && $(CVS) -d $(gnuweb-repo) co '$(gnuweb-dir)'; }
gendocs: update-gnuweb update-makeweb
cp $(GNULIBDIR)/doc/gendocs_template doc
cd doc \
&& rm -rf doc/manual \
&& $(GNULIBDIR)/build-aux/gendocs.sh --email '$(BUGLIST)' \
make 'GNU Make Manual'
find '$(MAKEWEBDIR)'/manual \( -name CVS -prune \) -o \( -name '[!.]*' -type f -exec rm -f '{}' \; \)
cp -r doc/manual '$(MAKEWEBDIR)'
@echo 'Status of $(MAKEWEBDIR) repo:' && cd '$(MAKEWEBDIR)' \
&& cvs -q -n update | grep -v '^M ' \
&& echo '- cvs add <new files>' \
&& echo '- cvs remove <deleted files>' \
&& echo '- cvs commit' \
&& echo '- cvs tag make-$(subst .,-,$(VERSION))'
## ------------------------- ## ## ------------------------- ##
## Make release targets. ## ## Make release targets. ##
## ------------------------- ## ## ------------------------- ##
.PHONY: tag-release
tag-release: tag-release:
case '$(VERSION)' in \ case '$(VERSION)' in \
(*.*.9*) message=" candidate" ;; \ (*.*.9*) message=" candidate" ;; \
@@ -302,7 +382,7 @@ $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
$(FTPPUT) "$(gnu-upload-host)" "$(gnu-upload-dir)/$(@:upload-%=%)" $^ $(FTPPUT) "$(gnu-upload-host)" "$(gnu-upload-dir)/$(@:upload-%=%)" $^
# Copyright (C) 1997-2013 Free Software Foundation, Inc. # Copyright (C) 1997-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under

2
make.1
View File

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

View File

@@ -154,11 +154,11 @@
<File <File
RelativePath=".\getopt1.c"> RelativePath=".\getopt1.c">
</File> </File>
<!--
<File <File
RelativePath=".\guile.c"> RelativePath=".\guile.c">
</File> </File>
-->
<File <File
RelativePath=".\hash.c"> RelativePath=".\hash.c">
</File> </File>

View File

@@ -1,8 +1,7 @@
$! $!
$! Makefile.com - builds GNU Make for VMS $! Makefile.com - builds GNU Make for VMS
$! $!
$! P1 is non-empty if you want to link with the VAXCRTL library instead $! P1 = LIST will provide compiler listings.
$! of the shareable executable
$! P2 = DEBUG will build an image with debug information $! P2 = DEBUG will build an image with debug information
$! P3 = WALL will enable all warning messages (some are suppressed since $! P3 = WALL will enable all warning messages (some are suppressed since
$! one macro intentionally causes an error condition) $! one macro intentionally causes an error condition)
@@ -50,6 +49,12 @@ $ endif
$ endif $ endif
$ endif $ endif
$! $!
$!
$ if (p1 .eqs. "LIST")
$ then
$ ccopt = ccopt + "/list/show=(expan,inclu)"
$ endif
$!
$! Should we build a debug image $! Should we build a debug image
$! $!
$ if (p2.eqs."DEBUG") $ if (p2.eqs."DEBUG")
@@ -67,9 +72,11 @@ $ then
$ gosub check_cc_qual $ gosub check_cc_qual
$ endif $ endif
$ filelist = "alloca ar arscan commands default dir expand file function " + - $ filelist = "alloca ar arscan commands default dir expand file function " + -
"hash implicit job load main misc read remake remote-stub rule " + - "guile hash implicit job load main misc read remake " + -
"output signame variable version vmsfunctions vmsify vpath " + - "remote-stub rule output signame variable version " + -
"vmsfunctions vmsify vpath " + -
"[.glob]glob [.glob]fnmatch getopt1 getopt strcache" "[.glob]glob [.glob]fnmatch getopt1 getopt strcache"
$!
$ copy config.h-vms config.h $ copy config.h-vms config.h
$ n=0 $ n=0
$ open/write optf make.opt $ open/write optf make.opt
@@ -77,18 +84,14 @@ $ loop:
$ cfile = f$elem(n," ",filelist) $ cfile = f$elem(n," ",filelist)
$ if cfile .eqs. " " then goto linkit $ if cfile .eqs. " " then goto linkit
$ write sys$output "Compiling ''cfile'..." $ write sys$output "Compiling ''cfile'..."
$ call compileit 'cfile' 'p1' $ call compileit 'cfile'
$ n = n + 1 $ n = n + 1
$ goto loop $ goto loop
$ linkit: $ linkit:
$ close optf $ close optf
$ if p1 .nes. "" then goto link_using_library
$ link/exe=make make.opt/opt'lopt $ link/exe=make make.opt/opt'lopt
$ goto cleanup $ goto cleanup
$ $
$ link_using_library:
$ link/exe=make make.opt/opt,sys$library:vaxcrtl/lib'lopt
$
$ cleanup: $ cleanup:
$ if f$trnlnm("SYS").nes."" then $ deassign sys $ if f$trnlnm("SYS").nes."" then $ deassign sys
$ if f$trnlnm("OPTF").nes."" then $ close optf $ if f$trnlnm("OPTF").nes."" then $ close optf
@@ -128,17 +131,22 @@ $!-----------------------------------------------------------------------------
$! $!
$ compileit : subroutine $ compileit : subroutine
$ ploc = f$locate("]",p1) $ ploc = f$locate("]",p1)
$ filnam = p1 $ if ploc .lt. f$length(p1)
$ if ploc .lt. f$length(p1) then filnam=f$extract(ploc+1,100,p1) $ then
$ write optf "''filnam'" $ objdir = f$extract(0, ploc+1, p1)
$ cc'ccopt'/include=([],[.glob]) - $ write optf p1
$ else
$ objdir := []
$ write optf objdir+p1
$ endif
$ cc'ccopt'/include=([],[.glob])/obj='objdir' -
/define=("allocated_variable_expand_for_file=alloc_var_expand_for_file","unlink=remove","HAVE_CONFIG_H","VMS") - /define=("allocated_variable_expand_for_file=alloc_var_expand_for_file","unlink=remove","HAVE_CONFIG_H","VMS") -
'p1' 'p1'
$ exit $ exit
$ endsubroutine : compileit $ endsubroutine : compileit
$! $!
$!----------------------------------------------------------------------------- $!-----------------------------------------------------------------------------
$!Copyright (C) 1996-2013 Free Software Foundation, Inc. $!Copyright (C) 1996-2014 Free Software Foundation, Inc.
$!This file is part of GNU Make. $!This file is part of GNU Make.
$! $!
$!GNU Make is free software; you can redistribute it and/or modify it under $!GNU Make is free software; you can redistribute it and/or modify it under

View File

@@ -1,6 +1,6 @@
# -*-Makefile-*- to build GNU make on VMS # -*-Makefile-*- to build GNU make on VMS
# #
# Copyright (C) 1996-2013 Free Software Foundation, Inc. # Copyright (C) 1996-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under
@@ -88,13 +88,13 @@ mandir = []
# Number to put on the man page filename. # Number to put on the man page filename.
manext = 1 manext = 1
#guile = ,guile.obj guile = ,guile.obj
objs = commands.obj,job.obj,output.obj,dir.obj,file.obj,misc.obj,hash.obj,\ objs = commands.obj,job.obj,output.obj,dir.obj,file.obj,misc.obj,hash.obj,\
load.obj,main.obj,read.obj,remake.obj,rule.obj,implicit.obj,\ load.obj,main.obj,read.obj,remake.obj,rule.obj,implicit.obj,\
default.obj,variable.obj,expand.obj,function.obj,strcache.obj,\ default.obj,variable.obj,expand.obj,function.obj,strcache.obj,\
vpath.obj,version.obj\ vpath.obj,version.obj$(guile)\
$(ARCHIVES)$(ALLOCA)$(extras)$(getopt)$(glob)$(guile) $(ARCHIVES)$(ALLOCA)$(extras)$(getopt)$(glob)
srcs = commands.c job.c output.c dir.c file.c misc.c guile.c hash.c \ srcs = commands.c job.c output.c dir.c file.c misc.c guile.c hash.c \
load.c main.c read.c remake.c rule.c implicit.c \ load.c main.c read.c remake.c rule.c implicit.c \
@@ -118,40 +118,56 @@ clean:
-$(RM) make.exe;,*.obj; -$(RM) make.exe;,*.obj;
-$(RM) [.glob]*.obj; -$(RM) [.glob]*.obj;
# Automatically generated dependencies. ar.obj: ar.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h dep.h \
# makeint.h: config.h gnumake.h gettext.h [.glob]fnmatch.h
# filedef.h: hash.h arscan.obj: arscan.c makeint.h config.h gnumake.h gettext.h
ar.obj: ar.c makeint.h filedef.h dep.h [.glob]fnmatch.h commands.obj: commands.c makeint.h config.h gnumake.h gettext.h filedef.h \
arscan.obj: arscan.c makeint.h hash.h dep.h variable.h job.h output.h commands.h
commands.obj: commands.c makeint.h dep.h commands.h filedef.h variable.h job.h default.obj: default.c makeint.h config.h gnumake.h gettext.h filedef.h \
default.obj: default.c makeint.h rule.h dep.h job.h filedef.h commands.h variable.h hash.h variable.h rule.h dep.h job.h output.h commands.h
dir.obj: dir.c makeint.h hash.h [.glob]glob.h dir.obj: dir.c makeint.h config.h gnumake.h gettext.h hash.h filedef.h \
expand.obj: expand.c makeint.h commands.h filedef.h job.h rule.h variable.h dep.h [.glob]glob.h
file.obj: file.c makeint.h commands.h dep.h filedef.h variable.h job.h debug.h expand.obj: expand.c makeint.h config.h gnumake.h gettext.h filedef.h \
function.obj: function.c makeint.h variable.h dep.h commands.h filedef.h debug.h job.h hash.h job.h output.h commands.h variable.h rule.h
getopt.obj: getopt.c getopt.h config.h gettext.h file.obj: file.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
getopt1.obj: getopt1.c getopt.h config.h dep.h job.h output.h commands.h variable.h debug.h
guile.obj: guile.c makeint.h debug.h dep.h gmk-default.h [.glob]fnmatch.obj: [.glob]fnmatch.c config.h [.glob]fnmatch.h
hash.obj: hash.c makeint.h hash.h function.obj: function.c makeint.h config.h gnumake.h gettext.h filedef.h \
implicit.obj: implicit.c makeint.h rule.h dep.h filedef.h debug.h variable.h job.h commands.h hash.h variable.h dep.h job.h output.h commands.h debug.h
job.obj: job.c vmsjobs.c makeint.h commands.h job.h filedef.h variable.h debug.h getopt.obj: getopt.c config.h gettext.h getopt.h
output.obj: output.c vmsjobs.c makeint.h output.h filedef.h debug.h getopt1.obj: getopt1.c config.h getopt.h
load.obj: load.c makeint.h debug.h filedef.h variable.h [.glob]glob.obj: [.glob]glob.c config.h [.glob]fnmatch.h [.glob]glob.h
main.obj: main.c makeint.h commands.h dep.h filedef.h variable.h job.h rule.h debug.h getopt.h guile.obj: guile.c makeint.h config.h gnumake.h gettext.h
misc.obj: misc.c makeint.h dep.h debug.h hash.obj: hash.c makeint.h config.h gnumake.h gettext.h hash.h
read.obj: read.c makeint.h commands.h dep.h filedef.h variable.h [.glob]glob.h debug.h rule.h job.h implicit.obj: implicit.c makeint.h config.h gnumake.h gettext.h filedef.h \
remake.obj: remake.c makeint.h commands.h job.h dep.h filedef.h variable.h debug.h hash.h rule.h dep.h debug.h variable.h job.h output.h commands.h
remote-stub.obj: remote-stub.c makeint.h filedef.h job.h commands.h job.obj: job.c makeint.h config.h gnumake.h gettext.h job.h output.h debug.h \
rule.obj: rule.c makeint.h commands.h dep.h filedef.h variable.h rule.h job.h filedef.h hash.h commands.h variable.h debug.h vmsjobs.c
signame.obj: signame.c makeint.h load.obj: load.c makeint.h config.h gnumake.h gettext.h
strcache.obj: strcache.c makeint.h hash.h main.obj: main.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
variable.obj: variable.c makeint.h commands.h variable.h dep.h filedef.h job.h rule.h dep.h variable.h job.h output.h commands.h rule.h debug.h getopt.h
misc.obj: misc.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
dep.h debug.h
output.obj: output.c makeint.h config.h gnumake.h gettext.h job.h output.h
read.obj: read.c makeint.h config.h gnumake.h gettext.h [.glob]glob.h \
filedef.h hash.h dep.h job.h output.h commands.h variable.h rule.h \
debug.h
remake.obj: remake.c makeint.h config.h gnumake.h gettext.h filedef.h \
hash.h job.h output.h commands.h dep.h variable.h debug.h
remote-stub.obj: remote-stub.c makeint.h config.h gnumake.h gettext.h \
filedef.h hash.h job.h output.h commands.h
rule.obj: rule.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
dep.h job.h output.h commands.h variable.h rule.h
signame.obj: signame.c makeint.h config.h gnumake.h gettext.h
strcache.obj: strcache.c makeint.h config.h gnumake.h gettext.h hash.h
variable.obj: variable.c makeint.h config.h gnumake.h gettext.h filedef.h \
hash.h dep.h job.h output.h commands.h variable.h rule.h
version.obj: version.c config.h version.obj: version.c config.h
vmsfunctions.obj: vmsfunctions.c makeint.h vmsdir.h debug.h job.h vmsfunctions.obj: vmsfunctions.c makeint.h config.h gnumake.h gettext.h \
debug.h job.h output.h vmsdir.h
vmsify.obj: vmsify.c vmsify.obj: vmsify.c
vpath.obj: vpath.c makeint.h filedef.h variable.h vpath.obj: vpath.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
[.glob]fnmatch.obj: [.glob]fnmatch.c [.glob]fnmatch.h config.h variable.h
[.glob]glob.obj: [.glob]glob.c [.glob]glob.h [.glob]fnmatch.h config.h
config.h: config.h-vms config.h: config.h-vms
$(CP) $< $@ $(CP) $< $@

View File

@@ -1,5 +1,5 @@
/* Miscellaneous global declarations and portability cruft for GNU Make. /* Miscellaneous global declarations and portability cruft for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -173,9 +173,6 @@ unsigned int get_path_max (void);
(! INTEGER_TYPE_SIGNED (t) ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1)) (! INTEGER_TYPE_SIGNED (t) ? (t) 0 : ~ (t) 0 << (sizeof (t) * CHAR_BIT - 1))
#define INTEGER_TYPE_MAXIMUM(t) (~ (t) 0 - INTEGER_TYPE_MINIMUM (t)) #define INTEGER_TYPE_MAXIMUM(t) (~ (t) 0 - INTEGER_TYPE_MINIMUM (t))
/* The maximum number of digits needed to represent the largest integer. */
#define INTEGER_LENGTH sizeof("18446744073709551616")
#ifndef CHAR_MAX #ifndef CHAR_MAX
# define CHAR_MAX INTEGER_TYPE_MAXIMUM (char) # define CHAR_MAX INTEGER_TYPE_MAXIMUM (char)
#endif #endif
@@ -353,8 +350,8 @@ char *strsignal (int signum);
# include <malloc.h> # include <malloc.h>
# define pipe(_p) _pipe((_p), 512, O_BINARY) # define pipe(_p) _pipe((_p), 512, O_BINARY)
# define kill(_pid,_sig) w32_kill((_pid),(_sig)) # define kill(_pid,_sig) w32_kill((_pid),(_sig))
/* MSVC doesn't have ftruncate. */ /* MSVC and Watcom C don't have ftruncate. */
# ifdef _MSC_VER # if defined(_MSC_VER) || defined(__WATCOMC__)
# define ftruncate(_fd,_len) _chsize(_fd,_len) # define ftruncate(_fd,_len) _chsize(_fd,_len)
# endif # endif
/* MinGW64 doesn't have _S_ISDIR. */ /* MinGW64 doesn't have _S_ISDIR. */
@@ -400,8 +397,8 @@ extern int unixy_shell;
#define MAP_USERFUNC 0x2000 #define MAP_USERFUNC 0x2000
/* This means not only a '$', but skip the variable reference. */ /* This means not only a '$', but skip the variable reference. */
#define MAP_VARIABLE 0x4000 #define MAP_VARIABLE 0x4000
/* The set of characters which are path separators is OS-specific. */ /* The set of characters which are directory separators is OS-specific. */
#define MAP_PATHSEP 0x8000 #define MAP_DIRSEP 0x8000
#ifdef VMS #ifdef VMS
# define MAP_VMSCOMMA MAP_COMMA # define MAP_VMSCOMMA MAP_COMMA
@@ -409,7 +406,7 @@ extern int unixy_shell;
# define MAP_VMSCOMMA 0x0000 # define MAP_VMSCOMMA 0x0000
#endif #endif
#define STOP_SET(_v,_m) ANY_SET (stopchar_map[(int)(_v)],(_m)) #define STOP_SET(_v,_m) ANY_SET (stopchar_map[(unsigned char)(_v)],(_m))
#if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) #if defined(HAVE_SYS_RESOURCE_H) && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT)
# define SET_STACK_SIZE # define SET_STACK_SIZE
@@ -421,17 +418,42 @@ extern struct rlimit stack_limit;
#define NILF ((gmk_floc *)0) #define NILF ((gmk_floc *)0)
#define CSTRLEN(_s) (sizeof (_s)-1) #define CSTRLEN(_s) (sizeof (_s)-1)
#define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s) #define STRING_SIZE_TUPLE(_s) (_s), CSTRLEN(_s)
/* The number of bytes needed to represent the largest integer as a string. */
#define INTSTR_LENGTH CSTRLEN ("18446744073709551616")
#ifdef HAVE_TTYNAME
# define TTYNAME(_f) ttyname (_f)
#else
# define TTYNAME(_f) "true"
#endif
const char *concat (unsigned int, ...); const char *concat (unsigned int, ...);
void message (int prefix, const char *fmt, ...) void message (int prefix, size_t length, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3))); __attribute__ ((__format__ (__printf__, 3, 4)));
void error (const gmk_floc *flocp, const char *fmt, ...) void error (const gmk_floc *flocp, size_t length, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3))); __attribute__ ((__format__ (__printf__, 3, 4)));
void fatal (const gmk_floc *flocp, const char *fmt, ...) void fatal (const gmk_floc *flocp, size_t length, const char *fmt, ...)
__attribute__ ((noreturn, __format__ (__printf__, 2, 3))); __attribute__ ((noreturn, __format__ (__printf__, 3, 4)));
#define O(_t,_a,_f) _t((_a), 0, (_f))
#define OS(_t,_a,_f,_s) _t((_a), strlen (_s), (_f), (_s))
#define OSS(_t,_a,_f,_s1,_s2) _t((_a), strlen (_s1) + strlen (_s2), \
(_f), (_s1), (_s2))
#define OSSS(_t,_a,_f,_s1,_s2,_s3) _t((_a), strlen (_s1) + strlen (_s2) + strlen (_s3), \
(_f), (_s1), (_s2), (_s3))
#define ON(_t,_a,_f,_n) _t((_a), INTSTR_LENGTH, (_f), (_n))
#define ONN(_t,_a,_f,_n1,_n2) _t((_a), INTSTR_LENGTH*2, (_f), (_n1), (_n2))
#define OSN(_t,_a,_f,_s,_n) _t((_a), strlen (_s) + INTSTR_LENGTH, \
(_f), (_s), (_n))
#define ONS(_t,_a,_f,_n,_s) _t((_a), INTSTR_LENGTH + strlen (_s), \
(_f), (_n), (_s))
#define OUT_OF_MEM() O (fatal, NILF, _("virtual memory exhausted"))
void die (int) __attribute__ ((noreturn)); void die (int) __attribute__ ((noreturn));
void pfatal_with_name (const char *) __attribute__ ((noreturn)); void pfatal_with_name (const char *) __attribute__ ((noreturn));
@@ -506,9 +528,7 @@ const char *strcache_add_len (const char *str, unsigned int len);
int strcache_setbufsize (unsigned int size); int strcache_setbufsize (unsigned int size);
/* Guile support */ /* Guile support */
#ifdef HAVE_GUILE
int guile_gmake_setup (const gmk_floc *flocp); int guile_gmake_setup (const gmk_floc *flocp);
#endif
/* Loadable object support. Sets to the strcached name of the loaded file. */ /* Loadable object support. Sets to the strcached name of the loaded file. */
typedef int (*load_func_t)(const gmk_floc *flocp); typedef int (*load_func_t)(const gmk_floc *flocp);
@@ -595,7 +615,17 @@ extern double max_load_average;
extern int max_load_average; extern int max_load_average;
#endif #endif
#ifdef WINDOWS32
extern char *program; extern char *program;
#else
extern const char *program;
#endif
#ifdef VMS
const char *vms_command(const char *argv0);
const char *vms_progname(const char *argv0);
#endif
extern char *starting_directory; extern char *starting_directory;
extern unsigned int makelevel; extern unsigned int makelevel;
extern char *version_string, *remote_description, *make_host; extern char *version_string, *remote_description, *make_host;
@@ -612,10 +642,14 @@ extern int handling_fatal_signal;
#define MAX(_a,_b) ((_a)>(_b)?(_a):(_b)) #define MAX(_a,_b) ((_a)>(_b)?(_a):(_b))
#endif #endif
#ifdef VMS #ifdef VMS
# define MAKE_SUCCESS 1 /* These are the VMS __posix_exit compliant exit codes, constructed out of
# define MAKE_TROUBLE 2 STS$M_INHIB_MSG, C facility code, a POSIX condition code mask, MAKE_NNN<<3 and
# define MAKE_FAILURE 3 the coresponding VMS severity, here STS$K_SUCCESS and STS$K_ERROR. */
# define MAKE_SUCCESS 0x1035a001
# define MAKE_TROUBLE 0x1035a00a
# define MAKE_FAILURE 0x1035a012
#else #else
# define MAKE_SUCCESS 0 # define MAKE_SUCCESS 0
# define MAKE_TROUBLE 1 # define MAKE_TROUBLE 1

12
misc.c
View File

@@ -1,5 +1,5 @@
/* Miscellaneous generic support functions for GNU Make. /* Miscellaneous generic support functions for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -219,7 +219,7 @@ xmalloc (unsigned int size)
/* Make sure we don't allocate 0, for pre-ISO implementations. */ /* Make sure we don't allocate 0, for pre-ISO implementations. */
void *result = malloc (size ? size : 1); void *result = malloc (size ? size : 1);
if (result == 0) if (result == 0)
fatal (NILF, _("virtual memory exhausted")); OUT_OF_MEM();
return result; return result;
} }
@@ -230,7 +230,7 @@ xcalloc (unsigned int size)
/* Make sure we don't allocate 0, for pre-ISO implementations. */ /* Make sure we don't allocate 0, for pre-ISO implementations. */
void *result = calloc (size ? size : 1, 1); void *result = calloc (size ? size : 1, 1);
if (result == 0) if (result == 0)
fatal (NILF, _("virtual memory exhausted")); OUT_OF_MEM();
return result; return result;
} }
@@ -245,7 +245,7 @@ xrealloc (void *ptr, unsigned int size)
size = 1; size = 1;
result = ptr ? realloc (ptr, size) : malloc (size); result = ptr ? realloc (ptr, size) : malloc (size);
if (result == 0) if (result == 0)
fatal (NILF, _("virtual memory exhausted")); OUT_OF_MEM();
return result; return result;
} }
@@ -262,7 +262,7 @@ xstrdup (const char *ptr)
#endif #endif
if (result == 0) if (result == 0)
fatal (NILF, _("virtual memory exhausted")); OUT_OF_MEM();
#ifdef HAVE_STRDUP #ifdef HAVE_STRDUP
return result; return result;
@@ -281,7 +281,7 @@ xstrndup (const char *str, unsigned int length)
#ifdef HAVE_STRNDUP #ifdef HAVE_STRNDUP
result = strndup (str, length); result = strndup (str, length);
if (result == 0) if (result == 0)
fatal (NILF, _("virtual memory exhausted")); OUT_OF_MEM();
#else #else
result = xmalloc (length + 1); result = xmalloc (length + 1);
if (length > 0) if (length > 0)

165
output.c
View File

@@ -1,5 +1,5 @@
/* Output to stdout / stderr for GNU make /* Output to stdout / stderr for GNU make
Copyright (C) 2013 Free Software Foundation, Inc. Copyright (C) 2013-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -47,33 +47,9 @@ unsigned int stdio_traced = 0;
#define OUTPUT_ISSET(_out) ((_out)->out >= 0 || (_out)->err >= 0) #define OUTPUT_ISSET(_out) ((_out)->out >= 0 || (_out)->err >= 0)
#ifdef HAVE_FCNTL #ifdef HAVE_FCNTL
# define STREAM_OK(_s) ((fcntl (fileno (_s), F_GETFD) != -1) || (errno != EBADF)) # define STREAM_OK(_s) ((fcntl (fileno (_s), F_GETFD) != -1) || (errno != EBADF))
#else #else
# define STREAM_OK(_s) 1 # define STREAM_OK(_s) 1
#endif
/* I really want to move to gnulib. However, this is a big undertaking
especially for non-UNIX platforms: how to get bootstrapping to work, etc.
I don't want to take the time to do it right now. Use a hack to get a
useful version of vsnprintf() for Windows. */
#ifdef __VMS
# define va_copy(_d, _s) ((_d) = (_s))
#endif
#ifdef _MSC_VER
# define va_copy(_d, _s) ((_d) = (_s))
# define snprintf msc_vsnprintf
static int
msc_vsnprintf (char *str, size_t size, const char *format, va_list ap)
{
int len = -1;
if (size > 0)
len = _vsnprintf_s (str, size, _TRUNCATE, format, ap);
if (len == -1)
len = _vscprintf (format, ap);
return len;
}
#endif #endif
/* Write a string to the current STDOUT or STDERR. */ /* Write a string to the current STDOUT or STDERR. */
@@ -117,7 +93,7 @@ log_working_directory (int entering)
char *p; char *p;
/* Get enough space for the longest possible output. */ /* Get enough space for the longest possible output. */
need = strlen (program) + INTEGER_LENGTH + 2 + 1; need = strlen (program) + INTSTR_LENGTH + 2 + 1;
if (starting_directory) if (starting_directory)
need += strlen (starting_directory); need += strlen (starting_directory);
@@ -264,7 +240,11 @@ pump_from_tmp (int from, FILE *to)
if (len <= 0) if (len <= 0)
break; break;
if (fwrite (buffer, len, 1, to) < 1) if (fwrite (buffer, len, 1, to) < 1)
perror ("fwrite()"); {
perror ("fwrite()");
break;
}
fflush (to);
} }
#ifdef WINDOWS32 #ifdef WINDOWS32
@@ -512,10 +492,10 @@ close_stdout (void)
if (prev_fail || fclose_fail) if (prev_fail || fclose_fail)
{ {
if (fclose_fail) if (fclose_fail)
error (NILF, _("write error: %s"), strerror (errno)); perror_with_name (_("write error: stdout"), "");
else else
error (NILF, _("write error")); O (error, NILF, _("write error: stdout"));
exit (EXIT_FAILURE); exit (MAKE_TROUBLE);
} }
} }
@@ -606,141 +586,120 @@ outputs (int is_err, const char *msg)
} }
/* Return formatted string buffers.
If we move to gnulib we can use vasnprintf() etc. to make this simpler.
Note these functions use a static buffer, so each call overwrites the
results of the previous call. */
static struct fmtstring static struct fmtstring
{ {
char *buffer; char *buffer;
unsigned int size; size_t size;
unsigned int len; } fmtbuf = { NULL, 0 };
} fmtbuf = { NULL, 0, 0 };
/* Concatenate a formatted string onto the format buffer. */ static char *
static const char * get_buffer (size_t need)
vfmtconcat (const char *fmt, va_list args)
{ {
va_list vcopy; /* Make sure we have room. NEED includes space for \0. */
int tot; if (need > fmtbuf.size)
int unused = fmtbuf.size - fmtbuf.len;
va_copy (vcopy, args);
tot = vsnprintf (&fmtbuf.buffer[fmtbuf.len], unused, fmt, args);
assert (tot >= 0);
if (tot >= unused)
{ {
fmtbuf.size += tot * 2; fmtbuf.size += need * 2;
fmtbuf.buffer = xrealloc (fmtbuf.buffer, fmtbuf.size); fmtbuf.buffer = xrealloc (fmtbuf.buffer, fmtbuf.size);
unused = fmtbuf.size - fmtbuf.len;
tot = vsnprintf (&fmtbuf.buffer[fmtbuf.len], unused, fmt, vcopy);
} }
va_end (vcopy); fmtbuf.buffer[need-1] = '\0';
fmtbuf.len += tot;
return fmtbuf.buffer; return fmtbuf.buffer;
} }
static const char *
fmtconcat (const char *fmt, ...)
{
const char *p;
va_list args;
va_start (args, fmt);
p = vfmtconcat (fmt, args);
va_end (args);
return p;
}
/* Print a message on stdout. */ /* Print a message on stdout. */
void void
message (int prefix, const char *fmt, ...) message (int prefix, size_t len, const char *fmt, ...)
{ {
va_list args; va_list args;
char *p;
assert (fmt != NULL); len += strlen (fmt) + strlen (program) + INTSTR_LENGTH + 4 + 1 + 1;
p = get_buffer (len);
fmtbuf.len = 0;
if (prefix) if (prefix)
{ {
if (makelevel == 0) if (makelevel == 0)
fmtconcat ("%s: ", program); sprintf (p, "%s: ", program);
else else
fmtconcat ("%s[%u]: ", program, makelevel); sprintf (p, "%s[%u]: ", program, makelevel);
p += strlen (p);
} }
va_start (args, fmt); va_start (args, fmt);
vfmtconcat (fmt, args); vsprintf (p, fmt, args);
va_end (args); va_end (args);
fmtconcat ("\n"); strcat (p, "\n");
assert (fmtbuf.buffer[len-1] == '\0');
outputs (0, fmtbuf.buffer); outputs (0, fmtbuf.buffer);
} }
/* Print an error message. */ /* Print an error message. */
void void
error (const gmk_floc *flocp, const char *fmt, ...) error (const gmk_floc *flocp, size_t len, const char *fmt, ...)
{ {
va_list args; va_list args;
char *p;
assert (fmt != NULL); len += (strlen (fmt) + strlen (program)
+ (flocp && flocp->filenm ? strlen (flocp->filenm) : 0)
fmtbuf.len = 0; + INTSTR_LENGTH + 4 + 1 + 1);
p = get_buffer (len);
if (flocp && flocp->filenm) if (flocp && flocp->filenm)
fmtconcat ("%s:%lu: ", flocp->filenm, flocp->lineno); sprintf (p, "%s:%lu: ", flocp->filenm, flocp->lineno);
else if (makelevel == 0) else if (makelevel == 0)
fmtconcat ("%s: ", program); sprintf (p, "%s: ", program);
else else
fmtconcat ("%s[%u]: ", program, makelevel); sprintf (p, "%s[%u]: ", program, makelevel);
p += strlen (p);
va_start (args, fmt); va_start (args, fmt);
vfmtconcat (fmt, args); vsprintf (p, fmt, args);
va_end (args); va_end (args);
fmtconcat ("\n"); strcat (p, "\n");
assert (fmtbuf.buffer[len-1] == '\0');
outputs (1, fmtbuf.buffer); outputs (1, fmtbuf.buffer);
} }
/* Print an error message and exit. */ /* Print an error message and exit. */
void void
fatal (const gmk_floc *flocp, const char *fmt, ...) fatal (const gmk_floc *flocp, size_t len, const char *fmt, ...)
{ {
va_list args; va_list args;
const char *stop = _(". Stop.\n");
char *p;
assert (fmt != NULL); len += (strlen (fmt) + strlen (program)
+ (flocp && flocp->filenm ? strlen (flocp->filenm) : 0)
fmtbuf.len = 0; + INTSTR_LENGTH + 8 + strlen (stop) + 1);
p = get_buffer (len);
if (flocp && flocp->filenm) if (flocp && flocp->filenm)
fmtconcat ("%s:%lu: *** ", flocp->filenm, flocp->lineno); sprintf (p, "%s:%lu: *** ", flocp->filenm, flocp->lineno);
else if (makelevel == 0) else if (makelevel == 0)
fmtconcat ("%s: *** ", program); sprintf (p, "%s: *** ", program);
else else
fmtconcat ("%s[%u]: *** ", program, makelevel); sprintf (p, "%s[%u]: *** ", program, makelevel);
p += strlen (p);
va_start (args, fmt); va_start (args, fmt);
vfmtconcat (fmt, args); vsprintf (p, fmt, args);
va_end (args); va_end (args);
fmtconcat (_(". Stop.\n")); strcat (p, stop);
assert (fmtbuf.buffer[len-1] == '\0');
outputs (1, fmtbuf.buffer); outputs (1, fmtbuf.buffer);
die (2); die (MAKE_FAILURE);
} }
/* Print an error message from errno. */ /* Print an error message from errno. */
@@ -748,7 +707,8 @@ fatal (const gmk_floc *flocp, const char *fmt, ...)
void void
perror_with_name (const char *str, const char *name) perror_with_name (const char *str, const char *name)
{ {
error (NILF, _("%s%s: %s"), str, name, strerror (errno)); const char *err = strerror (errno);
OSSS (error, NILF, _("%s%s: %s"), str, name, err);
} }
/* Print an error message from errno and exit. */ /* Print an error message from errno and exit. */
@@ -756,7 +716,8 @@ perror_with_name (const char *str, const char *name)
void void
pfatal_with_name (const char *name) pfatal_with_name (const char *name)
{ {
fatal (NILF, _("%s: %s"), name, strerror (errno)); const char *err = strerror (errno);
OSS (fatal, NILF, _("%s: %s"), name, err);
/* NOTREACHED */ /* NOTREACHED */
} }

View File

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

View File

@@ -1,93 +0,0 @@
2013-01-06 Paul Smith <psmith@gnu.org>
* POTFILES.in: Add new load.c file.
2012-01-12 Paul Smith <psmith@gnu.org>
* POTFILES.in: Add new guile.c file.
2011-09-26 Paul Smith <psmith@gnu.org>
* LINGUAS: Added new translation file for Czech (cs).
2009-09-16 Paul Smith <psmith@gnu.org>
* LINGUAS: Added new translation for Italian (it).
2008-05-17 Paul Smith <psmith@gnu.org>
* LINGUAS: Added new translation for Lithuanian (lt).
2007-08-15 Paul Smith <psmith@gnu.org>
* LINGUAS: The Kinyarwanda (rw) translation has disappeared from
the translation site, so remove it.
2006-01-28 Paul D. Smith <psmith@gnu.org>
* LINGUAS: Added new translation for Vietnamese (vi).
2005-07-14 Paul D. Smith <psmith@gnu.org>
* LINGUAS: Added new translation for Indonesian (id).
2005-05-09 Paul D. Smith <psmith@gnu.org>
* POTFILES.in: Add new file vmsjobs.c.
2005-04-06 Paul D. Smith <psmith@gnu.org>
* LINGUAS: Added a new translation for Kinywarwanda (rw).
2005-02-09 Paul D. Smith <psmith@gnu.org>
* LINGUAS: Added a new translation for Irish (ga).
2005-02-01 Paul D. Smith <psmith@gnu.org>
* LINGUAS: Added a new translation for Finnish (fi).
2003-10-18 Paul D. Smith <psmith@gnu.org>
* LINGUAS: Added a new translation for Belarusian (be).
2002-12-19 Paul D. Smith <psmith@gnu.org>
* LINGUAS: Added a new translation for Ukrainian (uk).
2002-10-05 Paul D. Smith <psmith@gnu.org>
* POTFILES.in: Add variable.h as it has a translatable string.
2002-08-08 Paul D. Smith <psmith@gnu.org>
* LINGUAS: Add a new translation for Chinese (simplified) (zh_CN).
2002-08-02 Paul D. Smith <psmith@gnu.org>
* LINGUAS: Add a new translation for Swedish (sv).
2002-04-21 Paul D. Smith <psmith@gnu.org>
* LINGUAS, hr.po: Added new translation: Croatian.
* da.po, de.po, es.po, fr.po, gl.po, he.po, ja.po, ko.po, nl.po,
pl.po, pt_BR.po, ru.po, tr.po: Moved from i18n to here.
* .cvsignore: Moved from i18n to here.
* POTFILES.in, LINGUAS, Makevars: Created.
Copyright (C) 2002-2013 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the
terms of the GNU General Public License as published by the Free Software
Foundation; either version 3 of the License, or (at your option) any later
version.
GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <http://www.gnu.org/licenses/>.

View File

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

View File

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

59
prepare_vms.com Normal file
View File

@@ -0,0 +1,59 @@
$!
$! prepare_vms.com - Build config.h-vms from master on VMS.
$!
$! This is used for building off the master instead of a release tarball.
$!
$!
$!
$! First try ODS-5, Pathworks V6 or UNZIP name.
$!
$ config_template = f$search("sys$disk:[]config*h-vms.template")
$ if config_template .eqs. ""
$ then
$!
$! Try NFS, VMStar, or Pathworks V5 ODS-2 encoded name.
$!
$ config_template = f$search("sys$disk:[]config.h-vms*template")
$ if config_template .eqs. ""
$ then
$ write sys$output "Could not find config.h-vms*template!"
$ exit 44
$ endif
$ endif
$ config_template_file = f$parse(config_template,,,"name")
$ config_template_type = f$parse(config_template,,,"type")
$ config_template = "sys$disk:[]" + config_template_file + config_template_type
$!
$!
$! Pull the package and version from configure.ac
$!
$ open/read ac_file sys$disk:[]configure.ac
$ac_read_loop:
$ read ac_file/end=ac_read_loop_end line_in
$ key = f$extract(0, 7, line_in)
$ if key .nes. "AC_INIT" then goto ac_read_loop
$ package = f$element (1,"[",line_in)
$ package = f$element (0,"]",package)
$ version = f$element (2,"[",line_in)
$ version = f$element (0,"]",version)
$ac_read_loop_end:
$ close ac_file
$!
$ if (package .eqs. "") .or. (version .eqs. "")
$ then
$ write sys$output "Unable to determine package and/or version!"
$ exit 44
$ endif
$!
$!
$ outfile = "sys$disk:[]config.h-vms"
$!
$! Note the pipe command is close to the length of 255, which is the
$! maximum token length prior to VMS V8.2:
$! %DCL-W-TKNOVF, command element is too long - shorten
$ pipe (write sys$output "sub/%PACKAGE%/''package'/WHOLE/NOTYPE" ;-
write sys$output "sub/%VERSION%/''version'/WHOLE/NOTYPE" ;-
write sys$output "exit") |-
edit/edt 'config_template'/out='outfile'/command=sys$pipe >nla0:
$!
$ write sys$output package, ", version: ", version, " prepared for VMS"

154
read.c
View File

@@ -1,5 +1,5 @@
/* Reading and parsing of makefiles for GNU Make. /* Reading and parsing of makefiles for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -238,7 +238,7 @@ read_all_makefiles (const char **makefiles)
if (num_makefiles == 0) if (num_makefiles == 0)
{ {
static char *default_makefiles[] = static const char *default_makefiles[] =
#ifdef VMS #ifdef VMS
/* all lower case since readdir() (the vms version) 'lowercasifies' */ /* all lower case since readdir() (the vms version) 'lowercasifies' */
{ "makefile.vms", "gnumakefile.", "makefile.", 0 }; { "makefile.vms", "gnumakefile.", "makefile.", 0 };
@@ -246,10 +246,14 @@ read_all_makefiles (const char **makefiles)
#ifdef _AMIGA #ifdef _AMIGA
{ "GNUmakefile", "Makefile", "SMakefile", 0 }; { "GNUmakefile", "Makefile", "SMakefile", 0 };
#else /* !Amiga && !VMS */ #else /* !Amiga && !VMS */
#ifdef WINDOWS32
{ "GNUmakefile", "makefile", "Makefile", "makefile.mak", 0 };
#else /* !Amiga && !VMS && !WINDOWS32 */
{ "GNUmakefile", "makefile", "Makefile", 0 }; { "GNUmakefile", "makefile", "Makefile", 0 };
#endif /* !Amiga && !VMS && !WINDOWS32 */
#endif /* AMIGA */ #endif /* AMIGA */
#endif /* VMS */ #endif /* VMS */
register char **p = default_makefiles; const char **p = default_makefiles;
while (*p != 0 && !file_exists_p (*p)) while (*p != 0 && !file_exists_p (*p))
++p; ++p;
@@ -307,10 +311,8 @@ static void
restore_conditionals (struct conditionals *saved) restore_conditionals (struct conditionals *saved)
{ {
/* Free any space allocated by conditional_line. */ /* Free any space allocated by conditional_line. */
if (conditionals->ignoring) free (conditionals->ignoring);
free (conditionals->ignoring); free (conditionals->seen_else);
if (conditionals->seen_else)
free (conditionals->seen_else);
/* Restore state. */ /* Restore state. */
conditionals = saved; conditionals = saved;
@@ -368,7 +370,10 @@ eval_makefile (const char *filename, int flags)
case ENFILE: case ENFILE:
#endif #endif
case ENOMEM: case ENOMEM:
fatal (reading_file, "%s", strerror (makefile_errno)); {
const char *err = strerror (makefile_errno);
OS (fatal, reading_file, "%s", err);
}
} }
/* If the makefile wasn't found and it's either a makefile from /* If the makefile wasn't found and it's either a makefile from
@@ -406,8 +411,7 @@ eval_makefile (const char *filename, int flags)
if (flags & RM_DONTCARE) if (flags & RM_DONTCARE)
deps->dontcare = 1; deps->dontcare = 1;
if (expanded) free (expanded);
free (expanded);
/* If the makefile can't be found at all, give up entirely. */ /* If the makefile can't be found at all, give up entirely. */
@@ -704,8 +708,7 @@ eval (struct ebuffer *ebuf, int set_default)
if (collapsed_length < linelen+1) if (collapsed_length < linelen+1)
{ {
collapsed_length = linelen+1; collapsed_length = linelen+1;
if (collapsed) free (collapsed);
free (collapsed);
/* Don't need xrealloc: we don't need to preserve the content. */ /* Don't need xrealloc: we don't need to preserve the content. */
collapsed = xmalloc (collapsed_length); collapsed = xmalloc (collapsed_length);
} }
@@ -783,7 +786,7 @@ eval (struct ebuffer *ebuf, int set_default)
if (i != -2) if (i != -2)
{ {
if (i == -1) if (i == -1)
fatal (fstart, _("invalid syntax in conditional")); O (fatal, fstart, _("invalid syntax in conditional"));
ignoring = i; ignoring = i;
continue; continue;
@@ -853,8 +856,7 @@ eval (struct ebuffer *ebuf, int set_default)
/* No pattern means remove all previous selective VPATH's. */ /* No pattern means remove all previous selective VPATH's. */
vpat = 0; vpat = 0;
construct_vpath_list (vpat, p); construct_vpath_list (vpat, p);
if (vpat != 0) free (vpat);
free (vpat);
continue; continue;
} }
@@ -912,7 +914,10 @@ eval (struct ebuffer *ebuf, int set_default)
| (noerror ? RM_DONTCARE : 0) | (noerror ? RM_DONTCARE : 0)
| (set_default ? 0 : RM_NO_DEFAULT_GOAL))); | (set_default ? 0 : RM_NO_DEFAULT_GOAL)));
if (!r && !noerror) if (!r && !noerror)
error (fstart, "%s: %s", name, strerror (errno)); {
const char *err = strerror (errno);
OSS (error, fstart, "%s: %s", name, err);
}
} }
/* Restore conditional state. */ /* Restore conditional state. */
@@ -958,7 +963,7 @@ eval (struct ebuffer *ebuf, int set_default)
/* Load the file. 0 means failure. */ /* Load the file. 0 means failure. */
r = load_file (&ebuf->floc, &name, noerror); r = load_file (&ebuf->floc, &name, noerror);
if (! r && ! noerror) if (! r && ! noerror)
fatal (&ebuf->floc, _("%s: failed to load"), name); OS (fatal, &ebuf->floc, _("%s: failed to load"), name);
free_ns (files); free_ns (files);
files = next; files = next;
@@ -984,7 +989,7 @@ eval (struct ebuffer *ebuf, int set_default)
was no preceding target, and the line might have been usable as a was no preceding target, and the line might have been usable as a
variable definition. But now we know it is definitely lossage. */ variable definition. But now we know it is definitely lossage. */
if (line[0] == cmd_prefix) if (line[0] == cmd_prefix)
fatal (fstart, _("recipe commences before first target")); O (fatal, fstart, _("recipe commences before first target"));
/* This line describes some target files. This is complicated by /* This line describes some target files. This is complicated by
the existence of target-specific variables, because we can't the existence of target-specific variables, because we can't
@@ -1033,7 +1038,7 @@ eval (struct ebuffer *ebuf, int set_default)
{ {
case w_eol: case w_eol:
if (cmdleft != 0) if (cmdleft != 0)
fatal (fstart, _("missing rule before recipe")); O (fatal, fstart, _("missing rule before recipe"));
/* This line contained something but turned out to be nothing /* This line contained something but turned out to be nothing
but whitespace (a comment?). */ but whitespace (a comment?). */
continue; continue;
@@ -1117,13 +1122,15 @@ eval (struct ebuffer *ebuf, int set_default)
it. If so, we can't parse this line so punt. */ it. If so, we can't parse this line so punt. */
if (wtype == w_eol) if (wtype == w_eol)
{ {
if (*p2 != '\0') if (*p2 == '\0')
/* There's no need to be ivory-tower about this: check for continue;
one of the most common bugs found in makefiles... */
fatal (fstart, _("missing separator%s"), /* There's no need to be ivory-tower about this: check for
(cmd_prefix == '\t' && !strneq (line, " ", 8)) one of the most common bugs found in makefiles... */
? "" : _(" (did you mean TAB instead of 8 spaces?)")); if (cmd_prefix == '\t' && strneq (line, " ", 8))
continue; O (fatal, fstart, _("missing separator (did you mean TAB instead of 8 spaces?)"));
else
O (fatal, fstart, _("missing separator"));
} }
/* Make the colon the end-of-string so we know where to stop /* Make the colon the end-of-string so we know where to stop
@@ -1260,13 +1267,13 @@ eval (struct ebuffer *ebuf, int set_default)
PARSEFS_NOGLOB); PARSEFS_NOGLOB);
++p2; ++p2;
if (target == 0) if (target == 0)
fatal (fstart, _("missing target pattern")); O (fatal, fstart, _("missing target pattern"));
else if (target->next != 0) else if (target->next != 0)
fatal (fstart, _("multiple target patterns")); O (fatal, fstart, _("multiple target patterns"));
pattern_percent = find_percent_cached (&target->name); pattern_percent = find_percent_cached (&target->name);
pattern = target->name; pattern = target->name;
if (pattern_percent == 0) if (pattern_percent == 0)
fatal (fstart, _("target pattern contains no '%%'")); O (fatal, fstart, _("target pattern contains no '%%'"));
free_ns (target); free_ns (target);
} }
else else
@@ -1388,13 +1395,12 @@ eval (struct ebuffer *ebuf, int set_default)
#undef word1eq #undef word1eq
if (conditionals->if_cmds) if (conditionals->if_cmds)
fatal (fstart, _("missing 'endif'")); O (fatal, fstart, _("missing 'endif'"));
/* At eof, record the last rule. */ /* At eof, record the last rule. */
record_waiting_files (); record_waiting_files ();
if (collapsed) free (collapsed);
free (collapsed);
free (commands); free (commands);
} }
@@ -1427,7 +1433,7 @@ do_undefine (char *name, enum variable_origin origin, struct ebuffer *ebuf)
var = allocated_variable_expand (name); var = allocated_variable_expand (name);
name = next_token (var); name = next_token (var);
if (*name == '\0') if (*name == '\0')
fatal (&ebuf->floc, _("empty variable name")); O (fatal, &ebuf->floc, _("empty variable name"));
p = name + strlen (name) - 1; p = name + strlen (name) - 1;
while (p > name && isblank ((unsigned char)*p)) while (p > name && isblank ((unsigned char)*p))
--p; --p;
@@ -1462,7 +1468,7 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
else else
{ {
if (var.value[0] != '\0') if (var.value[0] != '\0')
error (&defstart, _("extraneous text after 'define' directive")); O (error, &defstart, _("extraneous text after 'define' directive"));
/* Chop the string before the assignment token to get the name. */ /* Chop the string before the assignment token to get the name. */
var.name[var.length] = '\0'; var.name[var.length] = '\0';
@@ -1472,7 +1478,7 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
n = allocated_variable_expand (name); n = allocated_variable_expand (name);
name = next_token (n); name = next_token (n);
if (name[0] == '\0') if (name[0] == '\0')
fatal (&defstart, _("empty variable name")); O (fatal, &defstart, _("empty variable name"));
p = name + strlen (name) - 1; p = name + strlen (name) - 1;
while (p > name && isblank ((unsigned char)*p)) while (p > name && isblank ((unsigned char)*p))
--p; --p;
@@ -1487,7 +1493,7 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
/* If there is nothing left to be eval'd, there's no 'endef'!! */ /* If there is nothing left to be eval'd, there's no 'endef'!! */
if (nlines < 0) if (nlines < 0)
fatal (&defstart, _("missing 'endef', unterminated 'define'")); O (fatal, &defstart, _("missing 'endef', unterminated 'define'"));
ebuf->floc.lineno += nlines; ebuf->floc.lineno += nlines;
line = ebuf->buffer; line = ebuf->buffer;
@@ -1514,8 +1520,8 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
p += 5; p += 5;
remove_comments (p); remove_comments (p);
if (*(next_token (p)) != '\0') if (*(next_token (p)) != '\0')
error (&ebuf->floc, O (error, &ebuf->floc,
_("extraneous text after 'endef' directive")); _("extraneous text after 'endef' directive"));
if (--nlevels == 0) if (--nlevels == 0)
break; break;
@@ -1564,7 +1570,7 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
static int static int
conditional_line (char *line, int len, const gmk_floc *flocp) conditional_line (char *line, int len, const gmk_floc *flocp)
{ {
char *cmdname; const char *cmdname;
enum { c_ifdef, c_ifndef, c_ifeq, c_ifneq, c_else, c_endif } cmdtype; enum { c_ifdef, c_ifndef, c_ifeq, c_ifneq, c_else, c_endif } cmdtype;
unsigned int i; unsigned int i;
unsigned int o; unsigned int o;
@@ -1586,16 +1592,17 @@ conditional_line (char *line, int len, const gmk_floc *flocp)
/* Found one: skip past it and any whitespace after it. */ /* Found one: skip past it and any whitespace after it. */
line = next_token (line + len); line = next_token (line + len);
#define EXTRANEOUS() error (flocp, _("extraneous text after '%s' directive"), cmdname) #define EXTRATEXT() OS (error, flocp, _("extraneous text after '%s' directive"), cmdname)
#define EXTRACMD() OS (fatal, flocp, _("extraneous '%s'"), cmdname)
/* An 'endif' cannot contain extra text, and reduces the if-depth by 1 */ /* An 'endif' cannot contain extra text, and reduces the if-depth by 1 */
if (cmdtype == c_endif) if (cmdtype == c_endif)
{ {
if (*line != '\0') if (*line != '\0')
EXTRANEOUS (); EXTRATEXT ();
if (!conditionals->if_cmds) if (!conditionals->if_cmds)
fatal (flocp, _("extraneous '%s'"), cmdname); EXTRACMD ();
--conditionals->if_cmds; --conditionals->if_cmds;
@@ -1609,12 +1616,12 @@ conditional_line (char *line, int len, const gmk_floc *flocp)
const char *p; const char *p;
if (!conditionals->if_cmds) if (!conditionals->if_cmds)
fatal (flocp, _("extraneous '%s'"), cmdname); EXTRACMD ();
o = conditionals->if_cmds - 1; o = conditionals->if_cmds - 1;
if (conditionals->seen_else[o]) if (conditionals->seen_else[o])
fatal (flocp, _("only one 'else' per conditional")); O (fatal, flocp, _("only one 'else' per conditional"));
/* Change the state of ignorance. */ /* Change the state of ignorance. */
switch (conditionals->ignoring[o]) switch (conditionals->ignoring[o])
@@ -1647,7 +1654,7 @@ conditional_line (char *line, int len, const gmk_floc *flocp)
/* If it's 'else' or 'endif' or an illegal conditional, fail. */ /* If it's 'else' or 'endif' or an illegal conditional, fail. */
if (word1eq ("else") || word1eq ("endif") if (word1eq ("else") || word1eq ("endif")
|| conditional_line (line, len, flocp) < 0) || conditional_line (line, len, flocp) < 0)
EXTRANEOUS (); EXTRATEXT ();
else else
{ {
/* conditional_line() created a new level of conditional. /* conditional_line() created a new level of conditional.
@@ -1804,7 +1811,7 @@ conditional_line (char *line, int len, const gmk_floc *flocp)
*line = '\0'; *line = '\0';
line = next_token (++line); line = next_token (++line);
if (*line != '\0') if (*line != '\0')
EXTRANEOUS (); EXTRATEXT ();
s2 = variable_expand (s2); s2 = variable_expand (s2);
conditionals->ignoring[o] = (streq (s1, s2) == (cmdtype == c_ifneq)); conditionals->ignoring[o] = (streq (s1, s2) == (cmdtype == c_ifneq));
@@ -1889,7 +1896,7 @@ record_target_var (struct nameseq *filenames, char *defn,
current_variable_set_list = f->variables; current_variable_set_list = f->variables;
v = try_variable_definition (flocp, defn, origin, 1); v = try_variable_definition (flocp, defn, origin, 1);
if (!v) if (!v)
fatal (flocp, _("Malformed target-specific variable definition")); O (fatal, flocp, _("Malformed target-specific variable definition"));
current_variable_set_list = global; current_variable_set_list = global;
} }
@@ -1909,8 +1916,7 @@ record_target_var (struct nameseq *filenames, char *defn,
if (gv && v != gv if (gv && v != gv
&& (gv->origin == o_env_override || gv->origin == o_command)) && (gv->origin == o_env_override || gv->origin == o_command))
{ {
if (v->value != 0) free (v->value);
free (v->value);
v->value = xstrdup (gv->value); v->value = xstrdup (gv->value);
v->origin = gv->origin; v->origin = gv->origin;
v->recursive = gv->recursive; v->recursive = gv->recursive;
@@ -1948,7 +1954,7 @@ record_files (struct nameseq *filenames, const char *pattern,
at this time, since they won't get snapped and we'll get core dumps. at this time, since they won't get snapped and we'll get core dumps.
See Savannah bug # 12124. */ See Savannah bug # 12124. */
if (snapped_deps) if (snapped_deps)
fatal (flocp, _("prerequisites cannot be defined in recipes")); O (fatal, flocp, _("prerequisites cannot be defined in recipes"));
/* Determine if this is a pattern rule or not. */ /* Determine if this is a pattern rule or not. */
name = filenames->name; name = filenames->name;
@@ -2006,7 +2012,7 @@ record_files (struct nameseq *filenames, const char *pattern,
unsigned int c; unsigned int c;
if (pattern != 0) if (pattern != 0)
fatal (flocp, _("mixed implicit and static pattern rules")); O (fatal, flocp, _("mixed implicit and static pattern rules"));
/* Count the targets to create an array of target names. /* Count the targets to create an array of target names.
We already have the first one. */ We already have the first one. */
@@ -2029,7 +2035,7 @@ record_files (struct nameseq *filenames, const char *pattern,
implicit_percent = find_percent_cached (&name); implicit_percent = find_percent_cached (&name);
if (implicit_percent == 0) if (implicit_percent == 0)
fatal (flocp, _("mixed implicit and normal rules")); O (fatal, flocp, _("mixed implicit and normal rules"));
targets[c] = name; targets[c] = name;
target_pats[c] = implicit_percent; target_pats[c] = implicit_percent;
@@ -2081,7 +2087,8 @@ record_files (struct nameseq *filenames, const char *pattern,
'targets: target%pattern: prereq%pattern; recipe', 'targets: target%pattern: prereq%pattern; recipe',
make sure the pattern matches this target name. */ make sure the pattern matches this target name. */
if (pattern && !pattern_matches (pattern, pattern_percent, name)) if (pattern && !pattern_matches (pattern, pattern_percent, name))
error (flocp, _("target '%s' doesn't match the target pattern"), name); OS (error, flocp,
_("target '%s' doesn't match the target pattern"), name);
else if (deps) else if (deps)
/* If there are multiple targets, copy the chain DEPS for all but the /* If there are multiple targets, copy the chain DEPS for all but the
last one. It is not safe for the same deps to go in more than one last one. It is not safe for the same deps to go in more than one
@@ -2095,25 +2102,26 @@ record_files (struct nameseq *filenames, const char *pattern,
if any. */ if any. */
f = enter_file (strcache_add (name)); f = enter_file (strcache_add (name));
if (f->double_colon) if (f->double_colon)
fatal (flocp, OS (fatal, flocp,
_("target file '%s' has both : and :: entries"), f->name); _("target file '%s' has both : and :: entries"), f->name);
/* If CMDS == F->CMDS, this target was listed in this rule /* If CMDS == F->CMDS, this target was listed in this rule
more than once. Just give a warning since this is harmless. */ more than once. Just give a warning since this is harmless. */
if (cmds != 0 && cmds == f->cmds) if (cmds != 0 && cmds == f->cmds)
error (flocp, OS (error, flocp,
_("target '%s' given more than once in the same rule"), _("target '%s' given more than once in the same rule"),
f->name); f->name);
/* Check for two single-colon entries both with commands. /* Check for two single-colon entries both with commands.
Check is_target so that we don't lose on files such as .c.o Check is_target so that we don't lose on files such as .c.o
whose commands were preinitialized. */ whose commands were preinitialized. */
else if (cmds != 0 && f->cmds != 0 && f->is_target) else if (cmds != 0 && f->cmds != 0 && f->is_target)
{ {
error (&cmds->fileinfo, size_t l = strlen (f->name);
error (&cmds->fileinfo, l,
_("warning: overriding recipe for target '%s'"), _("warning: overriding recipe for target '%s'"),
f->name); f->name);
error (&f->cmds->fileinfo, error (&f->cmds->fileinfo, l,
_("warning: ignoring old recipe for target '%s'"), _("warning: ignoring old recipe for target '%s'"),
f->name); f->name);
} }
@@ -2140,8 +2148,8 @@ record_files (struct nameseq *filenames, const char *pattern,
/* Check for both : and :: rules. Check is_target so we don't lose /* Check for both : and :: rules. Check is_target so we don't lose
on default suffix rules or makefiles. */ on default suffix rules or makefiles. */
if (f != 0 && f->is_target && !f->double_colon) if (f != 0 && f->is_target && !f->double_colon)
fatal (flocp, OS (fatal, flocp,
_("target file '%s' has both : and :: entries"), f->name); _("target file '%s' has both : and :: entries"), f->name);
f = enter_file (strcache_add (name)); f = enter_file (strcache_add (name));
/* If there was an existing entry and it was a double-colon entry, /* If there was an existing entry and it was a double-colon entry,
@@ -2217,7 +2225,8 @@ record_files (struct nameseq *filenames, const char *pattern,
/* Reduce escaped percents. If there are any unescaped it's an error */ /* Reduce escaped percents. If there are any unescaped it's an error */
name = filenames->name; name = filenames->name;
if (find_percent_cached (&name)) if (find_percent_cached (&name))
fatal (flocp, _("mixed implicit and normal rules")); O (error, flocp,
_("*** mixed implicit and normal rules: deprecated syntax"));
} }
} }
@@ -2331,14 +2340,14 @@ unescape_char (char *string, int c)
if (*e != c || l%2 == 0) if (*e != c || l%2 == 0)
{ {
/* It's not; just take it all without unescaping. */ /* It's not; just take it all without unescaping. */
memcpy (p, s, l); memmove (p, s, l);
p += l; p += l;
} }
else if (l > 1) else if (l > 1)
{ {
/* It is, and there's >1 backslash. Take half of them. */ /* It is, and there's >1 backslash. Take half of them. */
l /= 2; l /= 2;
memcpy (p, s, l); memmove (p, s, l);
p += l; p += l;
} }
s = e; s = e;
@@ -2526,8 +2535,8 @@ readline (struct ebuffer *ebuf)
lossage strikes again! (xmkmf puts NULs in its makefiles.) lossage strikes again! (xmkmf puts NULs in its makefiles.)
There is nothing really to be done; we synthesize a newline so There is nothing really to be done; we synthesize a newline so
the following line doesn't appear to be part of this line. */ the following line doesn't appear to be part of this line. */
error (&ebuf->floc, O (error, &ebuf->floc,
_("warning: NUL character seen; rest of line ignored")); _("warning: NUL character seen; rest of line ignored"));
p[0] = '\n'; p[0] = '\n';
len = 1; len = 1;
} }
@@ -2842,8 +2851,7 @@ construct_include_path (const char **arg_dirs)
dirs[idx++] = strcache_add_len (dir, len); dirs[idx++] = strcache_add_len (dir, len);
} }
if (expanded) free (expanded);
free (expanded);
} }
/* Now add the standard default dirs at the end. */ /* Now add the standard default dirs at the end. */
@@ -3269,7 +3277,7 @@ parse_file_seq (char **stringp, unsigned int size, int stopmap,
switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl)) switch (glob (name, GLOB_NOSORT|GLOB_ALTDIRFUNC, NULL, &gl))
{ {
case GLOB_NOSPACE: case GLOB_NOSPACE:
fatal (NILF, _("virtual memory exhausted")); OUT_OF_MEM();
case 0: case 0:
/* Success. */ /* Success. */
@@ -3335,12 +3343,10 @@ parse_file_seq (char **stringp, unsigned int size, int stopmap,
globfree (&gl); globfree (&gl);
#ifndef NO_ARCHIVES #ifndef NO_ARCHIVES
if (arname) free (arname);
free (arname);
#endif #endif
if (tildep) free (tildep);
free (tildep);
} }
*stringp = p; *stringp = p;

153
remake.c
View File

@@ -1,5 +1,5 @@
/* Basic dependency engine for GNU Make. /* Basic dependency engine for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -58,10 +58,10 @@ unsigned int commands_started = 0;
/* Current value for pruning the scan of the goal chain (toggle 0/1). */ /* Current value for pruning the scan of the goal chain (toggle 0/1). */
static unsigned int considered; static unsigned int considered;
static int update_file (struct file *file, unsigned int depth); static enum update_status update_file (struct file *file, unsigned int depth);
static int update_file_1 (struct file *file, unsigned int depth); static enum update_status update_file_1 (struct file *file, unsigned int depth);
static int check_dep (struct file *file, unsigned int depth, static enum update_status check_dep (struct file *file, unsigned int depth,
FILE_TIMESTAMP this_mtime, int *must_make_ptr); FILE_TIMESTAMP this_mtime, int *must_make);
static enum update_status touch_file (struct file *file); static enum update_status touch_file (struct file *file);
static void remake_file (struct file *file); static void remake_file (struct file *file);
static FILE_TIMESTAMP name_mtime (const char *name); static FILE_TIMESTAMP name_mtime (const char *name);
@@ -130,7 +130,7 @@ update_goal_chain (struct dep *goals)
file = file->prev) file = file->prev)
{ {
unsigned int ocommands_started; unsigned int ocommands_started;
int fail; enum update_status fail;
file->dontcare = g->dontcare; file->dontcare = g->dontcare;
@@ -161,14 +161,12 @@ update_goal_chain (struct dep *goals)
if (commands_started > ocommands_started) if (commands_started > ocommands_started)
g->changed = 1; g->changed = 1;
/* If we updated a file and STATUS was not already 1, set it to
1 if updating failed, or to 0 if updating succeeded. Leave
STATUS as it is if no updating was done. */
stop = 0; stop = 0;
if ((fail || file->updated) && status < us_question) if ((fail || file->updated) && status < us_question)
{ {
if (file->update_status != us_success) /* We updated this goal. Update STATUS and decide whether
to stop. */
if (file->update_status)
{ {
/* Updating failed, or -q triggered. The STATUS value /* Updating failed, or -q triggered. The STATUS value
tells our caller which. */ tells our caller which. */
@@ -228,10 +226,10 @@ update_goal_chain (struct dep *goals)
&& file->update_status == us_success && !g->changed && file->update_status == us_success && !g->changed
/* Never give a message under -s or -q. */ /* Never give a message under -s or -q. */
&& !silent_flag && !question_flag) && !silent_flag && !question_flag)
message (1, ((file->phony || file->cmds == 0) OS (message, 1, ((file->phony || file->cmds == 0)
? _("Nothing to be done for '%s'.") ? _("Nothing to be done for '%s'.")
: _("'%s' is up to date.")), : _("'%s' is up to date.")),
file->name); file->name);
/* This goal is finished. Remove it from the chain. */ /* This goal is finished. Remove it from the chain. */
if (lastgoal == 0) if (lastgoal == 0)
@@ -282,11 +280,11 @@ update_goal_chain (struct dep *goals)
If there are multiple double-colon entries for FILE, If there are multiple double-colon entries for FILE,
each is considered in turn. */ each is considered in turn. */
static int static enum update_status
update_file (struct file *file, unsigned int depth) update_file (struct file *file, unsigned int depth)
{ {
int status = 0; enum update_status status = us_success;
register struct file *f; struct file *f;
f = file->double_colon ? file->double_colon : file; f = file->double_colon ? file->double_colon : file;
@@ -311,26 +309,31 @@ update_file (struct file *file, unsigned int depth)
the chain is exhausted. */ the chain is exhausted. */
for (; f != 0; f = f->prev) for (; f != 0; f = f->prev)
{ {
enum update_status new;
f->considered = considered; f->considered = considered;
status |= update_file_1 (f, depth); new = update_file_1 (f, depth);
check_renamed (f); check_renamed (f);
/* Clean up any alloca() used during the update. */ /* Clean up any alloca() used during the update. */
alloca (0); alloca (0);
/* If we got an error, don't bother with double_colon etc. */ /* If we got an error, don't bother with double_colon etc. */
if (status != 0 && !keep_going_flag) if (new && !keep_going_flag)
return status; return new;
if (f->command_state == cs_running if (f->command_state == cs_running
|| f->command_state == cs_deps_running) || f->command_state == cs_deps_running)
{ {
/* Don't run the other :: rules for this /* Don't run the other :: rules for this
file until this rule is finished. */ file until this rule is finished. */
status = 0; status = us_success;
break; break;
} }
if (new > status)
status = new;
} }
/* Process the remaining rules in the double colon chain so they're marked /* Process the remaining rules in the double colon chain so they're marked
@@ -343,7 +346,11 @@ update_file (struct file *file, unsigned int depth)
f->considered = considered; f->considered = considered;
for (d = f->deps; d != 0; d = d->next) for (d = f->deps; d != 0; d = d->next)
status |= update_file (d->file, depth + 1); {
enum update_status new = update_file (d->file, depth + 1);
if (new > status)
new = status;
}
} }
return status; return status;
@@ -373,24 +380,30 @@ complain (struct file *file)
if (d == 0) if (d == 0)
{ {
const char *msg_noparent
= _("%sNo rule to make target '%s'%s");
const char *msg_parent
= _("%sNo rule to make target '%s', needed by '%s'%s");
/* Didn't find any dependencies to complain about. */ /* Didn't find any dependencies to complain about. */
if (!keep_going_flag) if (file->parent)
{ {
if (file->parent == 0) size_t l = strlen (file->name) + strlen (file->parent->name) + 4;
fatal (NILF, msg_noparent, "", file->name, "");
fatal (NILF, msg_parent, "", file->name, file->parent->name, ""); if (!keep_going_flag)
fatal (NILF, l,
_("%sNo rule to make target '%s', needed by '%s'%s"),
"", file->name, file->parent->name, "");
error (NILF, l, _("%sNo rule to make target '%s', needed by '%s'%s"),
"*** ", file->name, file->parent->name, ".");
} }
if (file->parent == 0)
error (NILF, msg_noparent, "*** ", file->name, ".");
else else
error (NILF, msg_parent, "*** ", file->name, file->parent->name, "."); {
size_t l = strlen (file->name) + 4;
if (!keep_going_flag)
fatal (NILF, l,
_("%sNo rule to make target '%s'%s"), "", file->name, "");
error (NILF, l,
_("%sNo rule to make target '%s'%s"), "*** ", file->name, ".");
}
file->no_diag = 0; file->no_diag = 0;
} }
@@ -399,12 +412,12 @@ complain (struct file *file)
/* Consider a single 'struct file' and update it as appropriate. /* Consider a single 'struct file' and update it as appropriate.
Return 0 on success, or non-0 on failure. */ Return 0 on success, or non-0 on failure. */
static int static enum update_status
update_file_1 (struct file *file, unsigned int depth) update_file_1 (struct file *file, unsigned int depth)
{ {
enum update_status dep_status = us_success;
FILE_TIMESTAMP this_mtime; FILE_TIMESTAMP this_mtime;
int noexist, must_make, deps_changed; int noexist, must_make, deps_changed;
int dep_status = 0;
struct file *ofile; struct file *ofile;
struct dep *d, *ad; struct dep *d, *ad;
struct dep amake; struct dep amake;
@@ -478,8 +491,9 @@ update_file_1 (struct file *file, unsigned int depth)
/* Avoid spurious rebuilds due to low resolution time stamps. */ /* Avoid spurious rebuilds due to low resolution time stamps. */
int ns = FILE_TIMESTAMP_NS (this_mtime); int ns = FILE_TIMESTAMP_NS (this_mtime);
if (ns != 0) if (ns != 0)
error (NILF, _("*** Warning: .LOW_RESOLUTION_TIME file '%s' has a high resolution time stamp"), OS (error, NILF,
file->name); _("*** Warning: .LOW_RESOLUTION_TIME file '%s' has a high resolution time stamp"),
file->name);
this_mtime += FILE_TIMESTAMPS_PER_S - 1 - ns; this_mtime += FILE_TIMESTAMPS_PER_S - 1 - ns;
} }
@@ -521,6 +535,7 @@ update_file_1 (struct file *file, unsigned int depth)
while (d) while (d)
{ {
enum update_status new;
FILE_TIMESTAMP mtime; FILE_TIMESTAMP mtime;
int maybe_make; int maybe_make;
int dontcare = 0; int dontcare = 0;
@@ -532,8 +547,8 @@ update_file_1 (struct file *file, unsigned int depth)
if (is_updating (d->file)) if (is_updating (d->file))
{ {
error (NILF, _("Circular %s <- %s dependency dropped."), OSS (error, NILF, _("Circular %s <- %s dependency dropped."),
file->name, d->file->name); file->name, d->file->name);
/* We cannot free D here because our the caller will still have /* We cannot free D here because our the caller will still have
a reference to it when we were called recursively via a reference to it when we were called recursively via
check_dep below. */ check_dep below. */
@@ -555,7 +570,9 @@ update_file_1 (struct file *file, unsigned int depth)
d->file->dontcare = file->dontcare; d->file->dontcare = file->dontcare;
} }
dep_status |= check_dep (d->file, depth, this_mtime, &maybe_make); new = check_dep (d->file, depth, this_mtime, &maybe_make);
if (new > dep_status)
dep_status = new;
/* Restore original dontcare flag. */ /* Restore original dontcare flag. */
if (rebuilding_makefiles) if (rebuilding_makefiles)
@@ -601,6 +618,7 @@ update_file_1 (struct file *file, unsigned int depth)
for (d = file->deps; d != 0; d = d->next) for (d = file->deps; d != 0; d = d->next)
if (d->file->intermediate) if (d->file->intermediate)
{ {
enum update_status new;
int dontcare = 0; int dontcare = 0;
FILE_TIMESTAMP mtime = file_mtime (d->file); FILE_TIMESTAMP mtime = file_mtime (d->file);
@@ -619,7 +637,9 @@ update_file_1 (struct file *file, unsigned int depth)
not prune it. */ not prune it. */
d->file->considered = !considered; d->file->considered = !considered;
dep_status |= update_file (d->file, depth); new = update_file (d->file, depth);
if (new > dep_status)
dep_status = new;
/* Restore original dontcare flag. */ /* Restore original dontcare flag. */
if (rebuilding_makefiles) if (rebuilding_makefiles)
@@ -664,9 +684,10 @@ update_file_1 (struct file *file, unsigned int depth)
/* If any dependency failed, give up now. */ /* If any dependency failed, give up now. */
if (dep_status != 0) if (dep_status)
{ {
file->update_status = us_failed; /* I'm not sure if we can't just assign dep_status... */
file->update_status = dep_status == us_none ? us_failed : dep_status;
notice_finished_file (file); notice_finished_file (file);
--depth; --depth;
@@ -675,8 +696,8 @@ update_file_1 (struct file *file, unsigned int depth)
if (depth == 0 && keep_going_flag if (depth == 0 && keep_going_flag
&& !just_print_flag && !question_flag) && !just_print_flag && !question_flag)
error (NILF, OS (error, NILF,
_("Target '%s' not remade because of errors."), file->name); _("Target '%s' not remade because of errors."), file->name);
return dep_status; return dep_status;
} }
@@ -981,13 +1002,13 @@ notice_finished_file (struct file *file)
FILE depends on (including FILE itself). Return nonzero if any updating FILE depends on (including FILE itself). Return nonzero if any updating
failed. */ failed. */
static int static enum update_status
check_dep (struct file *file, unsigned int depth, check_dep (struct file *file, unsigned int depth,
FILE_TIMESTAMP this_mtime, int *must_make_ptr) FILE_TIMESTAMP this_mtime, int *must_make_ptr)
{ {
struct file *ofile; struct file *ofile;
struct dep *d; struct dep *d;
int dep_status = 0; enum update_status dep_status = us_success;
++depth; ++depth;
start_updating (file); start_updating (file);
@@ -1060,12 +1081,13 @@ check_dep (struct file *file, unsigned int depth,
d = file->deps; d = file->deps;
while (d != 0) while (d != 0)
{ {
enum update_status new;
int maybe_make; int maybe_make;
if (is_updating (d->file)) if (is_updating (d->file))
{ {
error (NILF, _("Circular %s <- %s dependency dropped."), OSS (error, NILF, _("Circular %s <- %s dependency dropped."),
file->name, d->file->name); file->name, d->file->name);
if (ld == 0) if (ld == 0)
{ {
file->deps = d->next; file->deps = d->next;
@@ -1083,12 +1105,14 @@ check_dep (struct file *file, unsigned int depth,
d->file->parent = file; d->file->parent = file;
maybe_make = *must_make_ptr; maybe_make = *must_make_ptr;
dep_status |= check_dep (d->file, depth, this_mtime, new = check_dep (d->file, depth, this_mtime, &maybe_make);
&maybe_make); if (new > dep_status)
dep_status = new;
if (! d->ignore_mtime) if (! d->ignore_mtime)
*must_make_ptr = maybe_make; *must_make_ptr = maybe_make;
check_renamed (d->file); check_renamed (d->file);
if (dep_status != 0 && !keep_going_flag) if (dep_status && !keep_going_flag)
break; break;
if (d->file->command_state == cs_running if (d->file->command_state == cs_running
@@ -1122,7 +1146,7 @@ static enum update_status
touch_file (struct file *file) touch_file (struct file *file)
{ {
if (!silent_flag) if (!silent_flag)
message (0, "touch %s", file->name); OS (message, 0, "touch %s", file->name);
/* Print-only (-n) takes precedence over touch (-t). */ /* Print-only (-n) takes precedence over touch (-t). */
if (just_print_flag) if (just_print_flag)
@@ -1369,8 +1393,9 @@ f_mtime (struct file *file, int search)
if (adjusted_now < adjusted_mtime) if (adjusted_now < adjusted_mtime)
{ {
#ifdef NO_FLOAT #ifdef NO_FLOAT
error (NILF, _("Warning: File '%s' has modification time in the future"), OS (error, NILF,
file->name); _("Warning: File '%s' has modification time in the future"),
file->name);
#else #else
double from_now = double from_now =
(FILE_TIMESTAMP_S (mtime) - FILE_TIMESTAMP_S (now) (FILE_TIMESTAMP_S (mtime) - FILE_TIMESTAMP_S (now)
@@ -1382,8 +1407,9 @@ f_mtime (struct file *file, int search)
sprintf (from_now_string, "%lu", (unsigned long) from_now); sprintf (from_now_string, "%lu", (unsigned long) from_now);
else else
sprintf (from_now_string, "%.2g", from_now); sprintf (from_now_string, "%.2g", from_now);
error (NILF, _("Warning: File '%s' has modification time %s s in the future"), OSS (error, NILF,
file->name, from_now_string); _("Warning: File '%s' has modification time %s s in the future"),
file->name, from_now_string);
#endif #endif
clock_skew_detected = 1; clock_skew_detected = 1;
} }
@@ -1520,7 +1546,7 @@ name_mtime (const char *name)
static const char * static const char *
library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr) library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
{ {
static char *dirs[] = static const char *dirs[] =
{ {
#ifndef _AMIGA #ifndef _AMIGA
"/lib", "/lib",
@@ -1550,7 +1576,7 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
/* Information about the earliest (in the vpath sequence) match. */ /* Information about the earliest (in the vpath sequence) match. */
unsigned int best_vpath = 0, best_path = 0; unsigned int best_vpath = 0, best_path = 0;
char **dp; const char **dp;
libpatterns = xstrdup (variable_expand ("$(.LIBPATTERNS)")); libpatterns = xstrdup (variable_expand ("$(.LIBPATTERNS)"));
@@ -1580,7 +1606,8 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
if (!p3) if (!p3)
{ {
/* Give a warning if there is no pattern. */ /* Give a warning if there is no pattern. */
error (NILF, _(".LIBPATTERNS element '%s' is not a pattern"), p); OS (error, NILF,
_(".LIBPATTERNS element '%s' is not a pattern"), p);
p[len] = c; p[len] = c;
continue; continue;
} }

View File

@@ -3,7 +3,7 @@
Please do not send bug reports or questions about it to Please do not send bug reports or questions about it to
the Make maintainers. the Make maintainers.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -151,7 +151,7 @@ start_remote_job (char **argv, char **envp, int stdin_fd,
retsock = Rpc_UdpCreate (True, 0); retsock = Rpc_UdpCreate (True, 0);
if (retsock < 0) if (retsock < 0)
{ {
error (NILF, "exporting: Couldn't create return socket."); O (error, NILF, "exporting: Couldn't create return socket.");
return 1; return 1;
} }
@@ -192,33 +192,35 @@ start_remote_job (char **argv, char **envp, int stdin_fd,
host = gethostbyaddr ((char *)&permit.addr, sizeof(permit.addr), AF_INET); host = gethostbyaddr ((char *)&permit.addr, sizeof(permit.addr), AF_INET);
if (status != RPC_SUCCESS) {
{ const char *hnm = host ? host->h_name : inet_ntoa (permit.addr);
(void) close (retsock); size_t hlen = strlen (hnm);
(void) close (sock);
error (NILF, "exporting to %s: %s",
host ? host->h_name : inet_ntoa (permit.addr),
Rpc_ErrorMessage (status));
return 1;
}
else if (msg[0] != 'O' || msg[1] != 'k' || msg[2] != '\0')
{
(void) close (retsock);
(void) close (sock);
error (NILF, "exporting to %s: %s",
host ? host->h_name : inet_ntoa (permit.addr),
msg);
return 1;
}
else
{
error (NILF, "*** exported to %s (id %u)",
host ? host->h_name : inet_ntoa (permit.addr),
permit.id);
}
fflush (stdout); if (status != RPC_SUCCESS)
fflush (stderr); {
const char *err = Rpc_ErrorMessage (status);
(void) close (retsock);
(void) close (sock);
error (NILF, hlen + strlen (err),
"exporting to %s: %s", hnm, err);
return 1;
}
else if (msg[0] != 'O' || msg[1] != 'k' || msg[2] != '\0')
{
(void) close (retsock);
(void) close (sock);
error (NILF, hlen + strlen (msg), "exporting to %s: %s", hnm, msg);
return 1;
}
else
{
error (NILF, hlen + INTSTR_LENGTH,
"*** exported to %s (id %u)", hnm, permit.id);
}
fflush (stdout);
fflush (stderr);
}
pid = fork (); pid = fork ();
if (pid < 0) if (pid < 0)

View File

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

13
rule.c
View File

@@ -1,5 +1,5 @@
/* Pattern and suffix rule internals for GNU Make. /* Pattern and suffix rule internals for GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -140,8 +140,7 @@ count_implicit_rule_limits (void)
rule = next; rule = next;
} }
if (name != 0) free (name);
free (name);
} }
/* Create a pattern rule from a suffix rule. /* Create a pattern rule from a suffix rule.
@@ -357,7 +356,7 @@ void
install_pattern_rule (struct pspec *p, int terminal) install_pattern_rule (struct pspec *p, int terminal)
{ {
struct rule *r; struct rule *r;
char *ptr; const char *ptr;
r = xmalloc (sizeof (struct rule)); r = xmalloc (sizeof (struct rule));
@@ -373,7 +372,7 @@ install_pattern_rule (struct pspec *p, int terminal)
++r->suffixes[0]; ++r->suffixes[0];
ptr = p->dep; ptr = p->dep;
r->deps = PARSE_SIMPLE_SEQ (&ptr, struct dep); r->deps = PARSE_SIMPLE_SEQ ((char **)&ptr, struct dep);
if (new_pattern_rule (r, 0)) if (new_pattern_rule (r, 0))
{ {
@@ -528,7 +527,7 @@ print_rule_data_base (void)
/* This can happen if a fatal error was detected while reading the /* This can happen if a fatal error was detected while reading the
makefiles and thus count_implicit_rule_limits wasn't called yet. */ makefiles and thus count_implicit_rule_limits wasn't called yet. */
if (num_pattern_rules != 0) if (num_pattern_rules != 0)
fatal (NILF, _("BUG: num_pattern_rules is wrong! %u != %u"), ONN (fatal, NILF, _("BUG: num_pattern_rules is wrong! %u != %u"),
num_pattern_rules, rules); num_pattern_rules, rules);
} }
} }

4
rule.h
View File

@@ -1,5 +1,5 @@
/* Definitions for using pattern rules in GNU Make. /* Definitions for using pattern rules in GNU Make.
Copyright (C) 1988-2013 Free Software Foundation, Inc. Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the
@@ -33,7 +33,7 @@ struct rule
/* For calling install_pattern_rule. */ /* For calling install_pattern_rule. */
struct pspec struct pspec
{ {
char *target, *dep, *commands; const char *target, *dep, *commands;
}; };

View File

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

View File

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

View File

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

1
tests/.gitignore vendored
View File

@@ -1 +1,2 @@
config-flags.pm
work work

View File

@@ -1413,7 +1413,7 @@
ChangeLog file for the test suite created. ChangeLog file for the test suite created.
Copyright (C) 1992-2013 Free Software Foundation, Inc. Copyright (C) 1992-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -162,7 +162,7 @@ Changes from 0.1 to 0.2 (5-4-92):
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 1992-2013 Free Software Foundation, Inc. Copyright (C) 1992-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -7,7 +7,7 @@ This entire test suite, including all test files, are copyright and
distributed under the following terms: distributed under the following terms:
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
Copyright (C) 1992-2013 Free Software Foundation, Inc. Copyright (C) 1992-2014 Free Software Foundation, Inc.
This file is part of GNU Make. This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify it under the GNU Make is free software; you can redistribute it and/or modify it under the

19
tests/config-flags.pm.in Normal file
View File

@@ -0,0 +1,19 @@
# This is a -*-perl-*- script
#
# Set variables that were defined by configure, in case we need them
# during the tests.
%CONFIG_FLAGS = (
AM_LDFLAGS => '@AM_LDFLAGS@',
AR => '@AR@',
CC => '@CC@',
CFLAGS => '@CFLAGS@',
CPP => '@CPP@',
CPPFLAGS => '@CPPFLAGS@',
GUILE_CFLAGS => '@GUILE_CFLAGS@',
GUILE_LIBS => '@GUILE_LIBS@',
LDFLAGS => '@LDFLAGS@',
LIBS => '@LIBS@'
);
1;

53
tests/config_flags_pm.com Executable file
View File

@@ -0,0 +1,53 @@
$!
$! config_flags_pm.com - Build config-flags.pm on VMS.
$!
$! Just good enough to run the self tests for now.
$!
$! Copyright (C) 2014 Free Software Foundation, Inc.
$! This file is part of GNU Make.
$!
$! GNU Make is free software; you can redistribute it and/or modify it under
$! the terms of the GNU General Public License as published by the Free Software
$! Foundation; either version 3 of the License, or (at your option) any later
$! version.
$!
$! GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
$! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
$! FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
$! details.
$!
$! You should have received a copy of the GNU General Public License along with
$! this program. If not, see <http://www.gnu.org/licenses/>.
$!
$!
$ open/read cfpm_in config-flags.pm.in
$!
$ outfile = "sys$disk:[]config-flags.pm"
$!
$ cflags = "/include=([],[.glob]"
$!
$ create 'outfile'
$ open/append cfpm 'outfile'
$!
$cfpm_read_loop:
$ read cfpm_in/end=cfpm_read_loop_end line_in
$ line_in_len = f$length(line_in)
$ if f$locate("@", line_in) .lt. line_in_len
$ then
$ part1 = f$element(0, "@", line_in)
$ key = f$element(1, "@", line_in)
$ part2 = f$element(2, "@", line_in)
$ value = ""
$ if key .eqs. "CC" then value = "CC"
$ if key .eqs. "CPP" then value = "CPP"
$ if key .eqs. "CFLAGS" then value = cflags
$ if key .eqs. "GUILE_CFLAGS" then value = cflags
$ write cfpm part1, value, part2
$ goto cfpm_read_loop
$ endif
$ write cfpm line_in
$ goto cfpm_read_loop
$cfpm_read_loop_end:
$ close cfpm_in
$ close cfpm
$!

View File

@@ -3,7 +3,7 @@
# Simple script to make a "shadow" test directory, using symbolic links. # Simple script to make a "shadow" test directory, using symbolic links.
# Typically you'd put the shadow in /tmp or another local disk # Typically you'd put the shadow in /tmp or another local disk
# #
# Copyright (C) 1992-2013 Free Software Foundation, Inc. # Copyright (C) 1992-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under

272
tests/run_make_tests.com Executable file
View File

@@ -0,0 +1,272 @@
$! Test_make.com
$!
$! This is a wrapper for the GNU make perl test programs on VMS.
$!
$! Parameter "-help" for description on how to use described below.
$!
$! Copyright (C) 2014 Free Software Foundation, Inc.
$! This file is part of GNU Make.
$!
$! GNU Make is free software; you can redistribute it and/or modify it under
$! the terms of the GNU General Public License as published by the Free Software
$! Foundation; either version 3 of the License, or (at your option) any later
$! version.
$!
$! GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
$! WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
$! FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
$! details.
$!
$! You should have received a copy of the GNU General Public License along with
$! this program. If not, see <http://www.gnu.org/licenses/>.
$!
$!
$! Allow more than 8 paramters with using commas as a delimiter.
$!
$ params = "''p1',''p2',''p3',''p4',''p5',''p6',''p7',''p8'"
$!
$ test_flags = ",verbose,detail,keep,usage,help,debug,"
$ test_flags_len = f$length(test_flags)
$ verbose_flag = ""
$ detail_flag = ""
$ keep_flag = ""
$ usage_flag = ""
$ help_flag = ""
$ debug_flag = ""
$!
$ ignored_options = "profile,make,srcdir,valgrind,memcheck,massif,"
$ ignored_option_len = f$length(ignored_options)
$!
$ testname = ""
$ make :== $bin:make.exe"
$!
$ i = 0
$param_loop:
$ param = f$element(i, ",", params)
$ i = i + 1
$ if param .eqs. "" then goto param_loop
$ if param .eqs. "," then goto param_loop_end
$ param_len = f$length(param)
$ if f$locate("/", param) .lt. param_len
$ then
$ if testname .nes. ""
$ then
$ write sys$output "Only the last test name specified will be run!"
$ endif
$ testname = param
$ goto param_loop
$ endif
$ lc_param = f$edit(param,"LOWERCASE") - "-"
$ if f$locate(",''lc_param',", ignored_options) .lt. ignored_option_len
$ then
$ write sys$output "parameter ''param' is ignored on VMS for now."
$ goto param_loop
$ endif
$ if f$locate(",''lc_param',", test_flags) .lt. test_flags_len
$ then
$ 'lc_param'_flag = "-" + lc_param
$ goto param_loop
$ endif
$ write sys$output "parameter ''param' is not known to VMS."
$ goto param_loop
$!
$param_loop_end:
$!
$no_gnv = 1
$no_perl = 1
$!
$! Find GNV 2.1.3 + manditory updates
$! If properly updated, the GNV$GNU logical name is present.
$! Updated GNV utilities have a gnv$ prefix on them.
$ gnv_root = f$trnlnm("GNV$GNU", "LNM$SYSTEM_TABLE")
$ if gnv_root .nes. ""
$ then
$ no_gnv = 0
$ ! Check for update ar utility.
$ new_ar = "gnv$gnu:[usr.bin]gnv$ar.exe"
$ if f$search(new_ar) .nes. ""
$ then
$ ! See if a new port of ar exists.
$ ar :== $'new_ar'
$ else
$ ! Fall back to legacy GNV AR wrapper.
$ old_ar = "gnv$gnu:[bin]ar.exe"
$ if f$search(old_ar) .nes. ""
$ then
$ ar :== $'old_ar'
$ else
$ no_gnv = 1
$ endif
$ endif
$ ! Check for updated bash
$ if no_gnv .eq. 0
$ then
$ new_bash = "gnv$gnu:[bin]gnv$bash.exe"
$ if f$search(new_bash) .nes. ""
$ then
$ bash :== $'new_bash'
$ sh :== $'new_bash'
$ else
$ no_gnv = 1
$ endif
$ endif
$ ! Check for updated coreutils
$ if no_gnv .eq. 0
$ then
$ new_cat = "gnv$gnu:[bin]gnv$cat.exe"
$ if f$search(new_cat) .nes. ""
$ then
$ cat :== $'new_cat'
$ cp :== $gnv$gnu:[bin]gnv$cp.exe
$ echo :== $gnv$gnu:[bin]gnv$echo.exe
$ false :== $gnv$gnu:[bin]gnv$false.exe
$ true :== $gnv$gnu:[bin]gnv$true.exe
$ touch :== $gnv$gnu:[bin]gnv$touch.exe
$ mkdir :== $gnv$gnu:[bin]gnv$mkdir.exe
$ rm :== $gnv$gnu:[bin]gnv$rm.exe
$ sleep :== $gnv$gnu:[bin]gnv$sleep.exe
$ else
$ no_gnv = 1
$ endif
$ endif
$ ! Check for updated diff utility.
$ if no_gnv .eq. 0
$ then
$ new_diff = "gnv$gnu:[usr.bin]gnv$diff.exe"
$ if f$search(new_diff) .nes. ""
$ then
$ ! See if a new port of diff exists.
$ diff :== $'new_diff'
$ else
$ ! Fall back to legacy GNV diff
$ old_diff = "gnv$gnu:[bin]diff.exe"
$ if f$search(old_diff) .nes. ""
$ then
$ diff :== $'old_diff'
$ else
$ no_gnv = 1
$ endif
$ endif
$ endif
$ endif
$!
$if no_gnv
$then
$ write sys$output "Could not find an up to date GNV installed!"
$ help_flag = 1
$endif
$!
$! Find perl 5.18.1 or later.
$!
$! look in perl_root:[000000]perl_setup.com
$ perl_root = f$trnlnm("perl_root")
$ ! This works with known perl installed from PCSI kits.
$ if perl_root .nes. ""
$ then
$ perl_ver = f$element(1, ".", perl_root)
$ if f$locate("-", perl_ver) .lt. f$length(perl_ver)
$ then
$ no_perl = 0
$ endif
$ endif
$ if no_perl
$ then
$! look for sys$common:[perl-*]perl_setup.com
$ perl_setup = f$search("sys$common:[perl-*]perl_setup.com")
$ if perl_setup .eqs. ""
$ then
$ if gnv_root .nes. ""
$ then
$ gnv_device = f$parse(gnv_root,,,"DEVICE")
$ perl_templ = "[vms$common.perl-*]perl_setup.com"
$ perl_search = f$parse(perl_templ, gnv_device)
$ perl_setup = f$search(perl_search)
$ endif
$ endif
$ if perl_setup .nes. ""
$ then
$ @'perl_setup'
$ no_perl = 0
$ endif
$ endif
$!
$ if no_perl
$ then
$ write sys$output "Could not find an up to date Perl installed!"
$ help_flag = "-help"
$ endif
$!
$!
$ if help_flag .nes. ""
$ then
$ type sys$input
$DECK
This is a test script wrapper for the run_make_tests.pl script.
This wrapper makes sure that the DCL symbols and logical names needed to
run the perl script are in place.
The test wrapper currently requires that the DCL symbols be global symbols.
Those symbols will be left behind after the procedure is run.
The PERL_ROOT will be set to a compatible perl if such a perl is found and
is not the default PERL_ROOT:. This setting will persist after the test.
This wrapper should be run with the default set to the base directory
of the make source.
The HELP parameter will bring up this text and then run the help script
for the Perl wrapper. Not all options for the perl script have been
implemented, such as valgrind or specifying the make path or source path.
Running the wrapper script requires:
Perl 5.18 or later.
PCSI kits available from http://sourceforge.net/projects/vmsperlkit/files/
GNV 2.1.3 or later. GNV 3.0.1 has not tested with this script.
Bash 4.2.47 or later.
Coreutils 8.21 or later.
http://sourceforge.net/projects/gnv/files/
Read before installing:
http://sourceforge.net/p/gnv/wiki/InstallingGNVPackages/
As updates for other GNV components get posted, those updates should
be used.
$EOD
$ endif
$!
$ if no_gnv .or. no_perl then exit 44
$!
$!
$ make := $bin:make.exe
$ default = f$environment("DEFAULT")
$ this = f$environment("PROCEDURE")
$ on error then goto all_error
$ set default 'f$parse(this,,,"DEVICE")''f$parse(this,,,"DIRECTORY")'
$!
$! Need to make sure that the config-flags.pm exists.
$ if f$search("config-flags.pm") .eqs. ""
$ then
$ @config_flags_pm.com
$ endif
$ define/user bin 'default',gnv$gnu:[bin]
$ define/user decc$filename_unix_noversion enable
$ define/user decc$filename_unix_report enable
$ define/user decc$readdir_dropdotnotype enable
$ flags = ""
$ if verbose_flag .nes. "" then flags = verbose_flag
$ if detail_flag .nes. "" then flags = flags + " " + detail_flag
$ if keep_flag .nes. "" then flags = flags + " " + keep_flag
$ if usage_flag .nes. "" then flags = flags + " " + usage_flag
$ if help_flag .nes. "" then flags = flags + " " + help_flag
$ if debug_flag .nes. "" then flags = flags + " " + debug_flag
$ flags = f$edit(flags, "TRIM, COMPRESS")
$ if testname .nes. ""
$ then
$ perl run_make_tests.pl "''testname'" 'flags'
$ else
$ perl run_make_tests.pl 'flags'
$ endif
$all_error:
$ set default 'default'
$!

View File

@@ -11,7 +11,7 @@
# [-make <make prog>] # [-make <make prog>]
# (and others) # (and others)
# Copyright (C) 1992-2013 Free Software Foundation, Inc. # Copyright (C) 1992-2014 Free Software Foundation, Inc.
# This file is part of GNU Make. # This file is part of GNU Make.
# #
# GNU Make is free software; you can redistribute it and/or modify it under # GNU Make is free software; you can redistribute it and/or modify it under
@@ -42,7 +42,24 @@ $command_string = '';
$all_tests = 0; $all_tests = 0;
# rmdir broken in some Perls on VMS.
if ($^O eq 'VMS')
{
require VMS::Filespec;
VMS::Filespec->import();
sub vms_rmdir {
my $vms_file = vmspath($_[0]);
$vms_file = fileify($vms_file);
my $ret = unlink(vmsify($vms_file));
return $ret
};
*CORE::GLOBAL::rmdir = \&vms_rmdir;
}
require "test_driver.pl"; require "test_driver.pl";
require "config-flags.pm";
# Some target systems might not have the POSIX module... # Some target systems might not have the POSIX module...
$has_POSIX = eval { require "POSIX.pm" }; $has_POSIX = eval { require "POSIX.pm" };
@@ -177,6 +194,40 @@ sub run_make_with_options {
} }
if ($options) { if ($options) {
if ($^O eq 'VMS') {
# Try to make sure arguments are properly quoted.
# This does not handle all cases.
# VMS uses double quotes instead of single quotes.
$options =~ s/\'/\"/g;
# If the leading quote is inside non-whitespace, then the
# quote must be doubled, because it will be enclosed in another
# set of quotes.
$options =~ s/(\S)(\".*\")/$1\"$2\"/g;
# Options must be quoted to preserve case if not already quoted.
$options =~ s/(\S+)/\"$1\"/g;
# Special fixup for embedded quotes.
$options =~ s/(\"\".+)\"(\s+)\"(.+\"\")/$1$2$3/g;
$options =~ s/(\A)(?:\"\")(.+)(?:\"\")/$1\"$2\"/g;
# Special fixup for misc/general4 test.
$options =~ s/""\@echo" "cc""/\@echo cc"/;
$options =~ s/"\@echo link"""/\@echo link"/;
# Remove shell escapes expected to be removed by bash
if ($options !~ /path=pre/) {
$options =~ s/\\//g;
}
# special fixup for options/eval
$options =~ s/"--eval=\$\(info" "eval/"--eval=\$\(info eval/;
print ("Options fixup = -$options-\n") if $debug;
}
$command .= " $options"; $command .= " $options";
} }
@@ -195,7 +246,6 @@ sub run_make_with_options {
$valgrind and $test_timeout = 0; $valgrind and $test_timeout = 0;
$code = &run_command_with_output($logname,$command); $code = &run_command_with_output($logname,$command);
$test_timeout = $old_timeout; $test_timeout = $old_timeout;
} }
@@ -326,19 +376,28 @@ sub set_more_defaults
# Find the full pathname of Make. For DOS systems this is more # Find the full pathname of Make. For DOS systems this is more
# complicated, so we ask make itself. # complicated, so we ask make itself.
my $mk = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`; if ($osname eq 'VMS') {
chop $mk; # On VMS pre-setup make to be found with simply 'make'.
$mk or die "FATAL ERROR: Cannot determine the value of \$(MAKE):\n $make_path = 'make';
} else {
my $mk = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`;
chop $mk;
$mk or die "FATAL ERROR: Cannot determine the value of \$(MAKE):\n
'echo \"all:;\@echo \\\$(MAKE)\" | $make_path -f-' failed!\n"; 'echo \"all:;\@echo \\\$(MAKE)\" | $make_path -f-' failed!\n";
$make_path = $mk; $make_path = $mk;
}
print "Make\t= '$make_path'\n" if $debug; print "Make\t= '$make_path'\n" if $debug;
$string = `$make_path -v -f /dev/null 2> /dev/null`; my $redir2 = '2> /dev/null';
$redir2 = '' if os_name eq 'VMS';
$string = `$make_path -v -f /dev/null $redir2`;
$string =~ /^(GNU Make [^,\n]*)/; $string =~ /^(GNU Make [^,\n]*)/;
$testee_version = "$1\n"; $testee_version = "$1\n";
$string = `sh -c "$make_path -f /dev/null 2>&1"`; my $redir = '2>&1';
$redir = '' if os_name eq 'VMS';
$string = `sh -c "$make_path -f /dev/null $redir"`;
if ($string =~ /(.*): \*\*\* No targets\. Stop\./) { if ($string =~ /(.*): \*\*\* No targets\. Stop\./) {
$make_name = $1; $make_name = $1;
} }
@@ -387,7 +446,7 @@ sub set_more_defaults
$purify_errors = 0; $purify_errors = 0;
} }
$string = `sh -c "$make_path -j 2 -f /dev/null 2>&1"`; $string = `sh -c "$make_path -j 2 -f /dev/null $redir"`;
if ($string =~ /not supported/) { if ($string =~ /not supported/) {
$parallel_jobs = 0; $parallel_jobs = 0;
} }

View File

@@ -11,32 +11,34 @@ exists $FEATURES{archives} or return -1;
# Create some .o files to work with # Create some .o files to work with
utouch(-60, qw(a1.o a2.o a3.o)); utouch(-60, qw(a1.o a2.o a3.o));
my $ar = $CONFIG_FLAGS{AR};
# Some versions of ar print different things on creation. Find out. # Some versions of ar print different things on creation. Find out.
my $created = `ar rv libxx.a a1.o 2>&1`; my $created = `$ar rv libxx.a a1.o 2>&1`;
# Some versions of ar print different things on add. Find out. # Some versions of ar print different things on add. Find out.
my $add = `ar rv libxx.a a2.o 2>&1`; my $add = `$ar rv libxx.a a2.o 2>&1`;
$add =~ s/a2\.o/#OBJECT#/g; $add =~ s/a2\.o/#OBJECT#/g;
# Some versions of ar print different things on replacement. Find out. # Some versions of ar print different things on replacement. Find out.
my $repl = `ar rv libxx.a a2.o 2>&1`; my $repl = `$ar rv libxx.a a2.o 2>&1`;
$repl =~ s/a2\.o/#OBJECT#/g; $repl =~ s/a2\.o/#OBJECT#/g;
unlink('libxx.a'); unlink('libxx.a');
# Very simple # Very simple
run_make_test('all: libxx.a(a1.o)', run_make_test('all: libxx.a(a1.o)',
'', "ar rv libxx.a a1.o\n$created"); '', "$ar rv libxx.a a1.o\n$created");
# Multiple .o's. Add a new one to the existing library # Multiple .o's. Add a new one to the existing library
($_ = $add) =~ s/#OBJECT#/a2.o/g; ($_ = $add) =~ s/#OBJECT#/a2.o/g;
run_make_test('all: libxx.a(a1.o a2.o)', run_make_test('all: libxx.a(a1.o a2.o)',
'', "ar rv libxx.a a2.o\n$_"); '', "$ar rv libxx.a a2.o\n$_");
# Touch one of the .o's so it's rebuilt # Touch one of the .o's so it's rebuilt
utouch(-40, 'a1.o'); utouch(-40, 'a1.o');
($_ = $repl) =~ s/#OBJECT#/a1.o/g; ($_ = $repl) =~ s/#OBJECT#/a1.o/g;
run_make_test(undef, '', "ar rv libxx.a a1.o\n$_"); run_make_test(undef, '', "$ar rv libxx.a a1.o\n$_");
# Use wildcards # Use wildcards
run_make_test('all: libxx.a(*.o)', run_make_test('all: libxx.a(*.o)',
@@ -45,21 +47,21 @@ run_make_test('all: libxx.a(*.o)',
# Touch one of the .o's so it's rebuilt # Touch one of the .o's so it's rebuilt
utouch(-30, 'a1.o'); utouch(-30, 'a1.o');
($_ = $repl) =~ s/#OBJECT#/a1.o/g; ($_ = $repl) =~ s/#OBJECT#/a1.o/g;
run_make_test(undef, '', "ar rv libxx.a a1.o\n$_"); run_make_test(undef, '', "$ar rv libxx.a a1.o\n$_");
# Use both wildcards and simple names # Use both wildcards and simple names
utouch(-50, 'a2.o'); utouch(-50, 'a2.o');
($_ = $add) =~ s/#OBJECT#/a3.o/g; ($_ = $add) =~ s/#OBJECT#/a3.o/g;
$_ .= "ar rv libxx.a a2.o\n"; $_ .= "$ar rv libxx.a a2.o\n";
($_ .= $repl) =~ s/#OBJECT#/a2.o/g; ($_ .= $repl) =~ s/#OBJECT#/a2.o/g;
run_make_test('all: libxx.a(a3.o *.o)', '', run_make_test('all: libxx.a(a3.o *.o)', '',
"ar rv libxx.a a3.o\n$_"); "$ar rv libxx.a a3.o\n$_");
# Check whitespace handling # Check whitespace handling
utouch(-40, 'a2.o'); utouch(-40, 'a2.o');
($_ = $repl) =~ s/#OBJECT#/a2.o/g; ($_ = $repl) =~ s/#OBJECT#/a2.o/g;
run_make_test('all: libxx.a( a3.o *.o )', '', run_make_test('all: libxx.a( a3.o *.o )', '',
"ar rv libxx.a a2.o\n$_"); "$ar rv libxx.a a2.o\n$_");
rmfiles(qw(a1.o a2.o a3.o libxx.a)); rmfiles(qw(a1.o a2.o a3.o libxx.a));

View File

@@ -6,8 +6,6 @@ $details = "Test dynamic loading of modules.";
# Don't do anything if this system doesn't support "load" # Don't do anything if this system doesn't support "load"
exists $FEATURES{load} or return -1; exists $FEATURES{load} or return -1;
my $sobuild = '$(CC) '.($srcdir? "-I$srcdir":'').' -g -shared -fPIC -o $@ $<';
# First build a shared object # First build a shared object
# Provide both a default and non-default load symbol # Provide both a default and non-default load symbol
@@ -25,6 +23,7 @@ int plugin_is_GPL_compatible;
int int
testload_gmk_setup (gmk_floc *pos) testload_gmk_setup (gmk_floc *pos)
{ {
(void)pos;
gmk_eval ("TESTLOAD = implicit", 0); gmk_eval ("TESTLOAD = implicit", 0);
return 1; return 1;
} }
@@ -32,6 +31,7 @@ testload_gmk_setup (gmk_floc *pos)
int int
explicit_setup (gmk_floc *pos) explicit_setup (gmk_floc *pos)
{ {
(void)pos;
gmk_eval ("TESTLOAD = explicit", 0); gmk_eval ("TESTLOAD = explicit", 0);
return 1; return 1;
} }
@@ -39,7 +39,15 @@ EOF
close($F) or die "close: testload.c: $!\n"; close($F) or die "close: testload.c: $!\n";
# Make sure we can compile # Make sure we can compile
run_make_test('testload.so: testload.c ; @'.$sobuild, '', ''); # CONFIG_FLAGS are loaded from config-flags.pm and set by configure
my $sobuild = "$CONFIG_FLAGS{CC} ".($srcdir? "-I$srcdir":'')." $CONFIG_FLAGS{CPPFLAGS} $CONFIG_FLAGS{CFLAGS} -shared -fPIC $CONFIG_FLAGS{LDFLAGS} -o testload.so testload.c";
my $clog = `$sobuild 2>&1`;
if ($? != 0) {
$verbose and print "Failed to build testload.so:\n$sobuild\n$_";
return -1;
}
# TEST 1 # TEST 1
run_make_test(q! run_make_test(q!

View File

@@ -6,8 +6,6 @@ $details = "Verify the different aspects of the shared object API.";
# Don't do anything if this system doesn't support "load" # Don't do anything if this system doesn't support "load"
exists $FEATURES{load} or return -1; exists $FEATURES{load} or return -1;
my $sobuild = '$(CC) '.($srcdir? "-I$srcdir":'').' -g -shared -fPIC -o $@ $<';
# First build a shared object # First build a shared object
# Provide both a default and non-default load symbol # Provide both a default and non-default load symbol
@@ -38,7 +36,7 @@ test_expand (const char *val)
static char * static char *
test_noexpand (const char *val) test_noexpand (const char *val)
{ {
char *str = gmk_alloc (strlen (val)); char *str = gmk_alloc (strlen (val) + 1);
strcpy (str, val); strcpy (str, val);
return str; return str;
} }
@@ -74,7 +72,13 @@ testapi_gmk_setup ()
EOF EOF
close($F) or die "close: testapi.c: $!\n"; close($F) or die "close: testapi.c: $!\n";
run_make_test('testapi.so: testapi.c ; @'.$sobuild, '', ''); my $sobuild = "$CONFIG_FLAGS{CC} ".($srcdir? "-I$srcdir":'')." $CONFIG_FLAGS{CPPFLAGS} $CONFIG_FLAGS{CFLAGS} -shared -fPIC $CONFIG_FLAGS{LDFLAGS} -o testapi.so testapi.c";
my $clog = `$sobuild 2>&1`;
if ($? != 0) {
$verbose and print "Failed to build testapi.so:\n$sobuild\n$_";
return -1;
}
# TEST 1 # TEST 1
# Check the gmk_expand() function # Check the gmk_expand() function

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