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

View File

@@ -72,7 +72,7 @@ With suggestions/comments/bug reports from a cast of ... well ...
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.
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.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.
#
# 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
#
# Copyright (C) 1997-2013 Free Software Foundation, Inc.
# Copyright (C) 1997-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
@@ -40,15 +40,11 @@ else
endif
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 \
signame.c strcache.c variable.c version.c vpath.c hash.c \
$(remote)
if HAVE_GUILE
make_SOURCES += guile.c
endif
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 \
@@ -90,13 +86,6 @@ EXTRA_DIST = README build.sh.in $(man_MANS) \
DISTCLEANFILES = build.sh
# Forward targets
html:
cd doc && $(MAKE) $(AM_MAKEFLAGS) $@
.PHONY: html
# --------------- Internationalization Section
localedir = $(datadir)/locale
@@ -183,7 +172,7 @@ loadavg_LDADD = @GETLOADAVG_LIBS@
#
MAKETESTFLAGS =
check-regression:
check-regression: tests/config-flags.pm
@if test -f '$(srcdir)/tests/run_make_tests'; then \
if $(PERL) -v >/dev/null 2>&1; then \
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
# '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.
#
# 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-*-
History of user-visible changes.
09 Oct 2013
05 Oct 2014
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.
See the README file and the GNU make manual for instructions for
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)
@@ -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
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!
As a result of parser enhancements, three backward-compatibility issues
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
might have caused the target to rebuild. Starting with the _next_
release of GNU make, '$?' will contain all prerequisites that caused
the target to be considered out of date. See this Savannah bug:
http://savannah.gnu.org/bugs/index.php?func=detailitem&item_id=16051
the target to be considered out of date.
See http://savannah.gnu.org/bugs/?16051
* WARNING: Backward-incompatibility!
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
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
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)'.
* A suffix rule `.X.a' now produces two pattern rules:
(%.o): %.X # Previous versions produced only this.
%.a: %.X # Now produces this as well, just like other suffixes.
(%.o): %.X # Previous versions produced only this.
%.a: %.X # Now produces this as well, just like other suffixes.
* The new flag `--warn-undefined-variables' says to issue a warning message
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
Make runs. Instead, only variables specified on the command line or in
the environment are exported by default. To export others, use:
export VARIABLE
export VARIABLE
or you can define variables with:
export VARIABLE = VALUE
export VARIABLE = VALUE
or:
export VARIABLE := VALUE
export VARIABLE := VALUE
You can use just:
export
export
or:
.EXPORT_ALL_VARIABLES:
.EXPORT_ALL_VARIABLES:
to get the old behavior. See the node `Variables/Recursion' in the manual
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
include, like this:
include file1 file2
include file1 file2
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
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.
* 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
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.)
-------------------------------------------------------------------------------
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Copyright (C) 1988-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

View File

@@ -3,7 +3,7 @@
# NOTE: If you have no 'make' program at all to process this makefile,
# 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.
#
# 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/
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\
/INCREMENTAL:no /OUT:WinRel/make.exe
/STACK:0x400000 /INCREMENTAL:no /OUT:WinRel/make.exe
all: config.h subproc Release Debug
@@ -72,7 +72,7 @@ $(OUTDIR):
LIBS = kernel32.lib user32.lib advapi32.lib
#guile = $(OUTDIR)/guile.obj
guile = $(OUTDIR)/guile.obj
OBJS = \
$(OUTDIR)/ar.obj \
@@ -89,6 +89,7 @@ OBJS = \
$(OUTDIR)/hash.obj \
$(OUTDIR)/implicit.obj \
$(OUTDIR)/job.obj \
$(OUTDIR)/load.obj \
$(OUTDIR)/main.obj \
$(OUTDIR)/misc.obj \
$(OUTDIR)/output.obj \
@@ -105,6 +106,7 @@ OBJS = \
$(OUTDIR)/fnmatch.obj \
$(OUTDIR)/dirent.obj \
$(OUTDIR)/pathstuff.obj \
$(OUTDIR)/posixfcn.obj \
$(guile)
$(OUTDIR)/make.exe: $(OUTDIR) $(OBJS)
@@ -121,5 +123,7 @@ $(OUTDIR)/fnmatch.obj : glob/fnmatch.c
$(CC) $(CFLAGS) /c $?
$(OUTDIR)/dirent.obj : w32/compat/dirent.c
$(CC) $(CFLAGS) /c $?
$(OUTDIR)/posixfcn.obj : w32/compat/posixfcn.c
$(CC) $(CFLAGS) /c $?
$(OUTDIR)/pathstuff.obj : w32/pathstuff.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.
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.
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.
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.
-------------------------------------------------------------------------------
Copyright (C) 1996-2013 Free Software Foundation, Inc.
Copyright (C) 1996-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

View File

@@ -293,7 +293,7 @@ Bug reports:
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.
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.
GNU Make is free software; you can redistribute it and/or modify it under the

View File

@@ -1,7 +1,7 @@
-*-text-*-
-------------------------------------------------------------------------------
Copyright (C) 2002-2013 Free Software Foundation, Inc.
Copyright (C) 2002-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
@@ -31,12 +31,17 @@ make source code via Git from the FSF's Savannah project
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.
For developers, I'm still new to Git myself, so I don't have a ton of advice.
In this release we will continue to create ChangeLog files by hand so please
don't forget to update the ChangeLog.
Starting with GNU make 4.0 we no longer keep a separate ChangeLog file in
source control. We use the Gnulib git-to-changelog conversion script to
convert the Git comments into ChangeLog-style entries for release. As a
result, please format your Git comments carefully so they will look clean
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").
@@ -59,12 +64,13 @@ diff chunks in the same file. There is a video available which helps a lot.
Coding Standards
----------------
GNU make code adheres to the GNU Coding Standards. 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.
GNU make code adheres to the GNU Coding Standards. Please use only spaces and
no TAB characters in source code.
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
@@ -73,7 +79,7 @@ Building From Git
To build GNU make from Git, you will need Autoconf, Automake, and
Gettext, and any tools that those utilities require (GNU m4, Perl,
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
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
to the point where you can run "make".
1) $ autoreconf -i
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.
Ignore them, they are harmless.
2) $ ./configure
Generate a Makefile
3) $ make update
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
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
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.
@@ -158,29 +160,48 @@ Steps to Release
----------------
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 EDITION value in the doc/make.texi file.
* 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
current "SCM" entry in both "Component Version" and "Fix Release" fields
to refer to the new release, for "Bugs" and "Patches".
* Update the Savannah bug list URL in the NEWS file to use the correct
"Fixed Release" ID number.
to refer to the new release. The "Rank" field should be 10 less than the
previous release so it orders properly.
* In Savannah create a new entry for the "Component Version" and "Fix
Release" fields:
- Value: SCM
- Rank: 20
- 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,
and VER is the release version.
* Push everything:
git push --tags origin master
* Create the new release in the Savannah "Bugs" Administration for
both the "Component Version" and "Fixed Release" fields.
* Create the new release in the Savannah "Patches" Administration for
the "Fixed Release" field.
Start the next release:
* Update configure.ac and add a ".90" to the release number.
* Update the NEWS file with a new section for the release / date.
* Update the Savannah URL for the bugs fixed in the NEWS section.
Publishing a Package
@@ -224,15 +245,22 @@ Create the announcement in a text file, then sign it with GPG.
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
CC: info-gnu@gnu.org
BCC: make-alpha@gnu.org
Announce the release:
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

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.
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,
# 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.
#
# 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.
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
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
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
Copyright (C) 1995-2013 Free Software Foundation, Inc.
Copyright (C) 1995-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
@@ -42,7 +42,7 @@ MyExecute (char **argv)
buffer = AllocMem (len, MEMF_ANY);
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;

View File

@@ -1,5 +1,5 @@
/* 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.
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.
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Copyright (C) 1988-2014 Free Software Foundation, Inc.
This file is part of GNU Make.
@@ -43,7 +43,7 @@ ar_name (const char *name)
return 0;
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;
}
@@ -120,7 +120,7 @@ ar_member_date (const char *name)
int
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;
}
#else
@@ -144,24 +144,24 @@ ar_touch (const char *name)
switch (ar_member_touch (arname, memname))
{
case -1:
error (NILF, _("touch: Archive '%s' does not exist"), arname);
OS (error, NILF, _("touch: Archive '%s' does not exist"), arname);
break;
case -2:
error (NILF, _("touch: '%s' is not a valid archive"), arname);
OS (error, NILF, _("touch: '%s' is not a valid archive"), arname);
break;
case -3:
perror_with_name ("touch: ", arname);
break;
case 1:
error (NILF,
_("touch: Member '%s' does not exist in '%s'"), memname, arname);
OSS (error, NILF,
_("touch: Member '%s' does not exist in '%s'"), memname, arname);
break;
case 0:
val = 0;
break;
default:
error (NILF,
_("touch: Bad return code from ar_member_touch on '%s'"), name);
OS (error, NILF,
_("touch: Bad return code from ar_member_touch on '%s'"), name);
}
free (arname);
@@ -172,10 +172,20 @@ ar_touch (const char *name)
/* 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
{
const char *arname;
const char *pattern;
#ifdef VMS
char *suffix;
#endif
unsigned int size;
struct nameseq *chain;
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. */
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;
state->chain = new;
++state->n;
@@ -248,7 +264,9 @@ ar_glob (const char *arname, const char *member_pattern, unsigned int size)
struct nameseq *n;
const char **names;
unsigned int i;
#ifdef VMS
char *vms_member_pattern;
#endif
if (! glob_pattern_p (member_pattern, 1))
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. */
state.arname = arname;
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.chain = 0;
state.n = 0;
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)
return 0;

287
arscan.c
View File

@@ -1,5 +1,5 @@
/* 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.
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"
#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
#include <fcntl.h>
#else
@@ -30,99 +35,139 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#include <credef.h>
#include <descrip.h>
#include <ctype.h>
#include <ssdef.h>
#include <stsdef.h>
#include <rmsdef.h>
globalvalue unsigned int LBR$_HDRTRUNC;
#if __DECC
#include <unixlib.h>
#include <lbr$routines.h>
#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 char *VMS_saved_memname;
static time_t VMS_member_date;
static const void *VMS_saved_arg;
static long int (*VMS_function) ();
static long int VMS_function_ret;
/* This is a callback procedure for lib$get_index */
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;
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 =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
/* Only need the module definition */
struct mhddef *mhd;
char filename[128];
bufdesc.dsc$a_pointer = filename;
bufdesc.dsc$w_length = sizeof (filename);
status = lbr$set_module (&VMS_lib_idx, rfa, &bufdesc,
&bufdesc.dsc$w_length, 0);
if (! (status & 1))
/* If a previous callback is non-zero, just return that status */
if (VMS_function_ret)
{
error (NILF, _("lbr$set_module() failed to extract module info, status = %d"),
status);
lbr$close (&VMS_lib_idx);
return 0;
return SS$_NORMAL;
}
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
/* 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
*/
status = lbr$set_module(&VMS_lib_idx, rfa, &bufdesc, &buffer_length, 0);
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 */
val = decc$fix_time (&mhd->mhd$l_datim);
lbr$close(&VMS_lib_idx);
/*
* 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.
*/
tmp = localtime (&val);
val -= tmp->tm_gmtoff;
}
return status;
}
#ifdef TEST
/* When testing this code, it is useful to know the length returned */
printf("Input length = %d, actual = %d\n",
bufdesc.dsc$w_length, buffer_length);
#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++)
filename[i] = _tolower ((unsigned char)module->dsc$a_pointer[i]);
filename[i] = _tolower((unsigned char )module->dsc$a_pointer[i]);
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 =
(*VMS_function) (-1, filename, 0, 0, 0, 0, val, 0, 0, 0,
VMS_saved_memname);
if (fnval)
{
VMS_member_date = fnval;
return 0;
}
else
return 1;
free(filename);
return SS$_NORMAL;
}
/* Takes three arguments ARCHIVE, FUNCTION and ARG.
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. */
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 =
{ 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
unsigned long func = LBR$C_READ;
unsigned long type = LBR$C_TYP_UNK;
unsigned long index = 1;
const unsigned long func = LBR$C_READ;
const unsigned long type = LBR$C_TYP_UNK;
const unsigned long index = 1;
unsigned long lib_idx;
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);
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);
/* Null filenames do not exist */
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 (p)
*p = '\0';
if (!$VMS_STATUS_SUCCESS(status))
{
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_member_date = (time_t) -1;
lbr$get_index (&VMS_lib_idx, &index, VMS_get_member_info, 0);
/* Clear the return status, as we are supposed to stop calling the
callback function if it becomes non-zero, and this is a static
variable. */
VMS_function_ret = 0;
/* Undo the damage. */
if (p)
*p = '.';
status = lbr$get_index(&VMS_lib_idx, &index, VMS_get_member_info, NULL, 0);
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 */
@@ -251,10 +325,10 @@ ar_scan (const char *archive, ar_member_func_t function, const void *arg)
#endif
#ifndef WINDOWS32
# ifndef __BEOS__
# if !defined (__ANDROID__) && !defined (__BEOS__)
# include <ar.h>
# 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.
*/
# 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 /* !AIAMAG */
}
#endif /* !VMS */
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

View File

@@ -2,7 +2,7 @@
# Shell script to build GNU Make in the absence of any 'make' program.
# @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.
#
# GNU Make is free software; you can redistribute it and/or modify it under
@@ -22,11 +22,11 @@
srcdir='@srcdir@'
CC='@CC@'
CFLAGS='@CFLAGS@'
CFLAGS='@CFLAGS@ @GUILE_CFLAGS@'
CPPFLAGS='@CPPFLAGS@'
LDFLAGS='@LDFLAGS@'
LDFLAGS='@AM_LDFLAGS@ @LDFLAGS@'
ALLOCA='@ALLOCA@'
LOADLIBES='@LIBS@ @LIBINTL@'
LOADLIBES='@LIBS@ @GUILE_LIBS@ @LIBINTL@'
eval extras=\'@LIBOBJS@\'
REMOTE='@REMOTE@'
GLOBLIB='@GLOBLIB@'
@@ -46,7 +46,7 @@ includedir=${prefix}/include
localedir=${prefix}/share/locale
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.
set -e

View File

@@ -1,5 +1,5 @@
@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
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
set GUILECFLAGS=
set GUILELIBS=
set GUILESRC=
set NOGUILE=
set OPT=-O2
set COMPILER=
@@ -79,7 +78,6 @@ GoTo GuileDone
echo "pkg-config not found, building without Guile"
:GuileDone
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 "%COMPILER%" == "gcc" if "%OPT%" == "-O0" echo "Building without compiler optimizations"
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
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
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
:LinkDbg
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
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
if "%GUILESRC%" == "" GoTo LinkRel
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
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
echo WinRel\guile.obj >>link.rel
:LinkRel
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 ./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
@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
:LinkGCC
@echo off
Rem The version NN of libgnumake-NN.dll.a should be bumped whenever
Rem the API changes in binary-incompatible manner.
@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
:Usage
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
:BuildEnd
@echo off
set GUILEOBJ=
set GUILESRC=
set GUILELIBS=
set GUILECFLAGS=
set PKGMSC=

View File

@@ -1,5 +1,5 @@
/* 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.
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
this program. If not, see <http://www.gnu.org/licenses/>. */
#include <dlfcn.h>
#include "makeint.h"
#include "filedef.h"
#include "dep.h"
@@ -403,7 +401,7 @@ chop_commands (struct commands *cmds)
CMDS->any_recurse flag. */
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->command_lines = lines;
@@ -587,7 +585,7 @@ fatal_error_signal (int sig)
if (sig == SIGQUIT)
/* We don't want to send ourselves SIGQUIT, because it will
cause a core dump. Just exit instead. */
exit (EXIT_FAILURE);
exit (MAKE_TROUBLE);
#endif
#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 (on_behalf_of)
error (NILF, _("*** [%s] Archive member '%s' may be bogus; not deleted"),
on_behalf_of, file->name);
OSS (error, NILF,
_("*** [%s] Archive member '%s' may be bogus; not deleted"),
on_behalf_of, file->name);
else
error (NILF, _("*** Archive member '%s' may be bogus; not deleted"),
file->name);
OS (error, NILF,
_("*** Archive member '%s' may be bogus; not deleted"),
file->name);
}
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)
{
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
error (NILF, _("*** Deleting file '%s'"), file->name);
OS (error, NILF, _("*** Deleting file '%s'"), file->name);
if (unlink (file->name) < 0
&& errno != ENOENT) /* It disappeared; so what. */
perror_with_name ("unlink: ", file->name);

View File

@@ -1,5 +1,5 @@
/* 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.
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-*-
Copyright (C) 1995-2013 Free Software Foundation, Inc.
Copyright (C) 1995-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
@@ -318,6 +318,12 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
/* Define if you have the kstat library (-lkstat). */
/* #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). */
/* #undef HAVE_LIBSUN */

View File

@@ -1,6 +1,6 @@
/* 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.
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.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.
System headers sometimes define this.
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). */
/* #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. */
#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 _DIRENT_HAVE_D_NAMLEN */
/* On older systems without 7.0 backport of CRTL the first one is defined */
#ifdef __CRTL_VER
# if __CRTL_VER < 70000000
# define HAVE_VMSDIR_H 1
# endif
#else
# if __VMS_VER < 70000000
# define HAVE_VMSDIR_H 1
# endif
/* On older systems without 7.0 backport of CRTL use non-VMS code for opendir() etc. */
#if __CRTL_VER < 70000000
# define HAVE_VMSDIR_H 1
#endif
#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 */
#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. */
#define MAKE_HOST "VMS"

View File

@@ -1,6 +1,6 @@
/* 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.
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. */
/* #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'. */
/* #undef HAVE_STRUCT_NLIST_N_UN_N_NAME */

1
config/.gitignore vendored
View File

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

View File

@@ -33,7 +33,7 @@
* 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.
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
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
# Copyright (C) 2002-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

View File

@@ -1,7 +1,7 @@
# Test if the system uses DOS-style pathnames (drive specs and backslashes)
# By Paul Smith <psmith@gnu.org>. Based on dos.m4 by Jim Meyering.
#
# Copyright (C) 1993-2013 Free Software Foundation, Inc.
# Copyright (C) 1993-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

View File

@@ -1,6 +1,6 @@
/* 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.
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.
#
# Copyright (C) 1993-2013 Free Software Foundation, Inc.
# Copyright (C) 1993-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
@@ -16,7 +16,7 @@
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
AC_INIT([GNU make],[4.0],[bug-make@gnu.org])
AC_INIT([GNU make],[4.1],[bug-make@gnu.org])
AC_PREREQ([2.62])
@@ -26,9 +26,13 @@ AC_CONFIG_SRCDIR([vpath.c])
AC_CONFIG_HEADERS([config.h])
# 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.
AC_USE_SYSTEM_EXTENSIONS
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_RANLIB
@@ -37,6 +41,9 @@ AC_CHECK_PROG([AR], [ar], [ar], [ar])
# Perl is needed for the test suite (only)
AC_CHECK_PROG([PERL], [perl], [perl], [perl])
# Needed for w32/Makefile.am
AM_PROG_AR
# Specialized system macros
AC_CANONICAL_HOST
AC_AIX
@@ -44,7 +51,6 @@ AC_ISC_POSIX
AC_MINIX
# Enable gettext, in "external" mode.
AM_GNU_GETTEXT_VERSION([0.18.1])
AM_GNU_GETTEXT([external])
@@ -134,7 +140,7 @@ AC_CHECK_FUNCS([strdup strndup mkstemp mktemp fdopen fileno \
dup dup2 getcwd realpath sigsetmask sigaction \
getgroups seteuid setegid setlinebuf setreuid setregid \
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
# function is not declared without special flags, which themselves cause
@@ -243,8 +249,8 @@ AS_IF([test "$PATH_SEPARATOR" = ';'],
AC_SUBST([REMOTE]) REMOTE=stub
use_customs=false
AC_ARG_WITH([customs],
[ AC_HELP_STRING([--with-customs=DIR],
[enable remote jobs via Customs--see README.customs])],
[AC_HELP_STRING([--with-customs=DIR],
[enable remote jobs via Customs--see README.customs])],
[ AS_CASE([$withval], [n|no], [:],
[make_cppflags="$CPPFLAGS"
AS_CASE([$withval],
@@ -317,20 +323,20 @@ AC_ARG_ENABLE([load],
[make_cv_load="$enableval" user_load="$enableval"],
[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])
# 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/],
[*/no/*], [make_cv_load=no],
[AC_DEFINE(MAKE_LOAD, 1,
[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.
# See if we can figure it out. Unfortunately this is very difficult.
# 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.
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!

View File

@@ -1,5 +1,5 @@
@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
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.
Copyright (C) 1999-2013 Free Software Foundation, Inc.
Copyright (C) 1999-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

View File

@@ -1,5 +1,5 @@
/* 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.
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[]
#ifdef VMS
= ".exe .olb .ln .obj .c .cxx .cc .pas .p .for .f .r .y .l .mar \
.s .ss .i .ii .mod .sym .def .h .info .dvi .tex .texinfo .texi .txinfo \
.w .ch .cweb .web .com .sh .elc .el";
/* VMS should include all UNIX/POSIX + some VMS extensions */
= ".out .exe .a .olb .hlb .tlb .mlb .ln .o .obj .c .cxx .cc .cpp .pas .p \
.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__)
= ".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 \
@@ -53,19 +55,35 @@ static char default_suffixes[]
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) $@ $<" },
#else
{ "(%)", "%",
"$(AR) $(ARFLAGS) $@ $<" },
#endif
/* The X.out rules are only in BSD's default set because
BSD Make has no null-suffix rules, so 'foo.out' and
'foo' are the same thing. */
#ifdef VMS
{ "%.exe", "%",
"copy $< $@" },
#else
"$(CP) $< $@" },
#endif
{ "%.out", "%",
"@rm -f $@ \n cp $< $@" },
#endif
/* Syntax is "ctangle foo.w foo.ch foo.c". */
{ "%.c", "%.w %.ch",
"$(CTANGLE) $^ $@" },
@@ -78,18 +96,20 @@ static struct pspec default_pattern_rules[] =
static struct pspec default_terminal_rules[] =
{
#ifdef VMS
/* RCS. */
{ "%", "%$$5lv", /* Multinet style */
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
"if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
{ "%", "[.$$rcs]%$$5lv", /* Multinet style */
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
"if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
{ "%", "%_v", /* Normal style */
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
"if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
{ "%", "[.rcs]%_v", /* Normal style */
"if f$$search($@) .nes. \"\" then +$(CHECKOUT,v)" },
"if f$$search(\"$@\") .nes. \"\" then +$(CHECKOUT,v)" },
/* SCCS. */
/* ain't no SCCS on vms */
#else
/* RCS. */
{ "%", "%,v",
@@ -108,7 +128,7 @@ static struct pspec default_terminal_rules[] =
{ 0, 0, 0 }
};
static char *default_suffix_rules[] =
static const char *default_suffix_rules[] =
{
#ifdef VMS
".obj.exe",
@@ -149,6 +169,8 @@ static char *default_suffix_rules[] =
"$(COMPILE.c)/noprep/noobj/machine /list=$@ $<",
".c.obj",
"$(COMPILE.c) /obj=$@ $<",
".c.o",
"$(COMPILE.c) /obj=$@ $<",
".cc.ii",
"$(COMPILE.cc)/prep /list=$@ $<",
".cc.ss",
@@ -157,12 +179,20 @@ static char *default_suffix_rules[] =
"$(COMPILE.cc)/noprep/noobj/machine /list=$@ $<",
".cc.obj",
"$(COMPILE.cc) /obj=$@ $<",
".cc.o",
"$(COMPILE.cc) /obj=$@ $<",
".cxx.obj",
"$(COMPILE.cxx) /obj=$@ $<",
".cxx.o",
"$(COMPILE.cxx) /obj=$@ $<",
".for.obj",
"$(COMPILE.for) /obj=$@ $<",
".for.o",
"$(COMPILE.for) /obj=$@ $<",
".pas.obj",
"$(COMPILE.pas) /obj=$@ $<",
".pas.o",
"$(COMPILE.pas) /obj=$@ $<",
".y.c",
"$(YACC.y) $< \n rename y_tab.c $@",
@@ -322,7 +352,8 @@ static const char *default_variables[] =
#ifdef __VAX
"ARCH", "VAX",
#endif
"AR", "library/obj",
"AR", "library",
"LIBRARY", "library",
"ARFLAGS", "/replace",
"AS", "macro",
"MACRO", "macro",
@@ -332,15 +363,21 @@ static const char *default_variables[] =
"CC", "cc",
#endif
"CD", "builtin_cd",
"MAKE", "make",
"ECHO", "write sys$$output \"",
"ECHO", "builtin_echo",
#ifdef GCC_IS_NATIVE
"C++", "gcc/plus",
"CXX", "gcc/plus",
#else
"C++", "cxx",
"CXX", "cxx",
#ifndef __ia64
"CXXLD", "cxxlink",
"CXXLINK", "cxxlink",
#else
/* CXXLINK is not used on VMS/IA64 */
"CXXLD", "link",
"CXXLINK", "link",
#endif
#endif
"CO", "co",
"CPP", "$(CC) /preprocess_only",
@@ -393,6 +430,7 @@ static const char *default_variables[] =
"MV", "rename/new_version",
"CP", "copy",
".LIBPATTERNS", "%.olb lib%.a",
#else /* !VMS */
@@ -523,6 +561,8 @@ static const char *default_variables[] =
".LIBPATTERNS", "lib%.a $(DJDIR)/lib/lib%.a",
#elif defined(__APPLE__)
".LIBPATTERNS", "lib%.dylib lib%.a",
#elif defined(__CYGWIN__) || defined(WINDOWS32)
".LIBPATTERNS", "lib%.dll.a %.dll.a lib%.a %.lib lib%.dll %.dll",
#else
".LIBPATTERNS", "lib%.so lib%.a",
#endif
@@ -546,8 +586,8 @@ set_default_suffixes (void)
else
{
struct dep *d;
char *p = default_suffixes;
suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ (&p, struct dep),
const char *p = default_suffixes;
suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ ((char **)&p, struct dep),
NULL);
for (d = suffix_file->deps; d; d = d->next)
d->file->builtin = 1;
@@ -564,7 +604,7 @@ set_default_suffixes (void)
void
install_default_suffix_rules (void)
{
char **s;
const char **s;
if (no_builtin_rules_flag)
return;
@@ -576,7 +616,7 @@ install_default_suffix_rules (void)
assert (f->cmds == 0);
f->cmds = xmalloc (sizeof (struct commands));
f->cmds->fileinfo.filenm = 0;
f->cmds->commands = s[1];
f->cmds->commands = xstrdup (s[1]);
f->cmds->command_lines = 0;
f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
f->builtin = 1;

2
dep.h
View File

@@ -1,5 +1,5 @@
/* 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.
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.
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Copyright (C) 1988-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
@@ -674,7 +674,7 @@ dir_contents_file_exists_p (struct directory_contents *dir,
if (d == 0)
{
if (errno)
fatal (NILF, "INTERNAL: readdir: %s\n", strerror (errno));
pfatal_with_name ("INTERNAL: readdir");
break;
}
@@ -1172,13 +1172,6 @@ read_dirstream (__ptr_t stream)
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
* macro for stat64(). If stat is a macro, make a local wrapper function to
* invoke it.
@@ -1224,7 +1217,7 @@ dir_setup_glob (glob_t *gl)
{
gl->gl_opendir = open_dirstream;
gl->gl_readdir = read_dirstream;
gl->gl_closedir = ansi_free;
gl->gl_closedir = free;
gl->gl_stat = local_stat;
/* We don't bother setting gl_lstat, since glob never calls it.
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
make-stds.texi
stamp-vti

View File

@@ -1,5 +1,5 @@
# -*-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.
#
# 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
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
@include version.texi
@set EDITION 0.72
@set EDITION 0.73
@settitle GNU @code{make}
@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,
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
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
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.
* Chained Rules:: How to use a chain of 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
@var{immediate} : @var{immediate} ; @var{deferred}
@var{deferred}
@var{deferred}
@end example
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)
@findex .PHONY
The phony target will cease to work if anything ever does create a file
named @file{clean} in this directory. Since it has no prerequisites, the
file @file{clean} would inevitably be considered up to date, and its
recipe would not be executed. To avoid this problem, you can explicitly
declare the target to be phony, using the special target @code{.PHONY}
In this example, the @file{clean} target will not work properly if a
file named @file{clean} is ever created in this directory. Since it
has no prerequisites, @file{clean} would always be considered up to
date and its recipe would not be executed. To avoid this problem you
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:
@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
@group
.PHONY: clean
@@ -2616,12 +2600,16 @@ clean:
@end group
@end example
Another example of the usefulness of phony targets is in conjunction
with recursive invocations of @code{make} (for more information, see
@ref{Recursion, ,Recursive Use of @code{make}}). In this case the
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
whose recipe is a shell loop over the sub-directories, like this:
@noindent
Once this is done, @samp{make clean} will run the recipe regardless of
whether there is a file named @file{clean}.
Phony targets are also useful in conjunction with recursive
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
@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
one rule.
By declaring the sub-directories as phony targets (you must do this as
the sub-directory obviously always exists; otherwise it won't be built)
you can remove these problems:
By declaring the sub-directories as @code{.PHONY} targets (you must do
this as the sub-directory obviously always exists; otherwise it won't
be built) you can remove these problems:
@example
@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
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
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
@@ -5809,7 +5802,7 @@ CFLAGS += -pg # enable profiling
@noindent
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
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
variable, meaning @w{@samp{$(includes) -O}} is @emph{not} expanded when
@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}
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)}
@item .RECIPEPREFIX
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:
@example
$(file @var{op} @var{filename},@var{text})
$(file @var{op} @var{filename}[,@var{text}])
@end example
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
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,
a final newline will be written. The result of evaluating the
@code{file} function is always the empty string.
even if empty, a final newline will be written. If the @var{text}
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
the write operation fails.
@@ -7556,7 +7572,7 @@ input file, you might write your recipe like this:
@example
@group
program: $(OBJECTS)
$(file >$@@.in,) $(foreach O,$^,$(file >>$@@.in,$O))
$(file >$@@.in) $(foreach O,$^,$(file >>$@@.in,$O))
$(CMD) $(CMDFLAGS) @@$@@.in
@@rm $@@.in
@end group
@@ -8934,7 +8950,7 @@ retained for compatibility.
@menu
* Using Implicit:: How to use an existing implicit rule
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.
* Chained Rules:: How to use a chain of 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
want @code{make} to use, and you know it will choose that one because you
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.
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
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
implicit rules (@pxref{Catalogue of Rules, , Catalogue of Implicit
implicit rules (@pxref{Catalogue of Rules, , Catalogue of Built-In
Rules}).
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}).
@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 rule, implicit, predefined
@@ -11572,7 +11588,7 @@ functionality in that it will check out SCCS files for makefiles.
@item
Various new built-in implicit rules.
@xref{Catalogue of Rules, ,Catalogue of Implicit Rules}.
@xref{Catalogue of Rules, ,Catalogue of Built-In Rules}.
@item
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,
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},
for other summaries.

View File

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

35
file.c
View File

@@ -1,5 +1,5 @@
/* 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.
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;
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
one given in the rule explicitly mentioning this name,
but give a message to let the user know what's going on. */
if (to_file->cmds->fileinfo.filenm != 0)
error (&from_file->cmds->fileinfo,
l + strlen (to_file->cmds->fileinfo.filenm) + INTSTR_LENGTH,
_("Recipe was specified for file '%s' at %s:%lu,"),
from_file->name, to_file->cmds->fileinfo.filenm,
to_file->cmds->fileinfo.lineno);
else
error (&from_file->cmds->fileinfo,
error (&from_file->cmds->fileinfo, l,
_("Recipe for file '%s' was found by implicit rule search,"),
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'."),
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'."),
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);
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'"),
from_file->name, to_hname);
OSS (fatal, NILF, _("can't rename single-colon '%s' to double-colon '%s'"),
from_file->name, to_hname);
if (!to_file->double_colon && from_file->double_colon)
{
if (to_file->is_target)
fatal (NILF, _("can't rename double-colon '%s' to single-colon '%s'"),
from_file->name, to_hname);
OSS (fatal, NILF,
_("can't rename double-colon '%s' to single-colon '%s'"),
from_file->name, to_hname);
else
to_file->double_colon = from_file->double_colon;
}
@@ -393,7 +397,8 @@ remove_intermediates (int sig)
if (!f->dontcare)
{
if (sig)
error (NILF, _("*** Deleting intermediate file '%s'"), f->name);
OS (error, NILF,
_("*** Deleting intermediate file '%s'"), f->name);
else
{
if (! doneany)
@@ -803,10 +808,11 @@ file_timestamp_cons (const char *fname, time_t stamp, long int ns)
&& product <= ts && ts <= ORDINARY_MTIME_MAX))
{
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;
file_timestamp_sprintf (buf, ts);
error (NILF, _("%s: Timestamp out of range; substituting %s"),
fname ? fname : _("Current time"), buf);
OSS (error, NILF,
_("%s: Timestamp out of range; substituting %s"), f, buf);
}
return ts;
@@ -1046,9 +1052,10 @@ print_file_data_base (void)
/* Verify the integrity of the data base of files. */
#define VERIFY_CACHED(_p,_n) \
do{\
if (_p->_n && _p->_n[0] && !strcache_iscached (_p->_n)) \
error (NULL, _("%s: Field '%s' not cached: %s"), _p->name, # _n, _p->_n); \
do{ \
if (_p->_n && _p->_n[0] && !strcache_iscached (_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)
static void

View File

@@ -1,5 +1,5 @@
/* 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.
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)))
/* 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.
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.
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Copyright (C) 1988-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
@@ -519,8 +519,25 @@ func_notdir_suffix (char *o, char **argv, const char *funcname)
int is_suffix = funcname[0] == 's';
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)
#endif
{
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)
{
#ifdef VMS
o = variable_buffer_output (o, ",", 1);
#else
o = variable_buffer_output (o, " ", 1);
#endif
doneany = 1;
}
}
@@ -572,8 +593,21 @@ func_basename_dir (char *o, char **argv, const char *funcname)
int is_basename = funcname[0] == 'b';
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)
#endif
{
const char *p = p2 + len - 1;
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. */
o = variable_buffer_output (o, p2, len);
#ifdef VMS
o = variable_buffer_output (o, ",", 1);
#else
o = variable_buffer_output (o, " ", 1);
#endif
doneany = 1;
}
@@ -726,7 +764,7 @@ check_numeric (const char *s, const char *msg)
break;
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]);
if (i == 0)
fatal (*expanding_var,
_("first argument to 'word' function must be greater than 0"));
O (fatal, *expanding_var,
_("first argument to 'word' function must be greater than 0"));
end_p = argv[1];
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]);
if (start < 1)
fatal (*expanding_var,
"invalid first argument to 'wordlist' function: '%d'", start);
ON (fatal, *expanding_var,
"invalid first argument to 'wordlist' function: '%d'", start);
count = atoi (argv[1]) - start + 1;
@@ -1082,10 +1120,10 @@ func_error (char *o, char **argv, const char *funcname)
switch (*funcname)
{
case 'e':
fatal (reading_file, "%s", msg);
OS (fatal, reading_file, "%s", msg);
case 'w':
error (reading_file, "%s", msg);
OS (error, reading_file, "%s", msg);
break;
case 'i':
@@ -1094,7 +1132,7 @@ func_error (char *o, char **argv, const char *funcname)
break;
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. */
@@ -1416,7 +1454,7 @@ int shell_function_pid = 0, shell_function_completed;
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;
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)
{
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;
}
}
tmpErr = GetStdHandle (STD_ERROR_HANDLE);
tmpErr = (HANDLE)_get_osfhandle (errfd);
if (DuplicateHandle (GetCurrentProcess (), tmpErr,
GetCurrentProcess (), &hErr,
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)
{
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;
}
}
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;
}
@@ -1495,7 +1535,7 @@ windows32_openpipe (int *pipedes, pid_t *pid_p, char **command_argv, char **envp
if (!hProcess)
{
error (NILF, _("windows32_openpipe(): process_init_fd() failed\n"));
O (error, NILF, _("windows32_openpipe(): process_init_fd() failed\n"));
return -1;
}
@@ -1608,7 +1648,7 @@ char *
func_shell_base (char *o, char **argv, int trim_newlines)
{
fprintf (stderr, "This platform does not support shell\n");
die (EXIT_FAILURE);
die (MAKE_TROUBLE);
return NULL;
}
@@ -1689,7 +1729,7 @@ func_shell_base (char *o, char **argv, int trim_newlines)
return o;
}
#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. */
just_print_flag = j_p_f;
@@ -1950,7 +1990,7 @@ func_not (char *o, char **argv, char *funcname UNUSED)
#ifdef HAVE_DOS_PATHS
# ifdef __CYGWIN__
# define IS_ABSOLUTE(n) ((n[0] && n[1] == ':') || STOP_SET (n[0], MAP_PATHSEP))
# define IS_ABSOLUTE(n) ((n[0] && n[1] == ':') || STOP_SET (n[0], MAP_DIRSEP))
# else
# define IS_ABSOLUTE(n) (n[0] && n[1] == ':')
# endif
@@ -1984,9 +2024,9 @@ abspath (const char *name, char *apath)
strcpy (apath, starting_directory);
#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. */
apath[0] = name[0];
@@ -2006,8 +2046,8 @@ abspath (const char *name, char *apath)
else
{
#if defined(__CYGWIN__) && defined(HAVE_DOS_PATHS)
if (STOP_SET (name[0], MAP_PATHSEP))
root_len = 1;
if (STOP_SET (name[0], MAP_DIRSEP))
root_len = 1;
#endif
strncpy (apath, name, root_len);
apath[root_len] = '\0';
@@ -2015,7 +2055,7 @@ abspath (const char *name, char *apath)
/* Get past the root, since we already copied it. */
name += root_len;
#ifdef HAVE_DOS_PATHS
if (! STOP_SET (apath[root_len - 1], MAP_PATHSEP))
if (! STOP_SET (apath[root_len - 1], MAP_DIRSEP))
{
/* Convert d:foo into d:./foo and increase root_len. */
apath[2] = '.';
@@ -2035,11 +2075,11 @@ abspath (const char *name, char *apath)
unsigned long len;
/* Skip sequence of multiple path-separators. */
while (STOP_SET (*start, MAP_PATHSEP))
while (STOP_SET (*start, MAP_DIRSEP))
++start;
/* 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;
@@ -2052,12 +2092,12 @@ abspath (const char *name, char *apath)
{
/* Back up to previous component, ignore if at root already. */
if (dest > apath + root_len)
for (--dest; ! STOP_SET (dest[-1], MAP_PATHSEP); --dest)
for (--dest; ! STOP_SET (dest[-1], MAP_DIRSEP); --dest)
;
}
else
{
if (! STOP_SET (dest[-1], MAP_PATHSEP))
if (! STOP_SET (dest[-1], MAP_DIRSEP))
*dest++ = '/';
if (dest + len >= apath_limit)
@@ -2070,7 +2110,7 @@ abspath (const char *name, char *apath)
}
/* 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 = '\0';
@@ -2148,20 +2188,25 @@ func_file (char *o, char **argv, const char *funcname UNUSED)
fp = fopen (fn, mode);
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 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))
fatal (reading_file, _("write: %s: %s"), fn, strerror (errno));
fclose (fp);
{
const char *err = strerror (errno);
OSS (fatal, reading_file, _("write: %s: %s"), fn, err);
}
}
fclose (fp);
}
else
fatal (reading_file, _("Invalid file operation: %s"), fn);
OS (fatal, reading_file, _("Invalid file operation: %s"), fn);
return o;
}
@@ -2275,7 +2320,7 @@ expand_builtin_function (char *o, int argc, char **argv,
char *p;
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'"),
argc, entry_p->name);
@@ -2287,8 +2332,8 @@ expand_builtin_function (char *o, int argc, char **argv,
return o;
if (!entry_p->fptr.func_ptr)
fatal (*expanding_var,
_("unimplemented on this platform: function '%s'"), entry_p->name);
OS (fatal, *expanding_var,
_("unimplemented on this platform: function '%s'"), entry_p->name);
if (!entry_p->alloc_fn)
return entry_p->fptr.func_ptr (o, argv, entry_p->name);
@@ -2350,7 +2395,7 @@ handle_function (char **op, const char **stringp)
break;
if (count >= 0)
fatal (*expanding_var,
fatal (*expanding_var, strlen (entry_p->name),
_("unterminated call to function '%s': missing '%c'"),
entry_p->name, closeparen);
@@ -2418,7 +2463,7 @@ handle_function (char **op, const char **stringp)
if (entry_p->expand_args)
for (argvp=argv; *argvp != 0; ++argvp)
free (*argvp);
else if (abeg)
else
free (abeg);
return 1;
@@ -2543,17 +2588,17 @@ define_new_function (const gmk_floc *flocp, const char *name,
len = e - name;
if (len == 0)
fatal (flocp, _("Empty function name\n"));
O (fatal, flocp, _("Empty function name"));
if (*name == '.' || *e != '\0')
fatal (flocp, _("Invalid function name: %s\n"), name);
OS (fatal, flocp, _("Invalid function name: %s"), name);
if (len > 255)
fatal (flocp, _("Function name too long: %s\n"), name);
OS (fatal, flocp, _("Function name too long: %s"), name);
if (min > 255)
fatal (flocp, _("Invalid minimum argument count (%d) for function %s\n"),
min, name);
ONS (fatal, flocp,
_("Invalid minimum argument count (%d) for function %s"), min, name);
if (max > 255 || (max && max < min))
fatal (flocp, _("Invalid maximum argument count (%d) for function %s\n"),
max, name);
ONS (fatal, flocp,
_("Invalid maximum argument count (%d) for function %s"), max, name);
ent = xmalloc (sizeof (struct function_table_entry));
ent->name = name;

View File

@@ -1,5 +1,5 @@
/* 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
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
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.
Bugs can be reported to bug-glibc@gnu.org.

View File

@@ -1,5 +1,5 @@
/* 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.
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.
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.
Bugs can be reported to bug-glibc@gnu.org.

View File

@@ -1,5 +1,5 @@
/* 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.
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>
* glob.c (my_realloc) [__DJGPP__]: Don't define, and don't

View File

@@ -377,6 +377,11 @@ glob (pattern, flags, errfunc, pglob)
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)
{
const char *begin = strchr (pattern, '{');

View File

@@ -1,5 +1,5 @@
;; 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.
;;
;; 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.
--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.
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.
Copyright (C) 2011-2013 Free Software Foundation, Inc.
Copyright (C) 2011-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
@@ -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/>. */
#include "makeint.h"
#ifdef HAVE_GUILE
#include "gnumake.h"
#include "debug.h"
@@ -144,3 +147,13 @@ guile_gmake_setup (const gmk_floc *flocp UNUSED)
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"),
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 */

View File

@@ -1,5 +1,5 @@
/* 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.
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.
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Copyright (C) 1988-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
@@ -31,14 +31,14 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef WINDOWS32
#include <windows.h>
char *default_shell = "sh.exe";
const char *default_shell = "sh.exe";
int no_default_sh_exe = 1;
int batch_mode_shell = 1;
HANDLE main_thread;
#elif defined (_AMIGA)
char default_shell[] = "";
const char *default_shell = "";
extern int MyExecute (char **);
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
to search the $PATH for it (since MSDOS doesn't have standard
directories we could trust). */
char *default_shell = "command.com";
const char *default_shell = "command.com";
int batch_mode_shell = 0;
#elif defined (__EMX__)
char *default_shell = "/bin/sh";
const char *default_shell = "/bin/sh";
int batch_mode_shell = 0;
#elif defined (VMS)
# include <descrip.h>
char default_shell[] = "";
const char *default_shell = "";
int batch_mode_shell = 0;
#elif defined (__riscos__)
char default_shell[] = "";
const char *default_shell = "";
int batch_mode_shell = 0;
#else
char default_shell[] = "/bin/sh";
const char *default_shell = "/bin/sh";
int batch_mode_shell = 0;
#endif
@@ -359,7 +359,7 @@ create_batch_file (char const *base, int unixy, int *fd)
*fd = -1;
if (error_string == NULL)
error_string = _("Cannot create a temporary file\n");
fatal (NILF, error_string);
O (fatal, NILF, error_string);
/* not reached */
return NULL;
@@ -474,6 +474,7 @@ child_error (struct child *child,
const struct file *f = child->file;
const gmk_floc *flocp = &f->cmds->fileinfo;
const char *nm;
size_t l = strlen (f->name);
if (ignored && silent_flag)
return;
@@ -498,7 +499,10 @@ child_error (struct child *child,
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
if ((exit_code & 1) != 0)
@@ -506,15 +510,23 @@ child_error (struct child *child,
OUTPUT_UNSET ();
return;
}
error (NILF, _("%s[%s] Error 0x%x%s"), pre, f->name, exit_code, post);
/* Check for a Posix compatible VMS style exit code:
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
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
{
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 */
@@ -606,7 +618,7 @@ reap_children (int block, int err)
Only print this message once no matter how many jobs are left. */
fflush (stdout);
if (!printed)
error (NILF, _("*** Waiting for unfinished jobs...."));
O (error, NILF, _("*** Waiting for unfinished jobs...."));
printed = 1;
}
@@ -975,7 +987,7 @@ reap_children (int block, int err)
if (!err && child_failed && !dontcare && !keep_going_flag &&
/* fatal_error_signal will die with the right signal. */
!handling_fatal_signal)
die (2);
die (MAKE_FAILURE);
/* Only block for one child. */
block = 0;
@@ -992,8 +1004,8 @@ free_child (struct child *child)
output_close (&child->output);
if (!jobserver_tokens)
fatal (NILF, "INTERNAL: Freeing child %p (%s) but no tokens left!\n",
child, child->file->name);
ONS (fatal, NILF, "INTERNAL: Freeing child %p (%s) but no tokens left!\n",
child, child->file->name);
/* If we're using the jobserver and this child is not the only outstanding
job, put a token back into the pipe for it. */
@@ -1004,8 +1016,9 @@ free_child (struct child *child)
if (! release_jobserver_semaphore ())
{
DWORD err = GetLastError ();
fatal (NILF, _("release jobserver semaphore: (Error %ld: %s)"),
err, map_windows32_error_to_string (err));
const char *estr = 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));
@@ -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
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. */
alarm (set_handler ? 1 : 0);
sa.sa_handler = set_handler ? job_noop : SIG_DFL;
sa.sa_flags = 0;
sigaction (SIGALRM, &sa, NULL);
if (set_handler)
{
sa.sa_handler = job_noop;
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
}
@@ -1137,6 +1160,8 @@ start_job_command (struct child *child)
char *argv;
#else
char **argv;
int outfd = FD_STDOUT;
int errfd = FD_STDERR;
#endif
/* If we have a completely empty commandset, stop now. */
@@ -1194,6 +1219,30 @@ start_job_command (struct child *child)
char *end = 0;
#ifdef VMS
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
argv = construct_command_argv (p, &end, child->file,
child->file->cmds->lines_flags[child->command_line - 1],
@@ -1277,7 +1326,7 @@ start_job_command (struct child *child)
/* Print the command if appropriate. */
if (just_print_flag || trace_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
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;
#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__
/* If we aren't running a recursive command and we have a jobserver
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() */
child->pid = child_execute_job (child->good_stdin ? FD_STDIN : bad_stdin,
FD_STDOUT, FD_STDERR,
outfd, errfd,
argv, child->environment);
if (child->pid < 0)
{
@@ -1464,9 +1523,6 @@ start_job_command (struct child *child)
environ = parent_environ; /* Restore value child may have clobbered. */
if (child->pid == 0)
{
int outfd = FD_STDOUT;
int errfd = FD_STDERR;
/* We are the child side. */
unblock_sigs ();
@@ -1485,16 +1541,6 @@ start_job_command (struct child *child)
if (stack_limit.rlim_cur)
setrlimit (RLIMIT_STACK, &stack_limit);
#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,
outfd, errfd, argv, child->environment);
}
@@ -1593,14 +1639,18 @@ start_job_command (struct child *child)
sync_Path_environment ();
#ifndef NO_OUTPUT_SYNC
/* Divert child output if output_sync in use. Don't capture
recursive make output unless we are synchronizing "make" mode. */
if (child->output.syncout)
hPID = process_easy (argv, child->environment,
child->output.out, child->output.err);
else
/* 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;
}
#else
outfd = errfd = -1;
#endif
hPID = process_easy (argv, child->environment, -1, -1);
hPID = process_easy (argv, child->environment, outfd, errfd);
if (hPID != INVALID_HANDLE_VALUE)
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
waiting for a token. */
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
/* On Windows we simply wait for the jobserver semaphore to become
@@ -1950,8 +2000,10 @@ new_job (struct file *file)
if (got_token < 0)
{
DWORD err = GetLastError ();
fatal (NILF, _("semaphore or child process wait: (Error %ld: %s)"),
err, map_windows32_error_to_string (err));
const char *estr = map_windows32_error_to_string (err);
ONS (fatal, NILF,
_("semaphore or child process wait: (Error %ld: %s)"),
err, estr);
}
#else
/* Set interruptible system calls, and read() for a job token. */
@@ -2000,10 +2052,11 @@ new_job (struct file *file)
}
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
message (0, _("%s: update target '%s' due to: %s"), nm,
c->file->name, newer);
OSSS (message, 0,
_("%s: update target '%s' due to: %s"), nm, c->file->name, newer);
free (newer);
}
@@ -2114,8 +2167,8 @@ load_too_high (void)
{
if (errno == 0)
/* An errno value of zero means getloadavg is just unsupported. */
error (NILF,
_("cannot enforce load limits on this operating system"));
O (error, NILF,
_("cannot enforce load limits on this operating system"));
else
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);
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);
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);
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);
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);
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);
}
@@ -2235,7 +2290,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
if (save_stdin >= 0)
{
if (dup2 (save_stdin, FD_STDIN) != FD_STDIN)
fatal (NILF, _("Could not restore stdin\n"));
O (fatal, NILF, _("Could not restore stdin\n"));
else
close (save_stdin);
}
@@ -2243,7 +2298,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
if (save_stdout >= 0)
{
if (dup2 (save_stdout, FD_STDOUT) != FD_STDOUT)
fatal (NILF, _("Could not restore stdout\n"));
O (fatal, NILF, _("Could not restore stdout\n"));
else
close (save_stdout);
}
@@ -2251,7 +2306,7 @@ child_execute_job (int stdin_fd, int stdout_fd, int stderr_fd,
if (save_stderr >= 0)
{
if (dup2 (save_stderr, FD_STDERR) != FD_STDERR)
fatal (NILF, _("Could not restore stderr\n"));
O (fatal, NILF, _("Could not restore stderr\n"));
else
close (save_stderr);
}
@@ -2400,13 +2455,13 @@ exec_command (char **argv, char **envp)
switch (errno)
{
case ENOENT:
error (NILF, _("%s: Command not found"), argv[0]);
OS (error, NILF, _("%s: Command not found"), argv[0]);
break;
case ENOEXEC:
{
/* The file is not executable. Try it as a shell script. */
extern char *getenv ();
char *shell;
const char *shell;
char **new_argv;
int argc;
int i=1;
@@ -2434,7 +2489,7 @@ exec_command (char **argv, char **envp)
# endif
new_argv = alloca ((1 + argc + 1) * sizeof (char *));
new_argv[0] = shell;
new_argv[0] = (char *)shell;
# ifdef __EMX__
if (!unixy_shell)
@@ -2460,7 +2515,7 @@ exec_command (char **argv, char **envp)
execvp (shell, new_argv);
# endif
if (errno == ENOENT)
error (NILF, _("%s: Shell program not found"), shell);
OS (error, NILF, _("%s: Shell program not found"), shell);
else
perror_with_name ("execvp: ", shell);
break;
@@ -2469,7 +2524,7 @@ exec_command (char **argv, char **envp)
# ifdef __EMX__
case EINVAL:
/* 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 */
# endif
@@ -2487,7 +2542,8 @@ exec_command (char **argv, char **envp)
#endif /* !VMS */
}
#else /* On Amiga */
void exec_command (char **argv)
void
exec_command (char **argv)
{
MyExecute (argv);
}
@@ -2504,7 +2560,7 @@ void clean_tmp (void)
avoid using a shell. This routine handles only ' quoting, and " quoting
when no backslash, $ or ' characters are seen in the quotes. Starting
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.
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. */
static char **
construct_command_argv_internal (char *line, char **restp, char *shell,
char *shellflags, char *ifs, int flags,
char **batch_filename UNUSED)
construct_command_argv_internal (char *line, char **restp, const char *shell,
const char *shellflags, const char *ifs,
int flags, char **batch_filename UNUSED)
{
#ifdef __MSDOS__
/* 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
won't have to tell one from another and have one more set of
commands and special characters. */
static char sh_chars_dos[] = "*?[];|<>%^&()";
static char *sh_cmds_dos[] = { "break", "call", "cd", "chcp", "chdir", "cls",
"copy", "ctty", "date", "del", "dir", "echo",
"erase", "exit", "for", "goto", "if", "md",
"mkdir", "path", "pause", "prompt", "rd",
"rmdir", "rem", "ren", "rename", "set",
"shift", "time", "type", "ver", "verify",
"vol", ":", 0 };
static const char *sh_chars_dos = "*?[];|<>%^&()";
static const char *sh_cmds_dos[] =
{ "break", "call", "cd", "chcp", "chdir", "cls", "copy", "ctty", "date",
"del", "dir", "echo", "erase", "exit", "for", "goto", "if", "md",
"mkdir", "path", "pause", "prompt", "rd", "rmdir", "rem", "ren",
"rename", "set", "shift", "time", "type", "ver", "verify", "vol", ":",
0 };
static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^";
static char *sh_cmds_sh[] = { "cd", "echo", "eval", "exec", "exit", "login",
"logout", "set", "umask", "wait", "while",
"for", "case", "if", ":", ".", "break",
"continue", "export", "read", "readonly",
"shift", "times", "trap", "switch", "unset",
"ulimit", 0 };
static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^";
static const char *sh_cmds_sh[] =
{ "cd", "echo", "eval", "exec", "exit", "login", "logout", "set", "umask",
"wait", "while", "for", "case", "if", ":", ".", "break", "continue",
"export", "read", "readonly", "shift", "times", "trap", "switch",
"unset", "ulimit", 0 };
const char *sh_chars;
const char **sh_cmds;
char *sh_chars;
char **sh_cmds;
#elif defined (__EMX__)
static char sh_chars_dos[] = "*?[];|<>%^&()";
static char *sh_cmds_dos[] = { "break", "call", "cd", "chcp", "chdir", "cls",
"copy", "ctty", "date", "del", "dir", "echo",
"erase", "exit", "for", "goto", "if", "md",
"mkdir", "path", "pause", "prompt", "rd",
"rmdir", "rem", "ren", "rename", "set",
"shift", "time", "type", "ver", "verify",
"vol", ":", 0 };
static const char *sh_chars_dos = "*?[];|<>%^&()";
static const char *sh_cmds_dos[] =
{ "break", "call", "cd", "chcp", "chdir", "cls", "copy", "ctty", "date",
"del", "dir", "echo", "erase", "exit", "for", "goto", "if", "md",
"mkdir", "path", "pause", "prompt", "rd", "rmdir", "rem", "ren",
"rename", "set", "shift", "time", "type", "ver", "verify", "vol", ":",
0 };
static char sh_chars_os2[] = "*?[];|<>%^()\"'&";
static char *sh_cmds_os2[] = { "call", "cd", "chcp", "chdir", "cls", "copy",
"date", "del", "detach", "dir", "echo",
"endlocal", "erase", "exit", "for", "goto", "if",
"keys", "md", "mkdir", "move", "path", "pause",
"prompt", "rd", "rem", "ren", "rename", "rmdir",
"set", "setlocal", "shift", "start", "time",
"type", "ver", "verify", "vol", ":", 0 };
static const char *sh_chars_os2 = "*?[];|<>%^()\"'&";
static const char *sh_cmds_os2[] =
{ "call", "cd", "chcp", "chdir", "cls", "copy", "date", "del", "detach",
"dir", "echo", "endlocal", "erase", "exit", "for", "goto", "if", "keys",
"md", "mkdir", "move", "path", "pause", "prompt", "rd", "rem", "ren",
"rename", "rmdir", "set", "setlocal", "shift", "start", "time", "type",
"ver", "verify", "vol", ":", 0 };
static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^~'";
static char *sh_cmds_sh[] = { "echo", "cd", "eval", "exec", "exit", "login",
"logout", "set", "umask", "wait", "while",
"for", "case", "if", ":", ".", "break",
"continue", "export", "read", "readonly",
"shift", "times", "trap", "switch", "unset",
0 };
char *sh_chars;
char **sh_cmds;
static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^~'";
static const char *sh_cmds_sh[] =
{ "echo", "cd", "eval", "exec", "exit", "login", "logout", "set", "umask",
"wait", "while", "for", "case", "if", ":", ".", "break", "continue",
"export", "read", "readonly", "shift", "times", "trap", "switch",
"unset", 0 };
const char *sh_chars;
const char **sh_cmds;
#elif defined (_AMIGA)
static char sh_chars[] = "#;\"|<>()?*$`";
static char *sh_cmds[] = { "cd", "eval", "if", "delete", "echo", "copy",
"rename", "set", "setenv", "date", "makedir",
"skip", "else", "endif", "path", "prompt",
"unset", "unsetenv", "version",
0 };
static const char *sh_chars = "#;\"|<>()?*$`";
static const char *sh_cmds[] =
{ "cd", "eval", "if", "delete", "echo", "copy", "rename", "set", "setenv",
"date", "makedir", "skip", "else", "endif", "path", "prompt", "unset",
"unsetenv", "version", 0 };
#elif defined (WINDOWS32)
/* We used to have a double quote (") in sh_chars_dos[] below, but
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
the limit from a very frequent use case, because using quoted
file names is commonplace on MS-Windows. */
static char sh_chars_dos[] = "|&<>";
static char *sh_cmds_dos[] = { "assoc", "break", "call", "cd", "chcp",
"chdir", "cls", "color", "copy", "ctty",
"date", "del", "dir", "echo", "echo.",
"endlocal", "erase", "exit", "for", "ftype",
"goto", "if", "if", "md", "mkdir", "move",
"path", "pause", "prompt", "rd", "rem", "ren",
"rename", "rmdir", "set", "setlocal",
"shift", "time", "title", "type", "ver",
"verify", "vol", ":", 0 };
static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^";
static char *sh_cmds_sh[] = { "cd", "eval", "exec", "exit", "login",
"logout", "set", "umask", "wait", "while", "for",
"case", "if", ":", ".", "break", "continue",
"export", "read", "readonly", "shift", "times",
"trap", "switch", "test",
static const char *sh_chars_dos = "|&<>";
static const char *sh_cmds_dos[] =
{ "assoc", "break", "call", "cd", "chcp", "chdir", "cls", "color", "copy",
"ctty", "date", "del", "dir", "echo", "echo.", "endlocal", "erase",
"exit", "for", "ftype", "goto", "if", "if", "md", "mkdir", "move",
"path", "pause", "prompt", "rd", "rem", "ren", "rename", "rmdir",
"set", "setlocal", "shift", "time", "title", "type", "ver", "verify",
"vol", ":", 0 };
static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^";
static const char *sh_cmds_sh[] =
{ "cd", "eval", "exec", "exit", "login", "logout", "set", "umask", "wait",
"while", "for", "case", "if", ":", ".", "break", "continue", "export",
"read", "readonly", "shift", "times", "trap", "switch", "test",
#ifdef BATCH_MODE_ONLY_SHELL
"echo",
"echo",
#endif
0 };
char* sh_chars;
char** sh_cmds;
0 };
const char *sh_chars;
const char **sh_cmds;
#elif defined(__riscos__)
static char sh_chars[] = "";
static char *sh_cmds[] = { 0 };
static const char *sh_chars = "";
static const char *sh_cmds[] = { 0 };
#else /* must be UNIX-ish */
static char sh_chars[] = "#;\"*?[]&|<>(){}$`^~!";
static char *sh_cmds[] = { ".", ":", "break", "case", "cd", "continue",
"eval", "exec", "exit", "export", "for", "if",
"login", "logout", "read", "readonly", "set",
"shift", "switch", "test", "times", "trap",
"ulimit", "umask", "unset", "wait", "while", 0 };
static const char *sh_chars = "#;\"*?[]&|<>(){}$`^~!";
static const char *sh_cmds[] =
{ ".", ":", "break", "case", "cd", "continue", "eval", "exec", "exit",
"export", "for", "if", "login", "logout", "read", "readonly", "set",
"shift", "switch", "test", "times", "trap", "ulimit", "umask", "unset",
"wait", "while", 0 };
# ifdef HAVE_DOS_PATHS
/* This is required if the MSYS/Cygwin ports (which do not define
WINDOWS32) are compiled with HAVE_DOS_PATHS defined, which uses
sh_chars_sh[] directly (see below). */
static char *sh_chars_sh = sh_chars;
sh_chars_sh directly (see below). The value must be identical
to that of sh_chars immediately above. */
static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^~!";
# endif /* HAVE_DOS_PATHS */
#endif
int i;
char *p;
char *ap;
#ifndef NDEBUG
char *end;
#endif
char *ap;
const char *cap;
const char *cp;
int instring, word_has_equals, seen_nonequals, last_argument_was_empty;
char **new_argv = 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 : ""));
if (s1)
free (s1);
if (s2)
free (s2);
free (s1);
free (s2);
}
if (slow_flag)
goto slow;
@@ -2736,12 +2792,12 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
#endif /* !__MSDOS__ && !__EMX__ */
#endif /* not WINDOWS32 */
if (ifs != 0)
for (ap = ifs; *ap != '\0'; ++ap)
if (*ap != ' ' && *ap != '\t' && *ap != '\n')
if (ifs)
for (cap = ifs; *cap != '\0'; ++cap)
if (*cap != ' ' && *cap != '\t' && *cap != '\n')
goto slow;
if (shellflags != 0)
if (shellflags)
if (shellflags[0] != '-'
|| ((shellflags[1] != 'c' || shellflags[2] != '\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. */
ap = new_argv[0] = argstr = xmalloc (i);
#ifndef NDEBUG
end = ap + i;
#endif
/* I is how many complete arguments have been found. */
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
recursively call itself ad nauseam, or until stack overflow,
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++) = *p;
*(ap++) = *cp;
}
*(ap++) = ' ';
if (shellflags)
@@ -3441,7 +3499,8 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
}
#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__);
#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
when no backslash, $ or ' characters are seen in the quotes. Starting
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.
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.
Copyright (C) 1992-2013 Free Software Foundation, Inc.
Copyright (C) 1992-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
@@ -39,8 +39,8 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
#ifdef NO_OUTPUT_SYNC
# define RECORD_SYNC_MUTEX(m) \
error (NILF, \
_("-O[TYPE] (--output-sync[=TYPE]) is not configured for this build."));
O (error, NILF, \
_("-O[TYPE] (--output-sync[=TYPE]) is not configured for this build."));
#else
# ifdef WINDOWS32
/* For emulations in w32/compat/posixfcn.c. */

37
load.c
View File

@@ -1,5 +1,5 @@
/* 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.
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 "variable.h"
/* Tru64 V4.0 does not have this flag */
#ifndef RTLD_GLOBAL
# define RTLD_GLOBAL 0
#endif
struct load_list
{
struct load_list *next;
@@ -50,7 +55,10 @@ load_object (const gmk_floc *flocp, int noerror,
{
global_dl = dlopen (NULL, RTLD_NOW|RTLD_GLOBAL);
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);
@@ -74,23 +82,28 @@ load_object (const gmk_floc *flocp, int noerror,
/* Still no? Then fail. */
if (! dlp)
{
const char *err = dlerror ();
if (noerror)
DB (DB_BASIC, ("%s", dlerror ()));
DB (DB_BASIC, ("%s", err));
else
error (flocp, "%s", dlerror ());
OS (error, flocp, "%s", err);
return NULL;
}
/* Assert that the GPL license symbol is defined. */
symp = (load_func_t) dlsym (dlp, "plugin_is_GPL_compatible");
if (! symp)
fatal (flocp, _("Loaded object %s is not declared to be GPL compatible"),
ldname);
OS (fatal, flocp,
_("Loaded object %s is not declared to be GPL compatible"),
ldname);
symp = (load_func_t) dlsym (dlp, symname);
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
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;
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. */
memcpy (new, *ldname, l);
new[l] = '\0';
*ldname = new;
nmlen = l;
/* Make a copy of the symbol name part. */
symname = new + l + 1;
@@ -226,7 +240,8 @@ int
load_file (const gmk_floc *flocp, const char **ldname, int 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;
}
@@ -234,7 +249,7 @@ load_file (const gmk_floc *flocp, const char **ldname, int noerror)
void
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 */

View File

@@ -1,5 +1,5 @@
/* 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.
GNU Make is free software; you can redistribute it and/or modify it under the
@@ -39,9 +39,18 @@ gmk_free (char *s)
void
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);
free (s);
restore_variable_buffer (pbuf, plen);
}
/* 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.
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Copyright (C) 1988-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
@@ -77,8 +77,8 @@ double atof ();
static void clean_jobserver (int status);
static void print_data_base (void);
static void print_version (void);
static void decode_switches (int argc, char **argv, int env);
static void decode_env_switches (char *envar, unsigned int len);
static void decode_switches (int argc, const char **argv, int env);
static void decode_env_switches (const char *envar, unsigned int len);
static struct variable *define_makeflags (int all, int makefile);
static char *quote_for_env (char *out, const char *in);
static void initialize_global_hash_tables (void);
@@ -94,7 +94,8 @@ struct command_switch
{
flag, /* Turn int flag on. */
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. */
positive_int, /* A positive integer. */
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 *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. */
@@ -118,7 +119,7 @@ struct command_switch
#define short_option(c) ((c) <= CHAR_MAX)
/* 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
{
@@ -157,7 +158,7 @@ int db_level = 0;
/* Synchronize output (--output-sync). */
static struct stringlist *output_sync_option = 0;
char *output_sync_option = 0;
#ifdef WINDOWS32
/* 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. */
static struct stringlist *jobserver_fds = 0;
char *jobserver_fds = 0;
int job_fds[2] = { -1, -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
children under -O. */
static struct stringlist *sync_mutex = 0;
char *sync_mutex = 0;
/* Maximum load average at which multiple jobs will be run.
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" },
/* 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+3, flag, &trace_flag, 1, 1, 0, 0, 0, "trace" },
{ CHAR_MAX+4, flag, &inhibit_print_directory_flag, 1, 1, 0, 0, 0,
"no-print-directory" },
{ CHAR_MAX+5, flag, &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
"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" },
{ 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. */
#ifdef WINDOWS32
/* On MS-Windows, we chop off the .exe suffix in 'main', so this
cannot be 'const'. */
char *program;
#else
const char *program;
#endif
/* 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_PATHSEP;
stopchar_map[(int)'/'] = MAP_DIRSEP;
#if defined(VMS)
stopchar_map[(int)']'] = MAP_PATHSEP;
stopchar_map[(int)']'] = MAP_DIRSEP;
#elif defined(HAVE_DOS_PATHS)
stopchar_map[(int)'\\'] = MAP_PATHSEP;
stopchar_map[(int)'\\'] = MAP_DIRSEP;
#endif
for (i = 1; i <= UCHAR_MAX; ++i)
@@ -638,46 +645,41 @@ initialize_stopchar_map ()
}
static const char *
expand_command_line_file (char *name)
expand_command_line_file (const char *name)
{
const char *cp;
char *expanded = 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] == '~')
{
expanded = tilde_expand (name);
if (expanded != 0)
if (expanded && expanded[0] != '\0')
name = expanded;
}
/* This is also done in parse_file_seq, so this is redundant
for names read from makefiles. It is here for names passed
on the command line. */
while (name[0] == '.' && name[1] == '/' && name[2] != '\0')
while (name[0] == '.' && name[1] == '/')
{
name += 2;
while (*name == '/')
while (name[0] == '/')
/* Skip following slashes: ".//foo" is "foo", not "/foo". */
++name;
}
if (*name == '\0')
if (name[0] == '\0')
{
/* It was all slashes! Move back to the dot and truncate
it after the first slash, so it becomes just "./". */
do
--name;
while (name[0] != '.');
name[2] = '\0';
/* Nothing else but one or more "./", maybe plus slashes! */
name = "./";
}
cp = strcache_add (name);
if (expanded)
free (expanded);
free (expanded);
return cp;
}
@@ -731,7 +733,8 @@ decode_debug_flags (void)
db_level |= DB_BASIC | DB_VERBOSE;
break;
default:
fatal (NILF, _("unknown debug level specification '%s'"), p);
OS (fatal, NILF,
_("unknown debug level specification '%s'"), p);
}
while (*(++p) != '\0')
@@ -756,40 +759,23 @@ decode_debug_flags (void)
static void
decode_output_sync_flags (void)
{
const char **pp;
if (!output_sync_option)
return;
for (pp=output_sync_option->list; *pp; ++pp)
if (output_sync_option)
{
const char *p = *pp;
if (streq (p, "none"))
if (streq (output_sync_option, "none"))
output_sync = OUTPUT_SYNC_NONE;
else if (streq (p, "line"))
else if (streq (output_sync_option, "line"))
output_sync = OUTPUT_SYNC_LINE;
else if (streq (p, "target"))
else if (streq (output_sync_option, "target"))
output_sync = OUTPUT_SYNC_TARGET;
else if (streq (p, "recurse"))
else if (streq (output_sync_option, "recurse"))
output_sync = OUTPUT_SYNC_RECURSE;
else
fatal (NILF, _("unknown output-sync type '%s'"), p);
OS (fatal, NILF,
_("unknown output-sync type '%s'"), output_sync_option);
}
if (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);
}
RECORD_SYNC_MUTEX (sync_mutex);
}
#ifdef WINDOWS32
@@ -805,16 +791,10 @@ prepare_mutex_handle_string (sync_handle_t handle)
{
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. */
sprintf (hdl_string, "0x%x", handle);
sync_mutex = xmalloc (sizeof (struct stringlist));
sync_mutex->list = xmalloc (sizeof (char *));
sync_mutex->list[0] = xstrdup (hdl_string);
sync_mutex->idx = 1;
sync_mutex->max = 1;
/* 2 hex digits per byte + 2 characters for "0x" + null. */
sync_mutex = xmalloc ((2 * sizeof (sync_handle_t)) + 2 + 1);
sprintf (sync_mutex, "0x%Ix", handle);
define_makeflags (1, 0);
}
}
@@ -909,15 +889,15 @@ find_and_set_default_shell (const char *token)
{
int sh_found = 0;
char *atoken = 0;
char *search_token;
char *tokend;
const char *search_token;
const char *tokend;
PATH_VAR(sh_path);
extern char *default_shell;
extern const char *default_shell;
if (!token)
search_token = default_shell;
else
atoken = search_token = xstrdup (token);
search_token = atoken = xstrdup (token);
/* 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
@@ -1022,8 +1002,7 @@ find_and_set_default_shell (const char *token)
batch_mode_shell = 1;
#endif
if (atoken)
free (atoken);
free (atoken);
return (sh_found);
}
@@ -1053,8 +1032,8 @@ main (int argc, char **argv, char **envp)
unsigned int restarts = 0;
unsigned int syncing = 0;
#ifdef WINDOWS32
char *unix_path = NULL;
char *windows32_path = NULL;
const char *unix_path = NULL;
const char *windows32_path = NULL;
SetUnhandledExceptionFilter (handle_runtime_exceptions);
@@ -1177,16 +1156,12 @@ main (int argc, char **argv, char **envp)
/* Figure out where this program lives. */
if (argv[0] == 0)
argv[0] = "";
argv[0] = (char *)"";
if (argv[0][0] == '\0')
program = "make";
else
{
#ifdef VMS
program = strrchr (argv[0], ']');
#else
program = strrchr (argv[0], '/');
#endif
#if defined(__MSDOS__) || defined(__EMX__)
if (program == 0)
program = strrchr (argv[0], '\\');
@@ -1216,7 +1191,11 @@ main (int argc, char **argv, char **envp)
}
#endif
if (program == 0)
#ifdef VMS
program = vms_progname(argv[0]);
#else
program = argv[0];
#endif
else
++program;
}
@@ -1237,7 +1216,7 @@ main (int argc, char **argv, char **envp)
#ifdef HAVE_GETCWD
perror_with_name ("getcwd", "");
#else
error (NILF, "getwd: %s", current_directory);
OS (error, NILF, "getwd: %s", current_directory);
#endif
current_directory[0] = '\0';
directory_before_chdir = 0;
@@ -1285,10 +1264,8 @@ main (int argc, char **argv, char **envp)
define_variable_cname (".FEATURES", features, o_default, 0);
}
#ifdef HAVE_GUILE
/* Configure GNU Guile support */
guile_gmake_setup (NILF);
#endif
/* Read in variables from the environment. It is important that this 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)
{
struct variable *v;
char *ep = envp[i];
const char *ep = envp[i];
/* By default, export all variables culled from the environment. */
enum variable_export export = v_export;
unsigned int len;
@@ -1350,7 +1327,7 @@ main (int argc, char **argv, char **envp)
#ifndef __MSDOS__
export = v_noexport;
#endif
shell_var.name = "SHELL";
shell_var.name = xstrdup ("SHELL");
shell_var.length = 5;
shell_var.value = xstrdup (ep);
}
@@ -1397,7 +1374,6 @@ main (int argc, char **argv, char **envp)
#endif
/* Decode the switches. */
decode_env_switches (STRING_SIZE_TUPLE ("GNUMAKEFLAGS"));
/* Clear GNUMAKEFLAGS to avoid duplication. */
@@ -1419,7 +1395,20 @@ main (int argc, char **argv, char **envp)
decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
#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. */
syncing = (output_sync == OUTPUT_SYNC_LINE
@@ -1457,7 +1446,7 @@ main (int argc, char **argv, char **envp)
if (print_version_flag)
{
print_version ();
die (0);
die (MAKE_SUCCESS);
}
if (ISDB (DB_BASIC))
@@ -1526,29 +1515,23 @@ main (int argc, char **argv, char **envp)
if (jobserver_fds)
{
const char *cp;
unsigned int ui;
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];
/* Make sure the jobserver option has the proper format. */
const char *cp = jobserver_fds;
#ifdef WINDOWS32
if (! open_jobserver_semaphore (cp))
{
DWORD err = GetLastError ();
fatal (NILF, _("internal error: unable to open jobserver semaphore '%s': (Error %ld: %s)"),
cp, err, map_windows32_error_to_string (err));
const char *estr = 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));
#else
if (sscanf (cp, "%d,%d", &job_fds[0], &job_fds[1]) != 2)
fatal (NILF,
_("internal error: invalid --jobserver-fds string '%s'"), cp);
OS (fatal, NILF,
_("internal error: invalid --jobserver-fds string '%s'"), cp);
DB (DB_JOBS,
(_("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 (! restarts)
error (NILF, _("warning: -jN forced in submake: disabling jobserver mode."));
O (error, NILF,
_("warning: -jN forced in submake: disabling jobserver mode."));
}
#ifndef WINDOWS32
#ifdef HAVE_FCNTL
@@ -1582,8 +1566,8 @@ main (int argc, char **argv, char **envp)
if (errno != EBADF)
pfatal_with_name (_("dup jobserver"));
error (NILF,
_("warning: jobserver unavailable: using -j1. Add '+' to parent make rule."));
O (error, NILF,
_("warning: jobserver unavailable: using -j1. Add '+' to parent make rule."));
job_slots = 1;
job_fds[0] = job_fds[1] = -1;
}
@@ -1600,7 +1584,7 @@ main (int argc, char **argv, char **envp)
close (job_fds[1]);
#endif
job_fds[0] = job_fds[1] = -1;
free (jobserver_fds->list);
free (jobserver_fds);
jobserver_fds = 0;
}
@@ -1609,7 +1593,11 @@ main (int argc, char **argv, char **envp)
/* The extra indirection through $(MAKE_COMMAND) is done
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);
#endif
define_variable_cname ("MAKE", "$(MAKE_COMMAND)", o_default, 1);
if (command_variables != 0)
@@ -1724,7 +1712,7 @@ main (int argc, char **argv, char **envp)
#ifdef HAVE_GETCWD
perror_with_name ("getcwd", "");
#else
error (NILF, "getwd: %s", current_directory);
OS (error, NILF, "getwd: %s", current_directory);
#endif
starting_directory = 0;
}
@@ -1746,10 +1734,12 @@ main (int argc, char **argv, char **envp)
and thus re-read the makefiles, we read standard input
into a temporary file and read from that. */
FILE *outfile;
char *template, *tmpdir;
char *template;
const char *tmpdir;
if (stdin_nm)
fatal (NILF, _("Makefile from standard input specified twice."));
O (fatal, NILF,
_("Makefile from standard input specified twice."));
#ifdef VMS
# define DEFAULT_TMPDIR "sys$scratch:"
@@ -1916,7 +1906,7 @@ main (int argc, char **argv, char **envp)
extern int _is_unixy_shell (const char *_path);
struct variable *shv = lookup_variable (STRING_SIZE_TUPLE ("SHELL"));
extern int unixy_shell;
extern char *default_shell;
extern const char *default_shell;
if (shv && *shv->value)
{
@@ -1973,16 +1963,16 @@ main (int argc, char **argv, char **envp)
undefine_default_variables ();
}
#if defined (__MSDOS__) || defined (__EMX__)
#if defined (__MSDOS__) || defined (__EMX__) || defined (VMS)
if (job_slots != 1
# ifdef __EMX__
&& _osmode != OS2_MODE /* turn off -j if we are in DOS mode */
# endif
)
{
error (NILF,
_("Parallel jobs (-j) are not supported on this platform."));
error (NILF, _("Resetting to single job (-j1) mode."));
O (error, NILF,
_("Parallel jobs (-j) are not supported on this platform."));
O (error, NILF, _("Resetting to single job (-j1) mode."));
job_slots = 1;
}
#endif
@@ -1993,8 +1983,6 @@ main (int argc, char **argv, char **envp)
if (job_slots > 1)
{
char *cp;
#ifdef WINDOWS32
/* sub_proc.c cannot wait for more than MAXIMUM_WAIT_OBJECTS objects
* 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))
{
DWORD err = GetLastError ();
fatal (NILF, _("creating jobserver semaphore: (Error %ld: %s)"),
err, map_windows32_error_to_string (err));
const char *estr = map_windows32_error_to_string (err);
ONS (fatal, NILF,
_("creating jobserver semaphore: (Error %ld: %s)"), err, estr);
}
#else
char c = '+';
@@ -2040,28 +2029,22 @@ main (int argc, char **argv, char **envp)
}
#endif
/* Fill in the jobserver_fds struct for our children. */
/* Fill in the jobserver_fds for our children. */
#ifdef WINDOWS32
cp = xmalloc (MAX_PATH + 1);
strcpy (cp, get_jobserver_semaphore_name ());
jobserver_fds = xmalloc (MAX_PATH + 1);
strcpy (jobserver_fds, get_jobserver_semaphore_name ());
#else
cp = xmalloc ((CSTRLEN ("1024") * 2) + 2);
sprintf (cp, "%d,%d", job_fds[0], job_fds[1]);
jobserver_fds = xmalloc ((INTSTR_LENGTH * 2) + 2);
sprintf (jobserver_fds, "%d,%d", job_fds[0], job_fds[1]);
#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
#ifndef MAKE_SYMLINKS
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;
}
#endif
@@ -2138,7 +2121,8 @@ main (int argc, char **argv, char **envp)
FILE_TIMESTAMP *makefile_mtimes = 0;
unsigned int mm_idx = 0;
char **nargv;
char **aargv = NULL;
const char **nargv;
int nargc;
int orig_db_level = db_level;
enum update_status status;
@@ -2250,8 +2234,8 @@ main (int argc, char **argv, char **envp)
FILE_TIMESTAMP mtime;
/* The update failed and this makefile was not
from the MAKEFILES variable, so we care. */
error (NILF, _("Failed to remake makefile '%s'."),
d->file->name);
OS (error, NILF, _("Failed to remake makefile '%s'."),
d->file->name);
mtime = file_mtime_no_search (d->file);
any_remade |= (mtime != NONEXISTENT_MTIME
&& mtime != makefile_mtimes[i]);
@@ -2262,18 +2246,20 @@ main (int argc, char **argv, char **envp)
/* This makefile was not found at all. */
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. */
if (d->changed & RM_INCLUDED)
/* An included makefile. We don't need
to die, but we do want to complain. */
error (NILF,
_("Included makefile '%s' was not found."),
dep_name (d));
/* An included makefile. We don't need to die, but we
do want to complain. */
error (NILF, l,
_("Included makefile '%s' was not found."), dnm);
else
{
/* A normal makefile. We must die later. */
error (NILF, _("Makefile '%s' was not found"),
dep_name (d));
error (NILF, l,
_("Makefile '%s' was not found"), dnm);
any_failed = 1;
}
}
@@ -2284,7 +2270,7 @@ main (int argc, char **argv, char **envp)
if (any_remade)
goto re_exec;
if (any_failed)
die (2);
die (MAKE_FAILURE);
break;
}
@@ -2319,13 +2305,15 @@ main (int argc, char **argv, char **envp)
nargc = argc;
if (stdin_nm)
{
nargv = xmalloc ((nargc + 2) * sizeof (char *));
memcpy (nargv, argv, argc * sizeof (char *));
nargv[nargc++] = xstrdup (concat (2, "-o", stdin_nm));
nargv[nargc] = 0;
void *m = xmalloc ((nargc + 2) * sizeof (char *));
aargv = m;
memcpy (aargv, argv, argc * sizeof (char *));
aargv[nargc++] = xstrdup (concat (2, "-o", stdin_nm));
aargv[nargc] = 0;
nargv = m;
}
else
nargv = argv;
nargv = (const char**)argv;
if (directories != 0 && directories->idx > 0)
{
@@ -2338,7 +2326,8 @@ main (int argc, char **argv, char **envp)
bad = 0;
}
if (bad)
fatal (NILF, _("Couldn't change back to original directory."));
O (fatal, NILF,
_("Couldn't change back to original directory."));
}
++restarts;
@@ -2350,7 +2339,7 @@ main (int argc, char **argv, char **envp)
if (ISDB (DB_BASIC))
{
char **p;
const char **p;
printf (_("Re-executing[%u]:"), restarts);
for (p = nargv; *p != 0; ++p)
printf (" %s", *p);
@@ -2429,15 +2418,16 @@ main (int argc, char **argv, char **envp)
exit (WIFEXITED(r) ? WEXITSTATUS(r) : EXIT_FAILURE);
}
#else
exec_command (nargv, environ);
exec_command ((char **)nargv, environ);
#endif
free (aargv);
break;
}
db_level = orig_db_level;
/* Free the makefile mtimes (if we allocated any). */
if (makefile_mtimes)
free (makefile_mtimes);
/* Free the makefile mtimes. */
free (makefile_mtimes);
}
/* 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. */
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));
@@ -2515,9 +2506,9 @@ main (int argc, char **argv, char **envp)
if (!goals)
{
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. */
@@ -2546,15 +2537,15 @@ main (int argc, char **argv, char **envp)
/* If we detected some clock skew, generate one last warning */
if (clock_skew_detected)
error (NILF,
_("warning: Clock skew detected. Your build may be incomplete."));
O (error, NILF,
_("warning: Clock skew detected. Your build may be incomplete."));
/* Exit. */
die (makefile_status);
}
/* NOTREACHED */
exit (0);
exit (MAKE_SUCCESS);
}
/* Parsing of arguments, decoding of switches. */
@@ -2599,6 +2590,7 @@ init_switches (void)
break;
case string:
case strlist:
case filename:
case positive_int:
case floating:
@@ -2626,7 +2618,7 @@ init_switches (void)
/* Non-option argument. It might be a variable definition. */
static void
handle_non_switch_argument (char *arg, int env)
handle_non_switch_argument (const char *arg, int env)
{
struct variable *v;
@@ -2733,7 +2725,7 @@ print_usage (int bad)
They came from the environment if ENV is nonzero. */
static void
decode_switches (int argc, char **argv, int env)
decode_switches (int argc, const char **argv, int env)
{
int bad = 0;
register const struct command_switch *cs;
@@ -2753,14 +2745,17 @@ decode_switches (int argc, char **argv, int env)
while (optind < argc)
{
const char *coptarg;
/* 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)
/* End of arguments, or "--" marker seen. */
break;
else if (c == 1)
/* An argument not starting with a dash. */
handle_non_switch_argument (optarg, env);
handle_non_switch_argument (coptarg, env);
else if (c == '?')
/* Bad option. We will print a usage message and die later.
But continue to parse the other options so the user can
@@ -2791,13 +2786,14 @@ decode_switches (int argc, char **argv, int env)
break;
case string:
case strlist:
case filename:
if (!doit)
break;
if (optarg == 0)
optarg = xstrdup (cs->noarg_value);
else if (*optarg == '\0')
if (! coptarg)
coptarg = xstrdup (cs->noarg_value);
else if (*coptarg == '\0')
{
char opt[2] = "c";
const char *op = opt;
@@ -2807,9 +2803,19 @@ decode_switches (int argc, char **argv, int env)
else
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);
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;
@@ -2829,39 +2835,40 @@ decode_switches (int argc, char **argv, int env)
sl->max * sizeof (char *));
}
if (cs->type == filename)
sl->list[sl->idx++] = expand_command_line_file (optarg);
sl->list[sl->idx++] = expand_command_line_file (coptarg);
else
sl->list[sl->idx++] = optarg;
sl->list[sl->idx++] = xstrdup (coptarg);
sl->list[sl->idx] = 0;
break;
case positive_int:
/* See if we have an option argument; if we do require that
it's all digits, not something like "10foo". */
if (optarg == 0 && argc > optind)
if (coptarg == 0 && argc > optind)
{
const char *cp;
for (cp=argv[optind]; ISDIGIT (cp[0]); ++cp)
;
if (cp[0] == '\0')
optarg = argv[optind++];
coptarg = argv[optind++];
}
if (!doit)
break;
if (optarg != 0)
if (coptarg)
{
int i = atoi (optarg);
int i = atoi (coptarg);
const char *cp;
/* 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')
{
error (NILF, _("the '-%c' option requires a positive integer argument"),
error (NILF, 0,
_("the '-%c' option requires a positive integer argument"),
cs->c);
bad = 1;
}
@@ -2875,13 +2882,13 @@ decode_switches (int argc, char **argv, int env)
#ifndef NO_FLOAT
case floating:
if (optarg == 0 && optind < argc
if (coptarg == 0 && optind < argc
&& (ISDIGIT (argv[optind][0]) || argv[optind][0] == '.'))
optarg = argv[optind++];
coptarg = argv[optind++];
if (doit)
*(double *) cs->value_ptr
= (optarg != 0 ? atof (optarg)
= (coptarg != 0 ? atof (coptarg)
: *(double *) cs->noarg_value);
break;
@@ -2903,7 +2910,7 @@ decode_switches (int argc, char **argv, int env)
if (!env && (bad || print_usage_flag))
{
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. */
@@ -2917,12 +2924,12 @@ decode_switches (int argc, char **argv, int env)
decode_switches. */
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 *value, *p;
char *value, *p, *buf;
int argc;
char **argv;
const char **argv;
/* Get the variable's value. */
varref[0] = '$';
@@ -2941,15 +2948,16 @@ decode_env_switches (char *envar, unsigned int len)
/* Allocate a vector that is definitely big enough. */
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].
Prepend a spacer word. */
argv[0] = 0;
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;
while (*value != '\0')
{
@@ -2969,13 +2977,12 @@ decode_env_switches (char *envar, unsigned int len)
}
*p = '\0';
argv[++argc] = 0;
assert (p < buf + len + 2);
if (argv[1][0] != '-' && strchr (argv[1], '=') == 0)
/* 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
need permanent storage for this in case decode_switches saves
pointers into the value. */
argv[1] = xstrdup (concat (2, "-", argv[1]));
definition, so add a dash. */
argv[1] = buf;
/* Parse those words. */
decode_switches (argc, argv, 1);
@@ -3109,8 +3116,17 @@ define_makeflags (int all, int makefile)
break;
#endif
case filename:
case string:
if (all)
{
p = *((char **)cs->value_ptr);
if (p)
ADD_FLAG (p, strlen (p));
}
break;
case filename:
case strlist:
if (all)
{
struct stringlist *sl = *(struct stringlist **) cs->value_ptr;
@@ -3241,7 +3257,7 @@ print_version (void)
{
static int printed_version = 0;
char *precede = print_data_base_flag ? "# " : "";
const char *precede = print_data_base_flag ? "# " : "";
if (printed_version)
/* Do it only once. */
@@ -3260,7 +3276,7 @@ print_version (void)
year, and none of the rest of it should be translated (including the
word "Copyright"), so it hardly seems worth it. */
printf ("%sCopyright (C) 1988-2013 Free Software Foundation, Inc.\n",
printf ("%sCopyright (C) 1988-2014 Free Software Foundation, Inc.\n",
precede);
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
{
if (status != 2)
error (NILF,
"INTERNAL: Exiting with %u jobserver tokens (should be 0)!",
jobserver_tokens);
ON (error, NILF,
"INTERNAL: Exiting with %u jobserver tokens (should be 0)!",
jobserver_tokens);
else
/* Don't write back the "free" token */
while (--jobserver_tokens)
@@ -3354,9 +3370,9 @@ clean_jobserver (int status)
#endif
if (tcnt != master_job_slots)
error (NILF,
"INTERNAL: Exiting with %u jobserver tokens available; should be %u!",
tcnt, master_job_slots);
ONN (error, NILF,
"INTERNAL: Exiting with %u jobserver tokens available; should be %u!",
tcnt, master_job_slots);
#ifdef WINDOWS32
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
line, not in MAKEFLAGS. */
job_slots = default_job_slots;
if (jobserver_fds)
{
/* MSVC erroneously warns without a cast here. */
free ((void *)jobserver_fds->list);
free (jobserver_fds);
jobserver_fds = 0;
}
free (jobserver_fds);
jobserver_fds = 0;
}
}
@@ -3415,9 +3426,14 @@ die (int status)
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_close (&make_sync);
}
output_close (NULL);

View File

@@ -2,10 +2,25 @@
# only if you have the full copy of the GNU make sources from the Git
# tree, not a dist copy.
BUGLIST := bug-make@gnu.org
# These are related to my personal setup.
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!
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
AM_CPPFLAGS += $(MAKE_MAINTAINER_MODE)
@@ -99,23 +114,40 @@ git-very-clean: git-clean
-$(GIT) clean -fd
# ----------------------------------------------------------------------
#
# The sections below were stolen from the Makefile.maint used by fileutils,
# sh-utils, textutils, CPPI, Bison, and Autoconf.
## ---------------------- ##
## Generating ChangeLog. ##
## ---------------------- ##
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. ##
## ---------------- ##
WGET = wget --passive-ftp -nv
WGET = wget --passive-ftp -np -nv
ftp-gnu = ftp://ftp.gnu.org/gnu
move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
echo $(target) is unchanged; rm -f $(target).t; \
else \
mv $(target).t $(target); \
mv -f $(target).t $(target); \
fi
# ------------------- #
@@ -127,8 +159,7 @@ move_if_change = if test -r $(target) && cmp -s $(target).t $(target); then \
# http://translation.sf.net/maint/
# ftp://tiger.informatik.hu-berlin.de/pub/po/maint/
po_wget_flags = --recursive --level=1 --no-directories --no-parent \
--no-check-certificate
po_wget_flags = --recursive --level=1 --no-directories --no-check-certificate
po_repo = http://translationproject.org/latest/$(PACKAGE)
.PHONY: do-po-update po-update
do-po-update:
@@ -137,7 +168,8 @@ do-po-update:
&& mkdir "$$tmppo" \
&& (cd "$$tmppo" \
&& $(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
$(MAKE) po-check
@@ -198,20 +230,22 @@ check-alt-config: \
checkcfg.CPPFLAGS^-DNO_OUTPUT_SYNC \
checkcfg.CPPFLAGS^-DNO_ARCHIVES
NR_MAKE = $(MAKE)
# Check builds both with build.sh and with make
checkcfg.%: distdir
@ rm -rf $(distdir)/_build \
@( rm -rf $(distdir)/_build \
&& mkdir $(distdir)/_build \
&& cd $(distdir)/_build \
&& echo "Testing configure with $(subst ^,=,$*)" \
&& ../configure --srcdir=.. $(subst ^,=,$*) \
$(AM_DISTCHECK_CONFIGURE_FLAGS) $(DISTCHECK_CONFIGURE_FLAGS) \
CFLAGS='$(AM_CFLAGS)' \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) check
.PHONY: update
update: po-update scm-update
&& ./build.sh \
&& ./make $(AM_MAKEFLAGS) check \
&& rm -f *.o make \
&& $(NR_MAKE) $(AM_MAKEFLAGS) \
&& ./make $(AM_MAKEFLAGS) check ) 2>&1 | tee checkcfg.$*.log
## --------------- ##
@@ -221,6 +255,8 @@ update: po-update scm-update
# Before we build a distribution be sure we run our local checks
#distdir: local-check
.PHONY: local-check po-check changelog-check
# Checks that don't require Git. Run 'changelog-check' last as
# previous test may reveal problems requiring new ChangeLog entries.
local-check: po-check changelog-check
@@ -245,10 +281,54 @@ po-check:
rm -f $@-1 $@-2; \
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. ##
## ------------------------- ##
.PHONY: tag-release
tag-release:
case '$(VERSION)' in \
(*.*.9*) message=" candidate" ;; \
@@ -302,7 +382,7 @@ $(UPLOADS): $(DIST_ARCHIVES) $(DIST_ARCHIVES_SIG) $(DIST_ARCHIVES_DIRECTIVE)
$(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.
#
# 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
McGrath. Maintained by Paul Smith.
.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
.IR "GNU make" .
.LP

View File

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

View File

@@ -1,8 +1,7 @@
$!
$! Makefile.com - builds GNU Make for VMS
$!
$! P1 is non-empty if you want to link with the VAXCRTL library instead
$! of the shareable executable
$! P1 = LIST will provide compiler listings.
$! P2 = DEBUG will build an image with debug information
$! P3 = WALL will enable all warning messages (some are suppressed since
$! one macro intentionally causes an error condition)
@@ -50,6 +49,12 @@ $ endif
$ endif
$ endif
$!
$!
$ if (p1 .eqs. "LIST")
$ then
$ ccopt = ccopt + "/list/show=(expan,inclu)"
$ endif
$!
$! Should we build a debug image
$!
$ if (p2.eqs."DEBUG")
@@ -67,9 +72,11 @@ $ then
$ gosub check_cc_qual
$ endif
$ filelist = "alloca ar arscan commands default dir expand file function " + -
"hash implicit job load main misc read remake remote-stub rule " + -
"output signame variable version vmsfunctions vmsify vpath " + -
"guile hash implicit job load main misc read remake " + -
"remote-stub rule output signame variable version " + -
"vmsfunctions vmsify vpath " + -
"[.glob]glob [.glob]fnmatch getopt1 getopt strcache"
$!
$ copy config.h-vms config.h
$ n=0
$ open/write optf make.opt
@@ -77,18 +84,14 @@ $ loop:
$ cfile = f$elem(n," ",filelist)
$ if cfile .eqs. " " then goto linkit
$ write sys$output "Compiling ''cfile'..."
$ call compileit 'cfile' 'p1'
$ call compileit 'cfile'
$ n = n + 1
$ goto loop
$ linkit:
$ close optf
$ if p1 .nes. "" then goto link_using_library
$ link/exe=make make.opt/opt'lopt
$ goto cleanup
$
$ link_using_library:
$ link/exe=make make.opt/opt,sys$library:vaxcrtl/lib'lopt
$
$ cleanup:
$ if f$trnlnm("SYS").nes."" then $ deassign sys
$ if f$trnlnm("OPTF").nes."" then $ close optf
@@ -128,17 +131,22 @@ $!-----------------------------------------------------------------------------
$!
$ compileit : subroutine
$ ploc = f$locate("]",p1)
$ filnam = p1
$ if ploc .lt. f$length(p1) then filnam=f$extract(ploc+1,100,p1)
$ write optf "''filnam'"
$ cc'ccopt'/include=([],[.glob]) -
$ if ploc .lt. f$length(p1)
$ then
$ objdir = f$extract(0, ploc+1, p1)
$ 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") -
'p1'
$ exit
$ 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.
$!
$!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
#
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
# Copyright (C) 1996-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
@@ -88,13 +88,13 @@ mandir = []
# Number to put on the man page filename.
manext = 1
#guile = ,guile.obj
guile = ,guile.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,\
default.obj,variable.obj,expand.obj,function.obj,strcache.obj,\
vpath.obj,version.obj\
$(ARCHIVES)$(ALLOCA)$(extras)$(getopt)$(glob)$(guile)
vpath.obj,version.obj$(guile)\
$(ARCHIVES)$(ALLOCA)$(extras)$(getopt)$(glob)
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 \
@@ -118,40 +118,56 @@ clean:
-$(RM) make.exe;,*.obj;
-$(RM) [.glob]*.obj;
# Automatically generated dependencies.
# makeint.h: config.h gnumake.h gettext.h
# filedef.h: hash.h
ar.obj: ar.c makeint.h filedef.h dep.h [.glob]fnmatch.h
arscan.obj: arscan.c makeint.h
commands.obj: commands.c makeint.h dep.h commands.h filedef.h variable.h job.h
default.obj: default.c makeint.h rule.h dep.h job.h filedef.h commands.h variable.h
dir.obj: dir.c makeint.h hash.h [.glob]glob.h
expand.obj: expand.c makeint.h commands.h filedef.h job.h rule.h variable.h
file.obj: file.c makeint.h commands.h dep.h filedef.h variable.h job.h debug.h
function.obj: function.c makeint.h variable.h dep.h commands.h filedef.h debug.h job.h
getopt.obj: getopt.c getopt.h config.h gettext.h
getopt1.obj: getopt1.c getopt.h config.h
guile.obj: guile.c makeint.h debug.h dep.h gmk-default.h
hash.obj: hash.c makeint.h hash.h
implicit.obj: implicit.c makeint.h rule.h dep.h filedef.h debug.h variable.h job.h commands.h
job.obj: job.c vmsjobs.c makeint.h commands.h job.h filedef.h variable.h debug.h
output.obj: output.c vmsjobs.c makeint.h output.h filedef.h debug.h
load.obj: load.c makeint.h debug.h filedef.h variable.h
main.obj: main.c makeint.h commands.h dep.h filedef.h variable.h job.h rule.h debug.h getopt.h
misc.obj: misc.c makeint.h dep.h debug.h
read.obj: read.c makeint.h commands.h dep.h filedef.h variable.h [.glob]glob.h debug.h rule.h job.h
remake.obj: remake.c makeint.h commands.h job.h dep.h filedef.h variable.h debug.h
remote-stub.obj: remote-stub.c makeint.h filedef.h job.h commands.h
rule.obj: rule.c makeint.h commands.h dep.h filedef.h variable.h rule.h job.h
signame.obj: signame.c makeint.h
strcache.obj: strcache.c makeint.h hash.h
variable.obj: variable.c makeint.h commands.h variable.h dep.h filedef.h job.h rule.h
ar.obj: ar.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h dep.h \
[.glob]fnmatch.h
arscan.obj: arscan.c makeint.h config.h gnumake.h gettext.h
commands.obj: commands.c makeint.h config.h gnumake.h gettext.h filedef.h \
hash.h dep.h variable.h job.h output.h commands.h
default.obj: default.c makeint.h config.h gnumake.h gettext.h filedef.h \
hash.h variable.h rule.h dep.h job.h output.h commands.h
dir.obj: dir.c makeint.h config.h gnumake.h gettext.h hash.h filedef.h \
dep.h [.glob]glob.h
expand.obj: expand.c makeint.h config.h gnumake.h gettext.h filedef.h \
hash.h job.h output.h commands.h variable.h rule.h
file.obj: file.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
dep.h job.h output.h commands.h variable.h debug.h
[.glob]fnmatch.obj: [.glob]fnmatch.c config.h [.glob]fnmatch.h
function.obj: function.c makeint.h config.h gnumake.h gettext.h filedef.h \
hash.h variable.h dep.h job.h output.h commands.h debug.h
getopt.obj: getopt.c config.h gettext.h getopt.h
getopt1.obj: getopt1.c config.h getopt.h
[.glob]glob.obj: [.glob]glob.c config.h [.glob]fnmatch.h [.glob]glob.h
guile.obj: guile.c makeint.h config.h gnumake.h gettext.h
hash.obj: hash.c makeint.h config.h gnumake.h gettext.h hash.h
implicit.obj: implicit.c makeint.h config.h gnumake.h gettext.h filedef.h \
hash.h rule.h dep.h debug.h variable.h job.h output.h commands.h
job.obj: job.c makeint.h config.h gnumake.h gettext.h job.h output.h debug.h \
filedef.h hash.h commands.h variable.h debug.h vmsjobs.c
load.obj: load.c makeint.h config.h gnumake.h gettext.h
main.obj: main.c makeint.h config.h gnumake.h gettext.h filedef.h hash.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
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
vpath.obj: vpath.c makeint.h filedef.h variable.h
[.glob]fnmatch.obj: [.glob]fnmatch.c [.glob]fnmatch.h config.h
[.glob]glob.obj: [.glob]glob.c [.glob]glob.h [.glob]fnmatch.h config.h
vpath.obj: vpath.c makeint.h config.h gnumake.h gettext.h filedef.h hash.h \
variable.h
config.h: config.h-vms
$(CP) $< $@

View File

@@ -1,5 +1,5 @@
/* 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.
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))
#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
# define CHAR_MAX INTEGER_TYPE_MAXIMUM (char)
#endif
@@ -353,8 +350,8 @@ char *strsignal (int signum);
# include <malloc.h>
# define pipe(_p) _pipe((_p), 512, O_BINARY)
# define kill(_pid,_sig) w32_kill((_pid),(_sig))
/* MSVC doesn't have ftruncate. */
# ifdef _MSC_VER
/* MSVC and Watcom C don't have ftruncate. */
# if defined(_MSC_VER) || defined(__WATCOMC__)
# define ftruncate(_fd,_len) _chsize(_fd,_len)
# endif
/* MinGW64 doesn't have _S_ISDIR. */
@@ -400,8 +397,8 @@ extern int unixy_shell;
#define MAP_USERFUNC 0x2000
/* This means not only a '$', but skip the variable reference. */
#define MAP_VARIABLE 0x4000
/* The set of characters which are path separators is OS-specific. */
#define MAP_PATHSEP 0x8000
/* The set of characters which are directory separators is OS-specific. */
#define MAP_DIRSEP 0x8000
#ifdef VMS
# define MAP_VMSCOMMA MAP_COMMA
@@ -409,7 +406,7 @@ extern int unixy_shell;
# define MAP_VMSCOMMA 0x0000
#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)
# define SET_STACK_SIZE
@@ -421,17 +418,42 @@ extern struct rlimit stack_limit;
#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)
/* 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, ...);
void message (int prefix, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
void error (const gmk_floc *flocp, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 2, 3)));
void fatal (const gmk_floc *flocp, const char *fmt, ...)
__attribute__ ((noreturn, __format__ (__printf__, 2, 3)));
void message (int prefix, size_t length, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
void error (const gmk_floc *flocp, size_t length, const char *fmt, ...)
__attribute__ ((__format__ (__printf__, 3, 4)));
void fatal (const gmk_floc *flocp, size_t length, const char *fmt, ...)
__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 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);
/* Guile support */
#ifdef HAVE_GUILE
int guile_gmake_setup (const gmk_floc *flocp);
#endif
/* Loadable object support. Sets to the strcached name of the loaded file. */
typedef int (*load_func_t)(const gmk_floc *flocp);
@@ -595,7 +615,17 @@ extern double max_load_average;
extern int max_load_average;
#endif
#ifdef WINDOWS32
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 unsigned int makelevel;
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))
#endif
#ifdef VMS
# define MAKE_SUCCESS 1
# define MAKE_TROUBLE 2
# define MAKE_FAILURE 3
/* These are the VMS __posix_exit compliant exit codes, constructed out of
STS$M_INHIB_MSG, C facility code, a POSIX condition code mask, MAKE_NNN<<3 and
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
# define MAKE_SUCCESS 0
# define MAKE_TROUBLE 1

12
misc.c
View File

@@ -1,5 +1,5 @@
/* 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.
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. */
void *result = malloc (size ? size : 1);
if (result == 0)
fatal (NILF, _("virtual memory exhausted"));
OUT_OF_MEM();
return result;
}
@@ -230,7 +230,7 @@ xcalloc (unsigned int size)
/* Make sure we don't allocate 0, for pre-ISO implementations. */
void *result = calloc (size ? size : 1, 1);
if (result == 0)
fatal (NILF, _("virtual memory exhausted"));
OUT_OF_MEM();
return result;
}
@@ -245,7 +245,7 @@ xrealloc (void *ptr, unsigned int size)
size = 1;
result = ptr ? realloc (ptr, size) : malloc (size);
if (result == 0)
fatal (NILF, _("virtual memory exhausted"));
OUT_OF_MEM();
return result;
}
@@ -262,7 +262,7 @@ xstrdup (const char *ptr)
#endif
if (result == 0)
fatal (NILF, _("virtual memory exhausted"));
OUT_OF_MEM();
#ifdef HAVE_STRDUP
return result;
@@ -281,7 +281,7 @@ xstrndup (const char *str, unsigned int length)
#ifdef HAVE_STRNDUP
result = strndup (str, length);
if (result == 0)
fatal (NILF, _("virtual memory exhausted"));
OUT_OF_MEM();
#else
result = xmalloc (length + 1);
if (length > 0)

165
output.c
View File

@@ -1,5 +1,5 @@
/* 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.
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)
#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
# 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;
}
# define STREAM_OK(_s) 1
#endif
/* Write a string to the current STDOUT or STDERR. */
@@ -117,7 +93,7 @@ log_working_directory (int entering)
char *p;
/* 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)
need += strlen (starting_directory);
@@ -264,7 +240,11 @@ pump_from_tmp (int from, FILE *to)
if (len <= 0)
break;
if (fwrite (buffer, len, 1, to) < 1)
perror ("fwrite()");
{
perror ("fwrite()");
break;
}
fflush (to);
}
#ifdef WINDOWS32
@@ -512,10 +492,10 @@ close_stdout (void)
if (prev_fail || fclose_fail)
{
if (fclose_fail)
error (NILF, _("write error: %s"), strerror (errno));
perror_with_name (_("write error: stdout"), "");
else
error (NILF, _("write error"));
exit (EXIT_FAILURE);
O (error, NILF, _("write error: stdout"));
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
{
char *buffer;
unsigned int size;
unsigned int len;
} fmtbuf = { NULL, 0, 0 };
size_t size;
} fmtbuf = { NULL, 0 };
/* Concatenate a formatted string onto the format buffer. */
static const char *
vfmtconcat (const char *fmt, va_list args)
static char *
get_buffer (size_t need)
{
va_list vcopy;
int tot;
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)
/* Make sure we have room. NEED includes space for \0. */
if (need > fmtbuf.size)
{
fmtbuf.size += tot * 2;
fmtbuf.size += need * 2;
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.len += tot;
fmtbuf.buffer[need-1] = '\0';
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. */
void
message (int prefix, const char *fmt, ...)
message (int prefix, size_t len, const char *fmt, ...)
{
va_list args;
char *p;
assert (fmt != NULL);
fmtbuf.len = 0;
len += strlen (fmt) + strlen (program) + INTSTR_LENGTH + 4 + 1 + 1;
p = get_buffer (len);
if (prefix)
{
if (makelevel == 0)
fmtconcat ("%s: ", program);
sprintf (p, "%s: ", program);
else
fmtconcat ("%s[%u]: ", program, makelevel);
sprintf (p, "%s[%u]: ", program, makelevel);
p += strlen (p);
}
va_start (args, fmt);
vfmtconcat (fmt, args);
vsprintf (p, fmt, args);
va_end (args);
fmtconcat ("\n");
strcat (p, "\n");
assert (fmtbuf.buffer[len-1] == '\0');
outputs (0, fmtbuf.buffer);
}
/* Print an error message. */
void
error (const gmk_floc *flocp, const char *fmt, ...)
error (const gmk_floc *flocp, size_t len, const char *fmt, ...)
{
va_list args;
char *p;
assert (fmt != NULL);
fmtbuf.len = 0;
len += (strlen (fmt) + strlen (program)
+ (flocp && flocp->filenm ? strlen (flocp->filenm) : 0)
+ INTSTR_LENGTH + 4 + 1 + 1);
p = get_buffer (len);
if (flocp && flocp->filenm)
fmtconcat ("%s:%lu: ", flocp->filenm, flocp->lineno);
sprintf (p, "%s:%lu: ", flocp->filenm, flocp->lineno);
else if (makelevel == 0)
fmtconcat ("%s: ", program);
sprintf (p, "%s: ", program);
else
fmtconcat ("%s[%u]: ", program, makelevel);
sprintf (p, "%s[%u]: ", program, makelevel);
p += strlen (p);
va_start (args, fmt);
vfmtconcat (fmt, args);
vsprintf (p, fmt, args);
va_end (args);
fmtconcat ("\n");
strcat (p, "\n");
assert (fmtbuf.buffer[len-1] == '\0');
outputs (1, fmtbuf.buffer);
}
/* Print an error message and exit. */
void
fatal (const gmk_floc *flocp, const char *fmt, ...)
fatal (const gmk_floc *flocp, size_t len, const char *fmt, ...)
{
va_list args;
const char *stop = _(". Stop.\n");
char *p;
assert (fmt != NULL);
fmtbuf.len = 0;
len += (strlen (fmt) + strlen (program)
+ (flocp && flocp->filenm ? strlen (flocp->filenm) : 0)
+ INTSTR_LENGTH + 8 + strlen (stop) + 1);
p = get_buffer (len);
if (flocp && flocp->filenm)
fmtconcat ("%s:%lu: *** ", flocp->filenm, flocp->lineno);
sprintf (p, "%s:%lu: *** ", flocp->filenm, flocp->lineno);
else if (makelevel == 0)
fmtconcat ("%s: *** ", program);
sprintf (p, "%s: *** ", program);
else
fmtconcat ("%s[%u]: *** ", program, makelevel);
sprintf (p, "%s[%u]: *** ", program, makelevel);
p += strlen (p);
va_start (args, fmt);
vfmtconcat (fmt, args);
vsprintf (p, fmt, args);
va_end (args);
fmtconcat (_(". Stop.\n"));
strcat (p, stop);
assert (fmtbuf.buffer[len-1] == '\0');
outputs (1, fmtbuf.buffer);
die (2);
die (MAKE_FAILURE);
}
/* Print an error message from errno. */
@@ -748,7 +707,8 @@ fatal (const gmk_floc *flocp, const char *fmt, ...)
void
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. */
@@ -756,7 +716,8 @@ perror_with_name (const char *str, const char *name)
void
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 */
}

View File

@@ -1,5 +1,5 @@
/* 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.
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-*-
# Copyright (C) 2002-2013 Free Software Foundation, Inc.
# Copyright (C) 2002-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

View File

@@ -1,5 +1,5 @@
# 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.
#
# 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.
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Copyright (C) 1988-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
@@ -238,7 +238,7 @@ read_all_makefiles (const char **makefiles)
if (num_makefiles == 0)
{
static char *default_makefiles[] =
static const char *default_makefiles[] =
#ifdef VMS
/* all lower case since readdir() (the vms version) 'lowercasifies' */
{ "makefile.vms", "gnumakefile.", "makefile.", 0 };
@@ -246,10 +246,14 @@ read_all_makefiles (const char **makefiles)
#ifdef _AMIGA
{ "GNUmakefile", "Makefile", "SMakefile", 0 };
#else /* !Amiga && !VMS */
#ifdef WINDOWS32
{ "GNUmakefile", "makefile", "Makefile", "makefile.mak", 0 };
#else /* !Amiga && !VMS && !WINDOWS32 */
{ "GNUmakefile", "makefile", "Makefile", 0 };
#endif /* !Amiga && !VMS && !WINDOWS32 */
#endif /* AMIGA */
#endif /* VMS */
register char **p = default_makefiles;
const char **p = default_makefiles;
while (*p != 0 && !file_exists_p (*p))
++p;
@@ -307,10 +311,8 @@ static void
restore_conditionals (struct conditionals *saved)
{
/* Free any space allocated by conditional_line. */
if (conditionals->ignoring)
free (conditionals->ignoring);
if (conditionals->seen_else)
free (conditionals->seen_else);
free (conditionals->ignoring);
free (conditionals->seen_else);
/* Restore state. */
conditionals = saved;
@@ -368,7 +370,10 @@ eval_makefile (const char *filename, int flags)
case ENFILE:
#endif
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
@@ -406,8 +411,7 @@ eval_makefile (const char *filename, int flags)
if (flags & RM_DONTCARE)
deps->dontcare = 1;
if (expanded)
free (expanded);
free (expanded);
/* 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)
{
collapsed_length = linelen+1;
if (collapsed)
free (collapsed);
free (collapsed);
/* Don't need xrealloc: we don't need to preserve the content. */
collapsed = xmalloc (collapsed_length);
}
@@ -783,7 +786,7 @@ eval (struct ebuffer *ebuf, int set_default)
if (i != -2)
{
if (i == -1)
fatal (fstart, _("invalid syntax in conditional"));
O (fatal, fstart, _("invalid syntax in conditional"));
ignoring = i;
continue;
@@ -853,8 +856,7 @@ eval (struct ebuffer *ebuf, int set_default)
/* No pattern means remove all previous selective VPATH's. */
vpat = 0;
construct_vpath_list (vpat, p);
if (vpat != 0)
free (vpat);
free (vpat);
continue;
}
@@ -912,7 +914,10 @@ eval (struct ebuffer *ebuf, int set_default)
| (noerror ? RM_DONTCARE : 0)
| (set_default ? 0 : RM_NO_DEFAULT_GOAL)));
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. */
@@ -958,7 +963,7 @@ eval (struct ebuffer *ebuf, int set_default)
/* Load the file. 0 means failure. */
r = load_file (&ebuf->floc, &name, noerror);
if (! r && ! noerror)
fatal (&ebuf->floc, _("%s: failed to load"), name);
OS (fatal, &ebuf->floc, _("%s: failed to load"), name);
free_ns (files);
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
variable definition. But now we know it is definitely lossage. */
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
the existence of target-specific variables, because we can't
@@ -1033,7 +1038,7 @@ eval (struct ebuffer *ebuf, int set_default)
{
case w_eol:
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
but whitespace (a comment?). */
continue;
@@ -1117,13 +1122,15 @@ eval (struct ebuffer *ebuf, int set_default)
it. If so, we can't parse this line so punt. */
if (wtype == w_eol)
{
if (*p2 != '\0')
/* There's no need to be ivory-tower about this: check for
one of the most common bugs found in makefiles... */
fatal (fstart, _("missing separator%s"),
(cmd_prefix == '\t' && !strneq (line, " ", 8))
? "" : _(" (did you mean TAB instead of 8 spaces?)"));
continue;
if (*p2 == '\0')
continue;
/* There's no need to be ivory-tower about this: check for
one of the most common bugs found in makefiles... */
if (cmd_prefix == '\t' && strneq (line, " ", 8))
O (fatal, fstart, _("missing separator (did you mean TAB instead of 8 spaces?)"));
else
O (fatal, fstart, _("missing separator"));
}
/* 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);
++p2;
if (target == 0)
fatal (fstart, _("missing target pattern"));
O (fatal, fstart, _("missing target pattern"));
else if (target->next != 0)
fatal (fstart, _("multiple target patterns"));
O (fatal, fstart, _("multiple target patterns"));
pattern_percent = find_percent_cached (&target->name);
pattern = target->name;
if (pattern_percent == 0)
fatal (fstart, _("target pattern contains no '%%'"));
O (fatal, fstart, _("target pattern contains no '%%'"));
free_ns (target);
}
else
@@ -1388,13 +1395,12 @@ eval (struct ebuffer *ebuf, int set_default)
#undef word1eq
if (conditionals->if_cmds)
fatal (fstart, _("missing 'endif'"));
O (fatal, fstart, _("missing 'endif'"));
/* At eof, record the last rule. */
record_waiting_files ();
if (collapsed)
free (collapsed);
free (collapsed);
free (commands);
}
@@ -1427,7 +1433,7 @@ do_undefine (char *name, enum variable_origin origin, struct ebuffer *ebuf)
var = allocated_variable_expand (name);
name = next_token (var);
if (*name == '\0')
fatal (&ebuf->floc, _("empty variable name"));
O (fatal, &ebuf->floc, _("empty variable name"));
p = name + strlen (name) - 1;
while (p > name && isblank ((unsigned char)*p))
--p;
@@ -1462,7 +1468,7 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
else
{
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. */
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);
name = next_token (n);
if (name[0] == '\0')
fatal (&defstart, _("empty variable name"));
O (fatal, &defstart, _("empty variable name"));
p = name + strlen (name) - 1;
while (p > name && isblank ((unsigned char)*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 (nlines < 0)
fatal (&defstart, _("missing 'endef', unterminated 'define'"));
O (fatal, &defstart, _("missing 'endef', unterminated 'define'"));
ebuf->floc.lineno += nlines;
line = ebuf->buffer;
@@ -1514,8 +1520,8 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
p += 5;
remove_comments (p);
if (*(next_token (p)) != '\0')
error (&ebuf->floc,
_("extraneous text after 'endef' directive"));
O (error, &ebuf->floc,
_("extraneous text after 'endef' directive"));
if (--nlevels == 0)
break;
@@ -1564,7 +1570,7 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
static int
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;
unsigned int i;
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. */
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 */
if (cmdtype == c_endif)
{
if (*line != '\0')
EXTRANEOUS ();
EXTRATEXT ();
if (!conditionals->if_cmds)
fatal (flocp, _("extraneous '%s'"), cmdname);
EXTRACMD ();
--conditionals->if_cmds;
@@ -1609,12 +1616,12 @@ conditional_line (char *line, int len, const gmk_floc *flocp)
const char *p;
if (!conditionals->if_cmds)
fatal (flocp, _("extraneous '%s'"), cmdname);
EXTRACMD ();
o = conditionals->if_cmds - 1;
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. */
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 (word1eq ("else") || word1eq ("endif")
|| conditional_line (line, len, flocp) < 0)
EXTRANEOUS ();
EXTRATEXT ();
else
{
/* 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 = next_token (++line);
if (*line != '\0')
EXTRANEOUS ();
EXTRATEXT ();
s2 = variable_expand (s2);
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;
v = try_variable_definition (flocp, defn, origin, 1);
if (!v)
fatal (flocp, _("Malformed target-specific variable definition"));
O (fatal, flocp, _("Malformed target-specific variable definition"));
current_variable_set_list = global;
}
@@ -1909,8 +1916,7 @@ record_target_var (struct nameseq *filenames, char *defn,
if (gv && v != gv
&& (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->origin = gv->origin;
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.
See Savannah bug # 12124. */
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. */
name = filenames->name;
@@ -2006,7 +2012,7 @@ record_files (struct nameseq *filenames, const char *pattern,
unsigned int c;
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.
We already have the first one. */
@@ -2029,7 +2035,7 @@ record_files (struct nameseq *filenames, const char *pattern,
implicit_percent = find_percent_cached (&name);
if (implicit_percent == 0)
fatal (flocp, _("mixed implicit and normal rules"));
O (fatal, flocp, _("mixed implicit and normal rules"));
targets[c] = name;
target_pats[c] = implicit_percent;
@@ -2081,7 +2087,8 @@ record_files (struct nameseq *filenames, const char *pattern,
'targets: target%pattern: prereq%pattern; recipe',
make sure the pattern matches this target 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)
/* 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
@@ -2095,25 +2102,26 @@ record_files (struct nameseq *filenames, const char *pattern,
if any. */
f = enter_file (strcache_add (name));
if (f->double_colon)
fatal (flocp,
_("target file '%s' has both : and :: entries"), f->name);
OS (fatal, flocp,
_("target file '%s' has both : and :: entries"), f->name);
/* If CMDS == F->CMDS, this target was listed in this rule
more than once. Just give a warning since this is harmless. */
if (cmds != 0 && cmds == f->cmds)
error (flocp,
_("target '%s' given more than once in the same rule"),
f->name);
OS (error, flocp,
_("target '%s' given more than once in the same rule"),
f->name);
/* Check for two single-colon entries both with commands.
Check is_target so that we don't lose on files such as .c.o
whose commands were preinitialized. */
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'"),
f->name);
error (&f->cmds->fileinfo,
error (&f->cmds->fileinfo, l,
_("warning: ignoring old recipe for target '%s'"),
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
on default suffix rules or makefiles. */
if (f != 0 && f->is_target && !f->double_colon)
fatal (flocp,
_("target file '%s' has both : and :: entries"), f->name);
OS (fatal, flocp,
_("target file '%s' has both : and :: entries"), f->name);
f = enter_file (strcache_add (name));
/* 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 */
name = filenames->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)
{
/* It's not; just take it all without unescaping. */
memcpy (p, s, l);
memmove (p, s, l);
p += l;
}
else if (l > 1)
{
/* It is, and there's >1 backslash. Take half of them. */
l /= 2;
memcpy (p, s, l);
memmove (p, s, l);
p += l;
}
s = e;
@@ -2526,8 +2535,8 @@ readline (struct ebuffer *ebuf)
lossage strikes again! (xmkmf puts NULs in its makefiles.)
There is nothing really to be done; we synthesize a newline so
the following line doesn't appear to be part of this line. */
error (&ebuf->floc,
_("warning: NUL character seen; rest of line ignored"));
O (error, &ebuf->floc,
_("warning: NUL character seen; rest of line ignored"));
p[0] = '\n';
len = 1;
}
@@ -2842,8 +2851,7 @@ construct_include_path (const char **arg_dirs)
dirs[idx++] = strcache_add_len (dir, len);
}
if (expanded)
free (expanded);
free (expanded);
}
/* 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))
{
case GLOB_NOSPACE:
fatal (NILF, _("virtual memory exhausted"));
OUT_OF_MEM();
case 0:
/* Success. */
@@ -3335,12 +3343,10 @@ parse_file_seq (char **stringp, unsigned int size, int stopmap,
globfree (&gl);
#ifndef NO_ARCHIVES
if (arname)
free (arname);
free (arname);
#endif
if (tildep)
free (tildep);
free (tildep);
}
*stringp = p;

153
remake.c
View File

@@ -1,5 +1,5 @@
/* 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.
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). */
static unsigned int considered;
static int update_file (struct file *file, unsigned int depth);
static int update_file_1 (struct file *file, unsigned int depth);
static int check_dep (struct file *file, unsigned int depth,
FILE_TIMESTAMP this_mtime, int *must_make_ptr);
static enum update_status update_file (struct file *file, unsigned int depth);
static enum update_status update_file_1 (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);
static enum update_status touch_file (struct file *file);
static void remake_file (struct file *file);
static FILE_TIMESTAMP name_mtime (const char *name);
@@ -130,7 +130,7 @@ update_goal_chain (struct dep *goals)
file = file->prev)
{
unsigned int ocommands_started;
int fail;
enum update_status fail;
file->dontcare = g->dontcare;
@@ -161,14 +161,12 @@ update_goal_chain (struct dep *goals)
if (commands_started > ocommands_started)
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;
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
tells our caller which. */
@@ -228,10 +226,10 @@ update_goal_chain (struct dep *goals)
&& file->update_status == us_success && !g->changed
/* Never give a message under -s or -q. */
&& !silent_flag && !question_flag)
message (1, ((file->phony || file->cmds == 0)
? _("Nothing to be done for '%s'.")
: _("'%s' is up to date.")),
file->name);
OS (message, 1, ((file->phony || file->cmds == 0)
? _("Nothing to be done for '%s'.")
: _("'%s' is up to date.")),
file->name);
/* This goal is finished. Remove it from the chain. */
if (lastgoal == 0)
@@ -282,11 +280,11 @@ update_goal_chain (struct dep *goals)
If there are multiple double-colon entries for FILE,
each is considered in turn. */
static int
static enum update_status
update_file (struct file *file, unsigned int depth)
{
int status = 0;
register struct file *f;
enum update_status status = us_success;
struct file *f;
f = file->double_colon ? file->double_colon : file;
@@ -311,26 +309,31 @@ update_file (struct file *file, unsigned int depth)
the chain is exhausted. */
for (; f != 0; f = f->prev)
{
enum update_status new;
f->considered = considered;
status |= update_file_1 (f, depth);
new = update_file_1 (f, depth);
check_renamed (f);
/* Clean up any alloca() used during the update. */
alloca (0);
/* If we got an error, don't bother with double_colon etc. */
if (status != 0 && !keep_going_flag)
return status;
if (new && !keep_going_flag)
return new;
if (f->command_state == cs_running
|| f->command_state == cs_deps_running)
{
/* Don't run the other :: rules for this
file until this rule is finished. */
status = 0;
status = us_success;
break;
}
if (new > status)
status = new;
}
/* 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;
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;
@@ -373,24 +380,30 @@ complain (struct file *file)
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. */
if (!keep_going_flag)
if (file->parent)
{
if (file->parent == 0)
fatal (NILF, msg_noparent, "", file->name, "");
size_t l = strlen (file->name) + strlen (file->parent->name) + 4;
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
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;
}
@@ -399,12 +412,12 @@ complain (struct file *file)
/* Consider a single 'struct file' and update it as appropriate.
Return 0 on success, or non-0 on failure. */
static int
static enum update_status
update_file_1 (struct file *file, unsigned int depth)
{
enum update_status dep_status = us_success;
FILE_TIMESTAMP this_mtime;
int noexist, must_make, deps_changed;
int dep_status = 0;
struct file *ofile;
struct dep *d, *ad;
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. */
int ns = FILE_TIMESTAMP_NS (this_mtime);
if (ns != 0)
error (NILF, _("*** Warning: .LOW_RESOLUTION_TIME file '%s' has a high resolution time stamp"),
file->name);
OS (error, NILF,
_("*** Warning: .LOW_RESOLUTION_TIME file '%s' has a high resolution time stamp"),
file->name);
this_mtime += FILE_TIMESTAMPS_PER_S - 1 - ns;
}
@@ -521,6 +535,7 @@ update_file_1 (struct file *file, unsigned int depth)
while (d)
{
enum update_status new;
FILE_TIMESTAMP mtime;
int maybe_make;
int dontcare = 0;
@@ -532,8 +547,8 @@ update_file_1 (struct file *file, unsigned int depth)
if (is_updating (d->file))
{
error (NILF, _("Circular %s <- %s dependency dropped."),
file->name, d->file->name);
OSS (error, NILF, _("Circular %s <- %s dependency dropped."),
file->name, d->file->name);
/* We cannot free D here because our the caller will still have
a reference to it when we were called recursively via
check_dep below. */
@@ -555,7 +570,9 @@ update_file_1 (struct file *file, unsigned int depth)
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. */
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)
if (d->file->intermediate)
{
enum update_status new;
int dontcare = 0;
FILE_TIMESTAMP mtime = file_mtime (d->file);
@@ -619,7 +637,9 @@ update_file_1 (struct file *file, unsigned int depth)
not prune it. */
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. */
if (rebuilding_makefiles)
@@ -664,9 +684,10 @@ update_file_1 (struct file *file, unsigned int depth)
/* 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);
--depth;
@@ -675,8 +696,8 @@ update_file_1 (struct file *file, unsigned int depth)
if (depth == 0 && keep_going_flag
&& !just_print_flag && !question_flag)
error (NILF,
_("Target '%s' not remade because of errors."), file->name);
OS (error, NILF,
_("Target '%s' not remade because of errors."), file->name);
return dep_status;
}
@@ -981,13 +1002,13 @@ notice_finished_file (struct file *file)
FILE depends on (including FILE itself). Return nonzero if any updating
failed. */
static int
static enum update_status
check_dep (struct file *file, unsigned int depth,
FILE_TIMESTAMP this_mtime, int *must_make_ptr)
{
struct file *ofile;
struct dep *d;
int dep_status = 0;
enum update_status dep_status = us_success;
++depth;
start_updating (file);
@@ -1060,12 +1081,13 @@ check_dep (struct file *file, unsigned int depth,
d = file->deps;
while (d != 0)
{
enum update_status new;
int maybe_make;
if (is_updating (d->file))
{
error (NILF, _("Circular %s <- %s dependency dropped."),
file->name, d->file->name);
OSS (error, NILF, _("Circular %s <- %s dependency dropped."),
file->name, d->file->name);
if (ld == 0)
{
file->deps = d->next;
@@ -1083,12 +1105,14 @@ check_dep (struct file *file, unsigned int depth,
d->file->parent = file;
maybe_make = *must_make_ptr;
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;
if (! d->ignore_mtime)
*must_make_ptr = maybe_make;
check_renamed (d->file);
if (dep_status != 0 && !keep_going_flag)
if (dep_status && !keep_going_flag)
break;
if (d->file->command_state == cs_running
@@ -1122,7 +1146,7 @@ static enum update_status
touch_file (struct file *file)
{
if (!silent_flag)
message (0, "touch %s", file->name);
OS (message, 0, "touch %s", file->name);
/* Print-only (-n) takes precedence over touch (-t). */
if (just_print_flag)
@@ -1369,8 +1393,9 @@ f_mtime (struct file *file, int search)
if (adjusted_now < adjusted_mtime)
{
#ifdef NO_FLOAT
error (NILF, _("Warning: File '%s' has modification time in the future"),
file->name);
OS (error, NILF,
_("Warning: File '%s' has modification time in the future"),
file->name);
#else
double from_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);
else
sprintf (from_now_string, "%.2g", from_now);
error (NILF, _("Warning: File '%s' has modification time %s s in the future"),
file->name, from_now_string);
OSS (error, NILF,
_("Warning: File '%s' has modification time %s s in the future"),
file->name, from_now_string);
#endif
clock_skew_detected = 1;
}
@@ -1520,7 +1546,7 @@ name_mtime (const char *name)
static const char *
library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
{
static char *dirs[] =
static const char *dirs[] =
{
#ifndef _AMIGA
"/lib",
@@ -1550,7 +1576,7 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
/* Information about the earliest (in the vpath sequence) match. */
unsigned int best_vpath = 0, best_path = 0;
char **dp;
const char **dp;
libpatterns = xstrdup (variable_expand ("$(.LIBPATTERNS)"));
@@ -1580,7 +1606,8 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
if (!p3)
{
/* 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;
continue;
}

View File

@@ -3,7 +3,7 @@
Please do not send bug reports or questions about it to
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.
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);
if (retsock < 0)
{
error (NILF, "exporting: Couldn't create return socket.");
O (error, NILF, "exporting: Couldn't create return socket.");
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);
if (status != RPC_SUCCESS)
{
(void) close (retsock);
(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);
}
{
const char *hnm = host ? host->h_name : inet_ntoa (permit.addr);
size_t hlen = strlen (hnm);
fflush (stdout);
fflush (stderr);
if (status != RPC_SUCCESS)
{
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 ();
if (pid < 0)

View File

@@ -1,5 +1,5 @@
/* 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.
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.
Copyright (C) 1988-2013 Free Software Foundation, Inc.
Copyright (C) 1988-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
@@ -140,8 +140,7 @@ count_implicit_rule_limits (void)
rule = next;
}
if (name != 0)
free (name);
free (name);
}
/* Create a pattern rule from a suffix rule.
@@ -357,7 +356,7 @@ void
install_pattern_rule (struct pspec *p, int terminal)
{
struct rule *r;
char *ptr;
const char *ptr;
r = xmalloc (sizeof (struct rule));
@@ -373,7 +372,7 @@ install_pattern_rule (struct pspec *p, int terminal)
++r->suffixes[0];
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))
{
@@ -528,7 +527,7 @@ print_rule_data_base (void)
/* This can happen if a fatal error was detected while reading the
makefiles and thus count_implicit_rule_limits wasn't called yet. */
if (num_pattern_rules != 0)
fatal (NILF, _("BUG: num_pattern_rules is wrong! %u != %u"),
num_pattern_rules, rules);
ONN (fatal, NILF, _("BUG: num_pattern_rules is wrong! %u != %u"),
num_pattern_rules, rules);
}
}

4
rule.h
View File

@@ -1,5 +1,5 @@
/* 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.
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. */
struct pspec
{
char *target, *dep, *commands;
const char *target, *dep, *commands;
};

View File

@@ -1,5 +1,5 @@
/* 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.
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.
Copyright (C) 2006-2013 Free Software Foundation, Inc.
Copyright (C) 2006-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

View File

@@ -1,5 +1,5 @@
@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
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

View File

@@ -1413,7 +1413,7 @@
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.
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.
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:
-----------------------------------------------------------------------------
Copyright (C) 1992-2013 Free Software Foundation, Inc.
Copyright (C) 1992-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

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.
# 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.
#
# 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>]
# (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.
#
# GNU Make is free software; you can redistribute it and/or modify it under
@@ -42,7 +42,24 @@ $command_string = '';
$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 "config-flags.pm";
# Some target systems might not have the POSIX module...
$has_POSIX = eval { require "POSIX.pm" };
@@ -177,6 +194,40 @@ sub run_make_with_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";
}
@@ -195,7 +246,6 @@ sub run_make_with_options {
$valgrind and $test_timeout = 0;
$code = &run_command_with_output($logname,$command);
$test_timeout = $old_timeout;
}
@@ -326,19 +376,28 @@ sub set_more_defaults
# Find the full pathname of Make. For DOS systems this is more
# complicated, so we ask make itself.
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
if ($osname eq 'VMS') {
# On VMS pre-setup make to be found with simply 'make'.
$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";
$make_path = $mk;
$make_path = $mk;
}
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]*)/;
$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\./) {
$make_name = $1;
}
@@ -387,7 +446,7 @@ sub set_more_defaults
$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/) {
$parallel_jobs = 0;
}

View File

@@ -11,32 +11,34 @@ exists $FEATURES{archives} or return -1;
# Create some .o files to work with
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.
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.
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;
# 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;
unlink('libxx.a');
# Very simple
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
($_ = $add) =~ s/#OBJECT#/a2.o/g;
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
utouch(-40, 'a1.o');
($_ = $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
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
utouch(-30, 'a1.o');
($_ = $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
utouch(-50, 'a2.o');
($_ = $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;
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
utouch(-40, 'a2.o');
($_ = $repl) =~ s/#OBJECT#/a2.o/g;
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));

View File

@@ -6,8 +6,6 @@ $details = "Test dynamic loading of modules.";
# Don't do anything if this system doesn't support "load"
exists $FEATURES{load} or return -1;
my $sobuild = '$(CC) '.($srcdir? "-I$srcdir":'').' -g -shared -fPIC -o $@ $<';
# First build a shared object
# Provide both a default and non-default load symbol
@@ -25,6 +23,7 @@ int plugin_is_GPL_compatible;
int
testload_gmk_setup (gmk_floc *pos)
{
(void)pos;
gmk_eval ("TESTLOAD = implicit", 0);
return 1;
}
@@ -32,6 +31,7 @@ testload_gmk_setup (gmk_floc *pos)
int
explicit_setup (gmk_floc *pos)
{
(void)pos;
gmk_eval ("TESTLOAD = explicit", 0);
return 1;
}
@@ -39,7 +39,15 @@ EOF
close($F) or die "close: testload.c: $!\n";
# 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
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"
exists $FEATURES{load} or return -1;
my $sobuild = '$(CC) '.($srcdir? "-I$srcdir":'').' -g -shared -fPIC -o $@ $<';
# First build a shared object
# Provide both a default and non-default load symbol
@@ -38,7 +36,7 @@ test_expand (const char *val)
static char *
test_noexpand (const char *val)
{
char *str = gmk_alloc (strlen (val));
char *str = gmk_alloc (strlen (val) + 1);
strcpy (str, val);
return str;
}
@@ -74,7 +72,13 @@ testapi_gmk_setup ()
EOF
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
# Check the gmk_expand() function

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