Compare commits

...

33 Commits

Author SHA1 Message Date
Paul Smith
dbb8f3e30b * Ouch: found a bug where re-exec from changed makefiles turned off
jobserver :(.
1999-09-23 18:23:33 +00:00
Paul Smith
c828aeaa98 * Oops. Fix a problem running submakes like $(MAKE) $(MFLAGS). 1999-09-22 05:57:52 +00:00
Paul Smith
3c83c469e4 * Fix escaping from perl to the shell. 1999-09-17 04:20:45 +00:00
Paul Smith
a63f51340b * A few script fixes and updates for 3.78. 1999-09-17 03:15:37 +00:00
Paul Smith
45e04a5860 * Some minor pre-release updates. 1999-09-16 05:58:44 +00:00
Paul Smith
6ec7d1881c * Fix some tests. 1999-09-16 03:43:10 +00:00
Paul Smith
c800367385 * Cleanup the test suite. 1999-09-15 22:23:35 +00:00
Paul Smith
0d366b6682 * Added the test suite to the main distribution. 1999-09-14 02:03:19 +00:00
Paul Smith
4121dea6a5 * Some configuration fixes. 1999-09-14 00:17:58 +00:00
Paul Smith
b88c1d3a3d * Various cleanups for release. 1999-09-11 05:44:53 +00:00
Paul Smith
373dbb43da * Various pre-release cleanups. 1999-09-11 05:10:27 +00:00
Paul Smith
5e9a3e34ac * Some doc and help changes. 1999-09-06 05:21:52 +00:00
Paul Smith
860a30ae1e * Fix for infinite recursion. 1999-09-04 22:05:18 +00:00
Paul Smith
e49b2f15c9 * Removed a memory stomp (reading freed memory).
* Fixed some infinite recursion on rebuilt makefiles bugs.
1999-09-03 22:46:28 +00:00
Paul Smith
10fee1c03c * A few W32 fixes for backslash support. 1999-09-02 00:31:21 +00:00
Paul Smith
82f0c5495a * A bugfix on MAKEFLAGS options creation that broke jobserver.
* Put the host info in the --version output.
* Don't croak if the user forces -jN on submakes.
1999-09-01 08:04:30 +00:00
Paul Smith
bf7cc546dd * Added config.guess/config.sub for new autoconf tests. 1999-09-01 03:58:04 +00:00
Paul Smith
27255c5b51 * Large file support for AIX, HP-UX, and IRIX.
* W32 support for Cygnus Cygwin shell (bash).
1999-08-31 17:02:31 +00:00
Paul Smith
b134da5505 * A few cleanups, and 3.77.94 release. 1999-08-25 21:39:28 +00:00
Paul Smith
d0b03e9355 * Terminology change in docs and code. 1999-08-24 04:49:39 +00:00
Paul Smith
5dc4b92b60 * Fix jobserver algorithm again.
* A couple of nits.
* Fix considered pruning for double-colon rules.
1999-08-23 22:15:17 +00:00
Paul Smith
b3fa4b3c7e * Start rewrite of jobserver to avoid unique tokens for debugging. 1999-08-23 05:35:14 +00:00
Paul Smith
6fa76a7d15 * Various changes. 1999-08-22 17:50:57 +00:00
Paul Smith
4ff6c62456 * Code cleanup. 1999-08-19 04:43:46 +00:00
Paul Smith
cbb9e38d10 * Rework jobserver yet one more time.
* Install the $(if ...) function and document it.  Still need some examples.
1999-08-13 07:36:26 +00:00
Paul Smith
9e79637ec3 * Some DOS fixes. 1999-08-12 23:16:42 +00:00
Paul Smith
e34540f79b * Release 3.77.92.
* Complete implementation of new jobserver algorithm.
* A few minor fixups.
1999-08-01 08:12:06 +00:00
Paul Smith
09f1e4cf83 * Applied some DOS updates.
* Started reworking the jobserver algorithm; not complete yet.
1999-08-01 06:05:17 +00:00
Paul Smith
28ef4c4dac * Add gettext macros to start i18n support. 1999-07-28 06:23:37 +00:00
Paul Smith
3a945a665e * Update the manual. 1999-07-26 05:06:58 +00:00
Paul Smith
6dbd348522 * Forgot ChangeLog. 1999-07-24 04:56:06 +00:00
Paul Smith
a9166bb7bc * Some configure fixes. 1999-07-24 04:55:08 +00:00
Paul Smith
4e7ee4fc01 * Bugfix for NT archive support.
* Rework how the jobserver stuff works.
1999-07-23 22:46:47 +00:00
121 changed files with 11107 additions and 1577 deletions

View File

@@ -11,9 +11,11 @@ makebook*
*.dep *.dvi *.toc *.aux *.log
*.cp *.cps *.fn *.fns *.vr *.vrs *.tp *.tps *.ky *.kys *.pg *.pgs
README aclocal.m4 config.h.in config.h configure Makefile.in
build.sh.in build.sh SMakefile config.ami README.DOS Makefile.DOS configh.dos
NMakefile config.h.W32 config.h-vms
README README.DOS README.W32
aclocal.m4 config.h.in config.h configure Makefile.in
build.sh.in build.sh
SMakefile NMakefile Makefile.DOS
config.ami configh.dos config.h.W32 config.h-vms
.deps .dep_segment
@@ -22,3 +24,5 @@ sun4 i386 i386-netbsd hp300-netbsd hp300 rs6000 sun3 news800 amiga
hp700 hp834 mips sol2 i486-linux
customs
install-sh mkinstalldirs

532
ChangeLog
View File

@@ -1,3 +1,492 @@
1999-09-23 Paul D. Smith <psmith@gnu.org>
* Version 3.78.1 released.
* make.texinfo: Update version/date stamp.
* main.c (main): Argh. For some reason we were closing _all_ the
jobserver pipes before we re-exec'd due to changed makefiles.
This means that any re-exec got a "jobserver unavailable" error :-/.
I can't believe we didn't notice this before.
1999-09-22 Paul D. Smith <psmith@gnu.org>
* Version 3.78 released.
* main.c (main): Only fail on multiple --jobserver-fds options if
they aren't all the same. Some makefiles use things like
$(MAKE) $(MFLAGS) which will cause multiple, identical copies of
--jobserver-fds to show up.
1999-09-16 Paul D. Smith <psmith@gnu.org>
* main.c (define_makeflags): Zero out FLAGSTRING to avoid
uninitialized memory reads when checking *p != '-' in the loop.
1999-09-15 Paul D. Smith <psmith@gnu.org>
* Version 3.77.97 released.
* configure.in (MAKE_HOST): AC_SUBST this so it will go into the
makefile.
* Makefile.am (check-local): Print a success banner if the check
succeeds.
(check-regression): A bit of fine-tuning.
1999-09-15 Eli Zaretskii <eliz@is.elta.co.il>
* README.DOS.template: Document requirements for the test suite.
* Makefile.DOS.template: Updates to allow the test suite to run
from "make check".
* main.c (main): Handle it if argv[0] isn't an absolute path.
1999-09-13 Paul D. Smith <psmith@gnu.org>
* Version 3.77.96 released.
* Makefile.am (loadavg): Use CPPFLAGS, etc. to make sure we get
all the right #defines to compile.
(check-regression): Look for the regression test suite in the make
package itself. If we're building remotely, use symlinks to make
a local copy.
(dist-hook): Put the test suite into the tar file.
* configure.in: Look for perl for the test suite.
1999-09-10 Paul Eggert <eggert@twinsun.com>
* acinclude.m4 (AC_SYS_LARGEFILE_FLAGS): If on HP-UX 10.20 or
later, and using GCC, define __STDC_EXT__; this works around a
bug in GCC 2.95.1.
1999-09-08 Paul D. Smith <psmith@gnu.org>
* main.c (print_version): Ugh. GLIBC's configure tries to check
make version strings and is too aggressive with their matching
expressions. I've struck a deal with them to leave the version
output as-is for 3.78, and they'll change their configure checks
so that I can change this back in the future.
1999-09-07 Eli Zaretskii <eliz@is.elta.co.il>
* job.c (construct_command_argv_internal) [__MSDOS__]: Add "echo"
and "unset" to the list of builtin shell commands.
* configh.DOS.template (MAKE_HOST): Define to "i386-pc-msdosdjgpp"
which is the canonical name of the DJGPP host.
1999-09-05 Paul D. Smith <psmith@gnu.org>
* Version 3.77.95 released.
* make.texinfo (Make Errors): Document some new jobserver error
messages.
1999-09-04 Eli Zaretskii <eliz@is.elta.co.il>
* make.texinfo (Make Errors): Document the hint about 8 spaces
instead of a TAB.
(Call Function, Quick Reference): Use @code{$(1)}, not @var.
* main.c (main) [__MSDOS__]: Say "on this platform" instead of "on
MS-DOS", since the MSDOS version could run on Windows.
1999-09-03 Paul D. Smith <psmith@gnu.org>
* remake.c (notice_finished_file): Always set mtime_before_update
if it's not been set, not just if we ran some rules. Otherwise we
may have a situation where a target's prerequisite was rebuilt but
not changed, so this target's rules weren't run, then
update_goal_chain() sees mtime_before_update != last_mtime and
thinks that the top-level target changed when it really didn't.
This can cause an infinite loop when remaking makefiles.
(update_goal_chain): If we get back to the top and we don't know
what the goal's last_mtime was, find it now. We need to know so
we can compare it to mtime_before_update later (this is only
crucial when remaking makefiles--should we only do it then?)
1999-09-02 Paul D. Smith <psmith@gnu.org>
* read.c (read_makefile): If "override" appears as the first
prerequisite, look further to ensure this is really a
target-specific variable definition, and not just some
prerequisite named "override".
1999-09-01 Paul D. Smith <psmith@gnu.org>
* function.c (IS_PATHSEP) [WINDOWS32]: Allow backslash separators
for W32 platforms.
* read.c (record_files) [WINDOWS32]: Allow backslash separators
for W32 platforms.
* implicit.c (pattern_search) [WINDOWS32]: Allow backslash
separators for W32 platforms.
* configure.in (MAKE_HOST): Define it to be the canonical build
host info, now that we need AC_CANONICAL_HOST anyway (for large
file support).
* version.c (make_host): Define a variable to MAKE_HOST so we're
sure to get it from the local config.h.
* main.c (print_version): Use it in the version information.
* config.ami.template: Add MAKE_HOST.
* configh.dos.template: Ditto.
* config.h.W32.template: Ditto.
* config.h-vms.template: Ditto.
* main.c (main): Close the jobserver file descriptors if we need
to re-exec ourselves.
Also print more reasonable error if users force -jN for submakes.
This may be common for a while until people use the jobserver
feature. If it happens, we ignore the existing jobserver stuff
and use whatever they specified on the commandline.
(define_makeflags): Fixed a long-standing bug: if a long name
only option comes immediately after a single letter option with no
argument, then the option string is constructed incorrectly. For
example, with -w and --jobserver-fds you get "-w-jobserver-fds..."
instead of "-w --jobserver-fds..."; add in an extra " -".
* make.texinfo (Phony Targets): Add another example of using
.PHONY with subdirectories/recursive make.
1999-08-30 Paul D. Smith <psmith@gnu.org>
* README.W32.template: Renamed from README.W32 so it's
autogenerated during the dist. A few minor modifications.
* configure.in: Check for kstat_open before AC_FUNC_GETLOADAVG
since the latter needs to know whether the former exists to give
an accurate result.
1999-08-26 Rob Tulloh <rob_tulloh@dev.tivoli.com>
* NMakefile [WINDOWS32]: Now more robust. If you change a file
under w32/subproc, the make.exe will be relinked. Also added some
tests to make sure erase commands won't fail when executed in a
pristine build environment.
* w32/subproc/sub_proc.c [WINDOWS32]: Added support for
HAVE_CYGWIN_SHELL. If you are using the Cygwin B20.1 release, it
is now possible to have have native support for this shell without
having to rely on klutzy BATCH_MODE_ONLY_SHELL.
* config.h.W32 [WINDOWS32]: Added HAVE_CYGWIN_SHELL macro which
users can define if they want to build make to use this shell.
* README.W32 [WINDOWS32]: Added informaton about
HAVE_CYGWIN_SHELL. Cleaned up text a bit to make it more current.
1999-08-26 Paul Eggert <eggert@twinsun.com>
Support large files in AIX, HP-UX, and IRIX.
* acinclude.m4 (AC_LFS): Remove. Superseded by AC_SYS_LARGEFILE.
(AC_SYS_LARGEFILE_FLAGS, AC_SYS_LARGEFILE_SPACE_APPEND,
AC_SYS_LARGEFILE_MACRO_VALUE, AC_SYS_LARGEFILE): New macros.
(jm_AC_TYPE_UINTMAX_T): Check for busted compilers that can't
shift or divide unsigned long long.
(AM_PROG_CC_STDC): New macro; a temporary workaround of a bug in
automake 1.4.
* configure.in (AC_CANONICAL_HOST): Add; required by new
AC_SYS_LARGEFILE.
(AC_SYS_LARGEFILE): Renamed from AC_LFS.
(AM_PROG_CC_STDC): Add.
* config.guess, config.sub: New files, needed for AC_CANONICAL_HOST.
1999-08-25 Paul Eggert <eggert@twinsun.com>
* make.h (CHAR_MAX): New macro.
* main.c (struct command_switch): c is now int,
so that it can store values greater than CHAR_MAX.
(switches): Replace small numbers N with CHAR_MAX+N-1,
to avoid problems with non-ASCII character sets.
(short_option): New macro.
(init_switches, print_usage, define_makeflags): Use it instead of
isalnum.
1999-08-25 Paul D. Smith <psmith@gnu.org>
* Version 3.77.94 released.
* main.c (main) [__MSDOS__]: If the user uses -j, warn that it's
not supported and reset it.
* make.h (ISDIGIT): Obtained this from the textutils distribution.
* main.c (decode_switches): Use it.
* function.c (is_numeric): Use it.
* main.c (struct command_switch): Store the switch char in an
unsigned char to shut up GCC about using it with ctype.h macros.
Besides, it _is_ always unsigned.
1999-08-24 Paul D. Smith <psmith@gnu.org>
* make.texinfo: Change "dependency" to "prerequisite" and
"dependencies" to "prerequisites". Various other cleanups related
to the terminology change.
* file.c: Change debugging and error messages to use
"prerequisite" instead of "dependency".
* implicit.c: Ditto.
* remake.c: Ditto.
* NEWS: Document it.
1999-08-23 Paul D. Smith <psmith@gnu.org>
* remake.c (update_file): Move the considered check into the
double-colon rule loop, so we consider double-colon rules
individually (otherwise after the first is pruned, the rest won't
get run).
* README.template: Minor changes.
Remove the debugging features of the jobserver, so it no longer
writes distinct tokens to the pipe. Thus, we don't need to store
the token we get. A side effect of this is to remove a potential
"unavailable token" situation: make-1 invokes make-2 with its
special token and make-3 with a normal token; make-2 completes.
Now we're waiting for make-3 but using 2 tokens; our special token
is idle. In the new version we don't have special tokens per se,
we merely decide if we already have a child or not. If we don't,
we don't need a token. If we do, we have to get one to run the
next child. Similar for putting tokens back: if we're cleaning up
the last child, we don't put a token back. Otherwise, we do.
* main.c: Add a new, internal flag --jobserver-fds instead of
overloading the meaning of -j. Remove job_slots_str and add the
stringlist jobserver_fds.
(struct command_switch): We don't need the int_string type.
(switches[]): Add a new option for --jobserver-fds and remove
conditions around -j. Make the description for the former 0 so it
doesn't print during "make --help".
(main): Rework jobserver parsing. If we got --jobserver-fds
make sure it's valid. We only get one and job_slots must be 0.
If we're the toplevel make (-jN without --jobserver-fds) create
the pipe and write generic tokens.
Create the stringlist struct for the submakes.
Clean up the stringlist where necessary.
(init_switches): Remove int_string handling.
(print_usage): Don't print internal flags (description ptr is 0).
(decode_switches): Remove int_string handling.
(define_makeflags): Remove int_string handling.
* job.c: Remove my_job_token flag and all references to the
child->job_token field.
(free_job_token): Remove this and merge it into free_child().
(reap_children): Rework the "reaped a child" logic slightly.
Don't call defunct free_job_token anymore. Always call
free_child, even if we're dying.
(free_child): If we're not freeing the only child, put a token
back in the pipe. Then, if we're dying, don't bother to free.
(new_job): If we are using the jobserver, loop checking to see if
a) there are no children or b) we get a token from the pipe.
* job.h (struct child): Remove the job_token field.
1999-08-20 Paul D. Smith <psmith@gnu.org>
* variable.c (try_variable_definition): Allocate for variable
expansion in f_append with a simple variable: if we're looking at
target-specific variables we don't want to trash the buffer.
Noticed by Reiner Beninga <Reiner.Beninga@mchp.siemens.de>.
1999-08-16 Eli Zaretskii <eliz@is.elta.co.il>
* main.c (main) [__MSDOS__]: Mirror any backslashes in argv[0], to
avoid problems in shell commands that use backslashes as escape
characters.
1999-08-16 Paul D. Smith <psmith@gnu.org>
* Version 3.77.93 released.
1999-08-13 Paul D. Smith <psmith@gnu.org
* function.c (func_if): New function $(if ...) based on the
original by Han-Wen but reworked quite a bit.
(function_table): Add it.
* NEWS: Introduce it.
* make.texinfo (If Function): Document it.
* job.c (free_job_token): Check for EINTR when writing tokens to
the jobserver pipe.
1999-08-12 Paul D. Smith <psmith@gnu.org>
Another jobserver algorithm change. We conveniently forgot that
the blocking bit is shared by all users of the pipe, it's not a
per-process setting. Since we have many make processes all
sharing the pipe we can't use the blocking bit as a signal handler
flag. Instead, we'll dup the pipe's read FD and have the SIGCHLD
handler close the dup'd FD. This will cause the read() to fail
with EBADF the next time we invoke it, so we know we need to reap
children. We then re-dup and reap.
* main.c (main): Define the job_rfd variable to hold the dup'd FD.
Actually dup the read side of the pipe. Don't bother setting the
blocking bit on the file descriptor.
* make.h: Declare the job_rfd variable.
* job.c (child_handler): If the dup'd jobserver pipe is open,
close it and assign -1 to job_rfd to notify the main program that
we got a SIGCHLD.
(start_job_command): Close the dup'd FD before exec'ing children.
Since we open and close this thing so often it doesn't seem
worth it to use the close-on-exec bit.
(new_job): Remove code for testing/setting the blocking bit.
Instead of EAGAIN, test for EBADF. If the dup'd FD has been
closed, re-dup it before we reap children.
* function.c (func_shell): Be a little more accurate about the
length of the error string to allocate.
* expand.c (variable_expand_for_file): If there's no filenm info
(say, from a builtin command) then reset reading_file to 0.
1999-08-09 Paul D. Smith <psmith@gnu.org>
* maintMakefile: Use g in sed (s///g) to replace >1 variable per
line.
* Makefile.DOS.template [__MSDOS__]: Fix mostlyclean-aminfo to
remove the right files.
1999-08-01 Eli Zaretskii <eliz@is.elta.co.il>
* function.c (msdos_openpipe) [__MSDOS__]: *Really* return a FILE
ptr.
1999-08-01 Paul D. Smith <psmith@gnu.org>
New jobserver algorithm to avoid a possible hole where we could
miss SIGCHLDs and get into a deadlock. The original algorithm was
suggested by Roland McGrath with a nice refinement by Paul Eggert.
Many thanks as well to Tim Magill and Howard Chu, who also
provided many viable ideas and critiques. We all had a fun week
dreaming up interesting ways to use and abuse UNIX syscalls :).
Previously we could miss a SIGCHLD if it happened after we reaped
the children but before we re-entered the blocking read. If this
happened to all makes and/or all children, make would never wake
up.
We avoid this by having the SIGCHLD handler reset the blocking bit
on the jobserver pipe read FD (normally read does block in this
algorithm). Now if the handler is called between the time we reap
and the time we read(), and there are no tokens available, the
read will merely return with EAGAIN instead of blocking.
* main.c (main): Set the blocking bit explicitly here.
* job.c (child_handler): If we have a jobserver pipe, set the
non-blocking bit for it.
(start_waiting_job): Move the token stuff back to new_job; if we
do it here then we're not controlling the number of remote jobs
started!
(new_job): Move the check for job slots to _after_ we've created a
child structure. If the read returns without getting a token, set
the blocking bit then try to reap_children.
* make.h (EINTR_SET): Define to test errno if EINTR is available,
or 0 otherwise. Just some code cleanup.
* arscan.c (ar_member_touch): Use it.
* function.c (func_shell): Use it.
* job.c (reap_children): Use it.
* remake.c (touch_file): Use it.
1999-07-28 Paul D. Smith <psmith@gnu.org>
* make.h: Define _() and N_() macros as passthrough to initiate
NLS support.
* <all>: Add _()/N_() around translatable strings.
1999-07-27 Paul D. Smith <psmith@gnu.org>
* read.c: Make sure make.h comes before other headers.
1999-07-26 Paul D. Smith <psmith@gnu.org>
* make.texinfo (Quick Reference): Update with the new features.
1999-07-25 Eli Zaretskii <eliz@is.elta.co.il>
* remake.c [__MSDOS__]: Don't include variables.h, it's already
included.
* function.c (msdos_openpipe) [__MSDOS__]: Return FILE ptr.
(func_shell) [__MSDOS__]: Fix the argument list.
* Makefile.DOS.template: Update from Makefile.in.
* README.DOS.template: Configure command fixed.
* configh.dos.template: Update to provide definitions for
uintmax_t, fd_set_size_t, and HAVE_SELECT.
1999-07-24 Paul D. Smith <psmith@gnu.org>
* Version 3.77.91 released.
* configure.in: Changes to the boostrapping code: if build.sh.in
doesn't exist configure spits an error and generates an empty
build.sh file which causes make to be confused.
* maintMakefile: Don't build README early.
1999-07-23 Paul D. Smith <psmith@gnu.org>
* job.c (my_job_token): This variable controls whether we've
handed our personal token to a subprocess or not. Note we could
probably infer this from the value of job_slots_used, but it's
clearer to just keep it separately. Job_slots_used isn't really
relevant when running the job server.
(free_job_token): New function: free a job token. If we don't
have one, no-op. If we have the personal token, reclaim it. If
we have another token, write it back to the pipe.
(reap_children): Call free_job_token.
(free_child): Call free_job_token.
(start_job_command): Remove duplicate test for '+' in the command.
If we don't appear to be running a recursive make, close the
jobserver filedescriptors.
(start_waiting_job): If our personal token is available, use that
instead of going to the server pipe.
(*): Add the token value to many debugging statements, and print
the child target name in addition to the ptr hex value.
Change the default "no token" value from '\0' to '-' so it looks
better in the output.
* main.c (main): Install the child_handler with sigaction()
instead of signal() if we have it. On SysV systems, signal() uses
SysV semantics which are a pain. But sigaction() always does what
we want.
(main): If we got job server FDs from the environment, test them
to see if they're open. If not, the parent make closed them
because it didn't think we were a submake. Print a warning and
suggestion to use "+" on the submake invocation, and hard-set to
-j1 for this instance of make.
(main): Change the algorithm for assigning slots to be more
robust. Previously make checked to see if it thought a subprocess
was a submake and if so, didn't give it a token. Since make's
don't consume tokens we could spawn many of makes fighting for a
small number of tokens. Plus this is unreliable because submakes
might not be recognized by the parent (see above) then all the
tokens could be used up by unrecognized makes, and no one could
run. Now every make consumes a token from its parent. However,
the make can also use this token to spawn a child. If the make
wants more than one, it goes to the jobserver pipe. Thus there
will never be more than N makes running for -jN, and N*2 processes
(N makes and their N children). Every make can always run at
least one job, and we'll never deadlock. (Note the closing of the
pipe for non-submakes also solves this, but this is still a better
algorithm.) So! Only put N-1 tokens into the pipe, since the
topmost make keeps one for itself.
* configure.in: Find sigaction. Disable job server support unless
the system provides it, in addition to either waitpid() or
wait3().
1999-07-22 Rob Tulloh <rob_tulloh@dev.tivoli.com>
* arscan.c (ar_member_touch) [WINDOWS32]: The ar_date field is a
string on Windows, not a timestamp.
1999-07-21 Paul D. Smith <psmith@gnu.org>
* Version 3.77.90 released.
@@ -111,21 +600,24 @@
already have one; if we're waiting on the load to go down
start_waiting_job() might get called twice on the same file.
* remake.c (update_goal_chain): If we try to update a goal and it
doesn't complete (e.g., parallel builds) remember that by setting
the `deferred' flag in the goal structure. Later when we're
determining the return value we consider a goal updated if either
the mtime has changed _or_ this flag was set. We need this
because the mtime doesn't change during the update_file() function
if we started a job running; instead it's set during the
reap_children() call. So, the code doesn't know it was updated
and returns a status of -1 (nothing done). This is OK during
"normal" builds since our caller (main) treats these cases
identically in that case, but if you're building makefiles the
difference is very important (whether we re-exec or not).
* dep.h: Add a `deferred' flag to track whether a goal was run but
not completed (parallel builds).
* filedef.h (struct file): Add new field, mtime_before_update.
When notice_finished_file runs it assigns the cached last_mtime to
this field.
* remake.c (update_goal_chain): Notice that a file wasn't updated
by asking if it changed (g->changed) and comparing the current
cached time (last_mtime) with the previous one, stored in
mtime_before_update. The previous check ("did last_mtime changed
during the run of update_file?") fails for parallel builds because
last_mtime is set during reap_children, before update_file is run.
This causes update_goal_chain to always return -1 (nothing
rebuilt) when running parallel (-jN). This is OK during "normal"
builds since our caller (main) treats these cases identically in
that case, but if when rebuilding makefiles the difference is very
important, as it controls whether we re-exec or not.
* file.c (file_hash_enter): Copy the mtime_before_update field.
(snap_deps): Initialize mtime_before_update to -1.
* main.c (main): Initialize mtime_before_update on old (-o) and
new (-W) files.
1999-07-08 Paul D. Smith <psmith@gnu.org>
@@ -283,9 +775,9 @@
a bit saying whether we've seen this target in this pass or not.
(update_goal_chain): Initially set the global considered toggle to
1, since all targets initialize their boolean to 0. At the end of
each pass, toggle the global considered variable. * filedef.h
(struct file): Per-file considered toggle bit. * file.c: New
global toggle variable considered.
each pass, toggle the global considered variable.
* filedef.h (struct file): Per-file considered toggle bit.
* file.c: New global toggle variable considered.
1999-04-05 Paul D. Smith <psmith@gnu.org>
@@ -438,7 +930,7 @@
* arscan.c: Modified to support AIX 4.3 big archives. The changes
are based on information provided by Phil Adams
<padams@austin.ibm.com>; thanks!
<padams@austin.ibm.com>.
1999-02-19 Paul D. Smith <psmith@gnu.org>
@@ -619,7 +1111,7 @@
* configure.in (AC_FUNC_VPRINTF): Check for vprintf()/_doprnt().
* misc.c(message, error, fatal): Add preprocessor stuff to enable
* misc.c (message, error, fatal): Add preprocessor stuff to enable
creation of variable-argument functions with appropriate
prototypes, that works with ANSI, pre-ANSI, varargs.h, stdarg.h,
v*printf(), _doprnt(), or none of the above. Culled from GNU

View File

@@ -1,7 +1,7 @@
# -*-Makefile-*- template for DJGPP
# Makefile.in generated automatically by automake 1.2 from Makefile.am
# Copyright (C) 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
# Copyright (C) 1994, 1995-1998, 1999 Free Software Foundation, Inc.
# This Makefile.DOS is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
@@ -53,6 +53,7 @@ CPP = gcc -E
LIBOBJS =
MAKEINFO = ${bindir}/makeinfo
PACKAGE = make
PERL = perl
RANLIB = ranlib
REMOTE = stub
VERSION = %VERSION%
@@ -81,6 +82,8 @@ CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = build.sh
PROGRAMS = $(bin_PROGRAMS)
MAKE_HOST = i386-pc-msdosdjgpp
DEFS = -I. -I$(srcdir) -I.
CPPFLAGS = -DHAVE_CONFIG_H
@@ -118,7 +121,11 @@ HEADERS = $(wildcard $(srcdir)/*.h)
default: all
.SUFFIXES:
.SUFFIXES: .c .dvi .info .o .ps .texi .texinfo
.SUFFIXES: .S .c .dvi .info .o .ps .s .texi .texinfo .txi
mostlyclean-hdr:
clean-hdr:
distclean-hdr:
-rm -f config.h
@@ -141,11 +148,17 @@ install-binPROGRAMS: $(bin_PROGRAMS)
uninstall-binPROGRAMS:
$(NORMAL_UNINSTALL)
list='$(bin_PROGRAMS)'; for p in $$list; do rm -f $(bindir)/`echo $$p|sed '$(transform)'`; done
list='$(bin_PROGRAMS)'; for p in $$list; do rm -f $(bindir)/`echo $$p|sed '$(transform)'`.exe; done
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
@@ -155,7 +168,7 @@ mostlyclean-compile:
clean-compile:
distclean-compile:
-rm -f *.tab.c
-rm -f *.tab.c *_tab.c
maintainer-clean-compile:
@@ -188,6 +201,12 @@ DVIPS = dvips
.texinfo.dvi:
TEXINPUTS="$(srcdir);$$TEXINPUTS" MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
.txi.info:
$(MAKEINFO) $(srcdir)/$< -o ./$@
.txi.dvi:
TEXINPUTS="$(srcdir);$$TEXINPUTS" MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
.dvi.ps:
$(DVIPS) $< -o $@
@@ -208,7 +227,9 @@ dist-info: $(INFO_DEPS)
for base in $(INFO_DEPS); do d=$(srcdir); for file in `cd $$d && eval echo $$base*`; do test -f $(distdir)/$$file || ln $$d/$$file $(distdir)/$$file 2> /dev/null || cp -p $$d/$$file $(distdir)/$$file; done; done
mostlyclean-aminfo:
rm -f make.aux make.cp make.cps make.dvi make.fn make.fns make.ky make.kys make.ps make.log make.pg make.toc make.tp make.tps make.vr make.vrs make.op make.tr make.cv make.cn
-rm -f make.aux make.cp make.cps make.dvi make.fn make.fns make.ky \
make.kys make.ps make.log make.pg make.toc make.tp make.tps \
make.vr make.vrs make.op make.tr make.cv make.cn
clean-aminfo:
@@ -277,7 +298,8 @@ libglob.a: $(libglob_a_OBJECTS)
$(AR) cru libglob.a $(libglob_a_OBJECTS) $(libglob_a_LIBADD)
$(RANLIB) libglob.a
mostlyclean-recursive clean-recursive distclean-recursive maintainer-clean-recursive:
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive check-recursive:
ifeq ($(words $(SUBDIRS)), 1)
@echo Making $(shell echo $@ | sed s/-recursive//) in $(SUBDIRS)
$(MAKE) -C $(SUBDIRS) -f ../Makefile $(shell echo $@ | sed s/-recursive//)-am
@@ -346,8 +368,8 @@ distdir: $(DISTFILES)
info: $(INFO_DEPS) info-recursive
dvi: $(DVIS) dvi-recursive
check: all-am
$(MAKE) check-recursive check-local
check: all-am check-recursive check-local
@:
installcheck: installcheck-recursive
all-recursive-am: config.h
$(MAKE) all-recursive
@@ -421,7 +443,7 @@ maintainer-clean-compile install-info-am uninstall-info \
mostlyclean-aminfo distclean-aminfo clean-aminfo \
maintainer-clean-aminfo install-data-recursive uninstall-data-recursive \
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
uninstalldirs-recursive all-recursive check-recursive \
uninstalldirs-recursive all-recursive check-recursive check-am \
installcheck-recursive info-recursive dvi-recursive \
mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
@@ -446,8 +468,27 @@ dist-hook:
# --------------- Local CHECK Section
check-local: check-loadavg check-regression
.PHONY: check-loadavg check-regression
# Note: check-loadavg is NOT a prerequisite of check-local, since
# there's no uptime utility, and the test it does doesn't make sense
# on MSDOS anyway.
check-local: check-shell check-regression
@banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"; \
echo
.PHONY: check-loadavg check-shell check-regression
# > check-shell
#
# check-shell is designed to fail if they don't have a Unixy shell
# installed. The test suite requires such a shell.
check-shell:
@echo If Make says Error -1, you do not have Unix-style shell installed
@foo=bar.exe :
# > check-loadavg
#
@@ -472,23 +513,22 @@ check-loadavg: loadavg
# parents.
#
check-regression:
here=`pwd`; testdir=""; \
case "$(MAKE_TEST)" in "") \
for d1 in $$here $(srcdir); do \
for d2 in ../.. .. .; do \
all=`echo $$d1/$$d2/make-test-[0-9]*/run_make_tests`; \
case "$$all" in \
"$$d1/$$d2/make-test-[0-9]*/run_make_tests") : ;; \
*) try=`for x in $$all; do echo $$x; done | sort | tail -1`;\
testdir=`dirname $$try` ;; esac; \
done; done ;; \
*) testdir="$(MAKE_TEST)" ;; \
esac; \
case "$$testdir" in \
"") echo "Couldn't find make-test-* test suite."; exit 0;; \
esac; \
echo "cd $$testdir && ./run_make_tests -make_path $$here/make"; \
cd $$testdir && ./run_make_tests -make_path $$here/make
@if test -f "$(srcdir)/tests/run_make_tests"; then \
if $(PERL) -v >/dev/null 2>&1; then \
case `cd $(srcdir); pwd` in `pwd`) : ;; \
*) test -d tests || mkdir tests; \
for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \
rm -rf tests/$$f; cp -pr $(srcdir)/tests/$$f tests; \
done ;; \
esac; \
echo "cd tests && $(PERL) ./run_make_tests.pl -make ../make.exe $(MAKETESTFLAGS)"; \
cd tests && $(PERL) ./run_make_tests.pl -make ../make.exe $(MAKETESTFLAGS); \
else \
echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
fi; \
else \
echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \
fi
# --------------- Maintainer's Section

View File

@@ -30,6 +30,8 @@ SUBDIRS = glob
MOSTLYCLEANFILES = loadavg.c
CLEANFILES = loadavg
MAKE_HOST = @MAKE_HOST@
# --------------- Local INSTALL Section
@@ -62,25 +64,33 @@ install-exec-local:
# --------------- Local DIST Section
# Install the w32 subdirectory
# Install the w32 and tests subdirectories
#
dist-hook:
(cd $(srcdir); \
w32=`find w32 -follow \( -name CVS -prune \) -o \( -name \*.orig -o -name \*.rej -o -name \*~ -prune \) -o -type f -print`; \
tar chf - $$w32) \
sub=`find w32 tests -follow \( -name CVS -prune -o -name work -prune \) -o \( -name \*.orig -o -name \*.rej -o -name \*~ -prune \) -o -type f -print`; \
tar chf - $$sub) \
| (cd $(distdir); tar xfBp -)
# --------------- Local CHECK Section
check-local: check-loadavg check-regression
check-local: check-regression check-loadavg
@banner=" Regression PASSED: GNU Make $(VERSION) ($(MAKE_HOST)) built with $(CC) "; \
dashes=`echo "$$banner" | sed s/./=/g`; \
echo; \
echo "$$dashes"; \
echo "$$banner"; \
echo "$$dashes"; \
echo
.PHONY: check-loadavg check-regression
# > check-loadavg
#
loadavg: loadavg.c config.h
@rm -f loadavg
$(LINK) -I. -I$(srcdir) -DHAVE_CONFIG_H -DTEST $(make_LDFLAGS) loadavg.c $(LIBS)
$(LINK) $(DEFS) $(CPPFLAGS) -DTEST $(make_LDFLAGS) loadavg.c $(LIBS)
# We copy getloadavg.c into a different file rather than compiling it
# directly because some compilers clobber getloadavg.o in the process.
@@ -97,30 +107,31 @@ check-loadavg: loadavg
# > check-regression
#
# Look for the make test suite, and run it if found. Look in MAKE_TEST if
# specified, or else in the srcdir or the distdir, their parents, and _their_
# parents.
# Look for the make test suite, and run it if found and we can find perl.
# If we're building outside the tree, we use symlinks to make a local copy of
# the test suite. Unfortunately the test suite itself isn't localizable yet.
#
MAKETESTFLAGS =
check-regression: all
@here=`pwd`; testdir=""; \
case "$(MAKE_TEST)" in "") \
for d1 in $$here $(srcdir); do \
for d2 in ../.. .. .; do \
all=`echo $$d1/$$d2/make-test-[0-9]*/run_make_tests`; \
case "$$all" in \
"$$d1/$$d2/make-test-[0-9]*/run_make_tests") : ;; \
*) try=`for x in $$all; do echo $$x; done | sort | tail -1`;\
testdir=`dirname $$try` ;; esac; \
done; done ;; \
*) testdir="$(MAKE_TEST)" ;; \
esac; \
case "$$testdir" in \
"") echo "Couldn't find make-test-* regression test suite."; exit 0;; \
esac; \
echo "cd $$testdir && ./run_make_tests -make $$here/make $(MAKETESTFLAGS)"; \
cd $$testdir && ./run_make_tests -make $$here/make $(MAKETESTFLAGS)
check-regression:
@if test -f "$(srcdir)/tests/run_make_tests"; then \
if $(PERL) -v >/dev/null 2>&1; then \
case `cd $(srcdir); pwd` in `pwd`) : ;; \
*) test -d tests || mkdir tests; \
rm -f srctests; \
if ln -s "$(srcdir)/tests" srctests; then \
for f in run_make_tests run_make_tests.pl test_driver.pl scripts; do \
rm -f tests/$$f; ln -s ../srctests/$$f tests; \
done; fi ;; \
esac; \
echo "cd tests && $(PERL) ./run_make_tests.pl -make ../make $(MAKETESTFLAGS)"; \
cd tests && $(PERL) ./run_make_tests.pl -make ../make $(MAKETESTFLAGS); \
else \
echo "Can't find a working Perl ($(PERL)); the test suite requires Perl."; \
fi; \
else \
echo "Can't find the GNU Make test suite ($(srcdir)/tests)."; \
fi
# --------------- Local CLEAN section

33
NEWS
View File

@@ -1,6 +1,6 @@
GNU make NEWS -*-indented-text-*-
History of user-visible changes.
21 Jul 1999
17 Sep 1999
Copyright (C) 1992,93,94,95,96,97,98,1999 Free Software Foundation, Inc.
See the end for copying conditions.
@@ -9,20 +9,26 @@ All changes mentioned here are more fully described in the GNU make
manual, which is contained in this distribution as the file make.texinfo.
Please send GNU make bug reports to bug-make@gnu.org.
See the README file and the GNU make manual for details on sending bug
reports.
Version 3.78
* Two new functions, $(error ...) and $(warning ...) are provided. The
* Two new functions, $(error ...) and $(warning ...) are available. The
former will cause make to fail and exit immediately upon expansion of
the function, with the text provided as the error message. The latter
causes the text provided to be printed as a warning message, but make
proceeds normally.
* A new function, $(call ...) is provided. This allows users to create
* A new function $(call ...) is available. This allows users to create
their own parameterized macros and invoke them later. Original
implementation of this feature was provided by Han-Wen Nienhuys
implementation of this function was provided by Han-Wen Nienhuys
<hanwen@cs.uu.nl>.
* A new function $(if ...) is available. It provides if-then-else
capabilities in a builtin function. Original implementation of this
function was provided by Han-Wen Nienhuys <hanwen@cs.uu.nl>.
* Make defines a new variable, .LIBPATTERNS. This variable controls how
library dependency expansion (dependencies like ``-lfoo'') is performed.
@@ -42,6 +48,25 @@ Version 3.78
each other to ensure that no more than N jobs are started across all
makes. To get the old behavior of -j back, you can configure make
with the --disable-job-server option.
* The confusing term "dependency" has been replaced by the more accurate
and standard term "prerequisite", both in the manual and in all GNU make
output.
* GNU make supports the "big archive" library format introduced in AIX 4.3.
* GNU make supports large files on AIX, HP-UX, and IRIX. These changes
were provided by Paul Eggert <eggert@twinsun.com>. (Large file
support for Solaris and Linux was introduced in 3.77, but the
configuration had issues: these have also been resolved).
* The Windows 95/98/NT (W32) version of GNU make now has native support
for the Cygnus Cygwin release B20.1 shell (bash).
* The GNU make regression test suite, long available separately "under
the table", has been integrated into the release. You can invoke it
by running "make check" in the distribution. Note that it requires
Perl (either Perl 4 or Perl 5) to run.
Version 3.77

View File

@@ -50,8 +50,10 @@ all: config.h subproc Release Debug
#
subproc: w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib
w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib:
w32/subproc/WinDebug/subproc.lib w32/subproc/WinRel/subproc.lib: w32/subproc/misc.c w32/subproc/sub_proc.c w32/subproc/w32err.c
subproc.bat $(SUBPROC_MAKEFILE) $(MAKE)
if exist WinDebug\make.exe erase WinDebug\make.exe
if exist WinRel\make.exe erase WinRel\make.exe
config.h: config.h.W32
copy $? $@
@@ -62,9 +64,11 @@ Debug:
$(MAKE) /f $(MAKEFILE) LDFLAGS="$(LDFLAGS_debug)" CFLAGS="$(CFLAGS_debug)" OUTDIR=WinDebug WinDebug/make.exe
clean:
rmdir /s /q WinDebug WinRel
rmdir /s /q w32\subproc\WinDebug w32\subproc\WinRel
erase config.h
if exist WinDebug\nul rmdir /s /q WinDebug
if exist WinRel\nul rmdir /s /q WinRel
if exist w32\subproc\WinDebug\nul rmdir /s /q w32\subproc\WinDebug
if exist w32\subproc\WinRel\nul rmdir /s /q w32\subproc\WinRel
if exist config.h erase config.h
erase *.pdb
$(OUTDIR):

View File

@@ -5,7 +5,7 @@ Builds with DJGPP v2 port of GNU C/C++ compiler and utilities.
New (since 3.74) DOS-specific features:
1. Supports long filenames when run from DOS box on Windows 95.
1. Supports long filenames when run from DOS box on Windows 9x.
2. Supports both stock DOS COMMAND.COM and Unix-style shells
(details in ``Notes'' below).
@@ -30,6 +30,9 @@ New (since 3.74) DOS-specific features:
targets like "install:" and "clean:" still need additional
programs, though, see below.)
10. Beginning with v3.78, the test suite works in the DJGPP
environment (requires Perl and auxiliary tools; see below).
To build:
@@ -48,9 +51,10 @@ To build:
[Enter]. Otherwise, you need to supply the path to the source
directory as an argument to the batch file, like this:
configure.bat c:/djgpp/gnu/make-%VERSION%
c:\djgpp\gnu\make-%VERSION%\configure.bat c:/djgpp/gnu/make-%VERSION%
Note the forward slashes: you MUST use them here.
Note the forward slashes in the source path argument: you MUST
use them here.
3. If configure.bat doesn't find a working Make, it will suggest to
use the `dosbuild.bat' batch file to build Make. Either do as it
@@ -99,6 +103,9 @@ To build:
7. The `clean' targets also require Unix-style shell, and GNU Sed
and `rm' programs (the latter from Fileutils).
8. To run the test suite, type "make check". This requires a Unix
shell (I used the DJGPP port of Bash 2.03), Perl, Sed, Fileutils
and Sh-utils.
Notes:
@@ -228,9 +235,9 @@ Notes:
4. Letter-case in filenames.
If you run Make on Windows 95, you should be aware of the
If you run Make on Windows 9x, you should be aware of the
letter-case issue. Make is internally case-sensitive, but all
file operations are case-insensitive on Windows 95, so
file operations are case-insensitive on Windows 9x, so
e.g. files `FAQ', `faq' and `Faq' all refer to the same file, as
far as Windows is concerned. The underlying DJGPP C library
functions honor the letter-case of the filenames they get from
@@ -240,8 +247,8 @@ Notes:
converted to lower case are explained in the DJGPP libc docs,
under the `_preserve_fncase' and `_lfn_gen_short_fname'
functions, but as a thumb rule, any filename that is stored in
upper case in the directory, is a legal DOS 8+3 filename and
doesn't include characters illegal on MSDOS FAT filesystems,
upper case in the directory, is a valid DOS 8+3 filename and
doesn't include characters invalid on MSDOS FAT filesystems,
will be automatically down-cased.) User reports that I have
indicate that this default behavior is generally what you'd
expect; however, your input is most welcome.

View File

@@ -1,7 +1,11 @@
Port of GNU make to Windows NT and Windows 95
Builds natively with MSVC 2.x or MSVC 4.x compilers.
Should also build fine with MSVC 5.x and 6.x (though not confirmed).
To build with nmake on Windows NT or Windows 95:
This Windows 32-bit port of GNU make is maintained primarily by Rob
Tulloh, who is also the author of this README.
To build with nmake on Windows NT, Windows 95, or Windows 98:
1. Make sure cl.exe is in your %Path%. Example:
@@ -18,6 +22,15 @@ To build with nmake on Windows NT or Windows 95:
4. nmake /f NMakefile
A short cut to steps 1, 2, and 3 is to run VCVARS32.bat before
invoking namke. For example:
c:
cd \msdev\bin
VCVARS32.bat
cd \path\to\make-%VERSION%
nmake /f NMakefile
There is a bat file (build_w32.bat) for folks who have fear of nmake.
Outputs:
@@ -28,47 +41,58 @@ Outputs:
-- Notes/Caveats --
GNU make on Windows 32-bit platforms:
This version of make is ported natively to Windows32 platforms
(Windows NT 3.51, Windows NT 4.0, Windows 95, and Windows 98). It
does not rely on any 3rd party software or add-on packages for
building. The only thing needed is a version of Visual C++,
which is the predominant compiler used on Windows32 platforms.
Do not confuse this port of GNU make with other Windows32 projects
which provide a GNU make binary. These are separate projects
and are not connected to this port effort.
GNU make and sh.exe:
This port prefers you have a working sh.exe somewhere on your
system. If you don't have sh.exe, port falls back to
system. If you don't have sh.exe, the port falls back to
MSDOS mode for launching programs (via a batch file).
The MSDOS mode style execution has not been tested too
carefully though (I use GNU bash as sh.exe).
The MSDOS mode style execution has not been tested that
carefully though (The author uses GNU bash as sh.exe).
There are very few true ports of Bourne shell for NT right now.
There is a version of GNU bash available from Cygnus gnu-win32
porting effort. Other possibilities are to get the MKS version
of sh.exe or to build your own with a package like
NutCracker (DataFocus) or Portage (Consensys).
There is a version of GNU bash available from Cygnus "Cygwin"
porting effort (http://sourceware.cygnus.com/cygwin).
Other possibilities are the MKS version of sh.exe, or building
your own with a package like NutCracker (DataFocus) or Portage
(Consensys).
Tivoli uses a homegrown port of GNU bash which is not (yet)
freely available. It may be available someday, but I am not in control
of this decision nor do I influence it. Sorry!
GNU make and brain-dead shells (BATCH_MODE_ONLY_SHELL):
GNU make and Cygnus GNU WIN32 tools (BATCH_MODE_ONLY_SHELL)
GNU make now has support for the Cygnus GNU WIN32 toolset. The
GNU WIN32 version of Bourne shell does not behave well when
invoked as 'sh -c' from CreateProcess(). The main problem is it
seems to have a hard time handling quoted strings correctly. This
problem goes away when invoking the Cygnus shell on a shell script.
Some versions of Bourne shell does not behave well when invoked
as 'sh -c' from CreateProcess(). The main problem is they seem
to have a hard time handling quoted strings correctly. This can
be circumvented by writing commands to be executed to a batch
file and then executing the command by calling 'sh file'.
To work around this difficulty, this version of make supports
a new batch mode. When BATCH_MODE_ONLY_SHELL is defined at compile
a batch mode. When BATCH_MODE_ONLY_SHELL is defined at compile
time, make forces all command lines to be executed via script
files instead of by command line.
A native WIN32 system with no Bourne shell will also run
A native Windows32 system with no Bourne shell will also run
in batch mode. All command lines will be put into batch files
and executed via $(COMSPEC) (%COMSPEC%).
If you wish to use Cygnus' GNUWIN32 shell, be sure you define
BATCH_MODE_ONLY_SHELL in the config.h.W32 prior to building make.
The new feataure was tested with the b18 version of the Cygnus
user tools.
GNU make and Cygnus GNU Windows32 tools:
GNU make and MKS shell
Good news! Make now has native support for Cygwin sh. To enable,
define the HAVE_CYGWIN_SHELL in config.h and rebuild make
from scratch. This version of make tested with B20.1 of Cygwin.
Do not define BATCH_MODE_ONLY_SHELL if you use HAVE_CYGWIN_SHELL.
GNU make and the MKS shell:
There is now semi-official support for the MKS shell. To turn this
support on, define HAVE_MKS_SHELL in the config.h.W32 before you
@@ -101,9 +125,6 @@ GNU make handling of drive letters in pathnames (PATH, vpath, VPATH):
/some/path/x:/some/path/y
x:/some/path/x:x:/some/path/y
These caveats affect Windows systems only (Windows NT and
Windows 95) and can be ignored for other platforms.
Please note that you are free to mix colon and semi-colon in the
specification of paths. Make is able to figure out the intended
result and convert the paths internally to the format needed
@@ -118,25 +139,27 @@ GNU make handling of drive letters in pathnames (PATH, vpath, VPATH):
GNU make test suite:
I verified all functionality with a slightly modified version
of make-test-0.4.5 (modifications to get test suite to run
of make-test-%VERSION% (modifications to get test suite to run
on Windows NT). All tests pass in an environment that includes
sh.exe. Tested on both Windows NT and Windows 95.
sh.exe. Tests were performed on both Windows NT and Windows 95.
Building GNU make on Windows NT and Windows 95 with Microsoft Visual C
Building GNU make on Windows NT and Windows 95/98 with Microsoft Visual C:
I did not provide a Visual C project file with this port as
the project file would not be considered freely distributable
(or so I think). It is easy enough to create one though if
(or so I think). It is easy enough to create one, though, if
you know how to use Visual C.
I build the program statically to avoid problems locating DLL's
on machines that may not have MSVC runtime installed. If you
prefer, you can change make to build with shared libraries by
changing /MT to /MD in the NMakefile (or build_w32.bat).
changing /MT to /MD in the NMakefile (or in build_w32.bat).
Program has not been built under non-Intel architectures (yet).
The program has not been built for non-Intel architectures (yet).
I have not tried to build with any other compilers than MSVC.
I have not tried to build with any other compilers than MSVC. I
have heard that this is possible though so don't be afraid to
notify me of your successes!
Pathnames and white space:
@@ -206,17 +229,13 @@ SAMBA/NTFS/VFAT:
under VFAT. VFAT users may wish to be aware that this port
of make does respect case sensitivity.
Version 3.76 contains some preliminary support for FAT. Make
now tries to work around some difficulties with stat'ing of
FAT:
Version 3.76 added support for FAT filesystems. Make
works around some difficulties with stat'ing of
files and caching of filenames and directories internally.
There is still a known problem with filenames sometimes being
found to have modification dates in the future which cause make
to complain about the file and exit (remake.c).
Bug reports:
Please submit bugs via the normal bug reporting mechanism
which is described in one of the Texinfo files. If you don't
have Texinfo for Windows NT or Windows 95, these files are simple
text files and can be read with a text editor.
Please submit bugs via the normal bug reporting mechanism which
is described in the GNU make manual and the base README.

View File

@@ -1,6 +1,10 @@
This directory contains the %VERSION% release of GNU Make.
All bugs reported for previous releases have been fixed.
Some bugs surely remain.
See the file NEWS for the user-visible changes from previous releases.
In addition, there have been bugs fixed.
Please check the system-specific notes below for any caveats related to
your operating system.
For general building and installation instructions, see the file INSTALL.
@@ -24,9 +28,11 @@ site. There is information there about ordering hardcopy documentation.
http://www.gnu.org/doc/doc.html
http://www.gnu.org/manual/manual.html
Please send GNU make bug reports to bug-make@gnu.org. Please see the
section of the manual entitles `Problems and Bugs' for information on
submitting bug reports.
You can also find the latest versions of GNU Make from there.
You can send GNU make bug reports to bug-make@gnu.org. Please see the
section of the GNU make manual entitled `Problems and Bugs' for
information on submitting useful and complete bug reports.
If you need help using GNU make, try these forums:
@@ -40,7 +46,7 @@ Also:
- See README.customs for details on integrating GNU make with the
Customs distributed build environment from the Pmake distribution.
- See README.W32 for details about GNU Make on Windows NT or 95.
- See README.W32 for details about GNU Make on Windows NT, 95, or 98.
- See README.Amiga for details about GNU Make on AmigaDOS.
@@ -51,6 +57,13 @@ Also:
of DJGPP; see the WWW page http://www.delorie.com/djgpp/ for more
information.
GNU Make is free software. See the file COPYING for copying conditions.
System-specific Notes
---------------------
It has been reported that the XLC 1.2 compiler on AIX 3.2 is buggy such
that if you compile make with `cc -O' on AIX 3.2, it will not work correctly.
It is said that using `cc' without `-O' does work.
@@ -61,9 +74,8 @@ debug this code, you can do `make check-loadavg' to see if it works
properly on your system. (You must run `configure' beforehand, but you
need not build Make itself to run this test.)
See the file NEWS for what has changed since previous releases.
GNU Make is fully documented in make.texinfo. See the section entitled
`Problems and Bugs' for information on submitting bug reports.
GNU Make is free software. See the file COPYING for copying conditions.
Another potential source of porting problems is the support for large
files (LFS) in configure for those operating systems that provide it.
Please report any bugs that you find in this area. If you run into
difficulties, then as a workaround you should be able to disable LFS by
adding the `--disable-largefile' option to the `configure' script.

View File

@@ -14,38 +14,106 @@ However, if you see something here you really, really want, speak up.
All other things being equal, I will tend to implement things that seem
to maximize user satisfaction.
Also, this list doesn't include things which I'm pretty sure would
require serious, fundamental change to GNU make; those things belong on
the mythical "Make 4.0" list. I admit, that line can be somewhat fuzzy :)
If you want to implement some of them yourself, barring the ones I've
marked below, have at it! Please contact me first to let me know you're
working on it, and give me some info about the design--and, critically,
information about any user-visible syntax change, etc.
* Per-target variable definitions (a la SunOS make's ":=" feature, but
note the syntax here will definitely be different!)
The Top Item
------------
* Multi-token pattern rule matching (allow %1/%2.c : %1/obj/%2.o, etc.)
If you know perl (or want to learn DejaGNU or similar), the number one
priority on my list of things I don't have time to do right now is
fixing up the GNU make test suite. Most importantly it needs to be made
"parallelizable", so more than one regression can run at the same time
(essentially, make the "work" directory local). Also, the CWD during
the test should be in the work directory; right now sometimes tests leak
files into the main directory which causes subsequent tests to fail
(some tests may need to be tweaked). Beyond that, any cleanup done to
make writing, reading, or handling tests simpler would be great! Please
feel free to make whatever changes you like to the current tests, given
some high-level goals, and that you'll port the current tests to
whatever you do :).
* More robust clock skew detection algorithm.
* Provide MAKETARGETS and MAKEVARIABLES variables, containing the
The Rest of the List
--------------------
1) Allow variables/functions to expand to other make rules which are
then interpreted, with newlines handled correctly. This is a
biggee, and is on my plate. I already have partially-working code.
2) Option to check more than timestamps to determine if targets have
changed. This is also a very big one. It's _close_ to my plate :),
and I have very definite ideas about how I want it done. Please
pick something else unless you must have this feature. If you try
it, please work _extremely_ closely with me on it.
2a) Possibly a special case of this is the .KEEP_STATE feature of Sun's
make. Some great folks at W U. in Canada did an implementation of
this for a class project. Their approach is reasonable and
workable, but doesn't really fit into my ideas for #2. Maybe
that's OK. I have paperwork for their work so if you want to do
this one talk to me to get what they've already done.
[K R Praveen <praveen@cair.res.in>]
3) Currently you can use "%.foo %.bar : %.baz" to mean that one
invocation of the rule builds both targets. GNU make needs a way to
do that for explicit rules, too. I heard a rumor that some versions
of make all you to say "a.foo + a.bar : a.baz" to do this (i.e., a
"+" means one invocation builds both). Don't know if this is the
best syntax or not... what if you say "a.foo + a.bar a.bam : a.baz";
what does that mean?
4) Multi-token pattern rule matching (allow %1/%2.c : %1/obj/%2.o,
etc., or something like that). I have an implementation of this
already, it just needs some refinement... maybe. Additionally I
think it only works for static pattern rules; it might need to be
fixed up to work with normal pattern rules, too.
5) More robust clock skew detection algorithm: less false hits. I have
some notes on this from various discussions.
6) Provide MAKETARGETS and MAKEVARIABLES variables, containing the
names of the targets and variables defined in the makefile.
* If the user asks for parallelization, rebuild any "include"'d files
in parallel as well (helps esp. when there are many .d files to be
built).
Actually, I now think a $(targets ...) function, at least, would be
better than a MAKETARGETS variable. The argument would be types of
targets to list: "phony" is the most useful one. I suppose
"default" might also be useful. Maybe some others; check the
bitfields to see what might be handy. This one is pretty easy.
* Allow variables/functions to expand to other make rules which are
then interpreted, with newlines handled correctly.
* More intelligent submake handling when doing parallel makes:
currently each submake gets a "-j 1" option. It would be good if
make was smart enough to give some/all its slots to the submake
(esp. if there is no other rule that can be run by the parent in
parallel, a common situation). Doing this perfectly might be too
hard, but something less than perfect is certainly possible.
* Option to check more than timestamps to determine if targets have
changed (MD5 checksumming?)
* Some sort of operating-system independent way of handling paths
7) Some sort of operating-system independent way of handling paths
would be outstanding, so makefiles can be written for UNIX, VMS,
DOS, MS-Windows, Amiga, etc. with a minimum of specialization.
Or, perhaps related/instead of, some sort of meta-quoting syntax so
make can deal with filenames containing spaces, colons, etc. I
dunno, maybe something like $[...]? This may well not be worth
doing until #1 is done.
9) Right now the .PRECIOUS, .INTERMEDIATE, and .SECONDARY
psuedo-targets have different capabilities. For example, .PRECIOUS
can take a "%", the others can't. Etc. These should all work the
same, insofar as that makes sense.
10) A syntax that specifies a build order _without_ implying a
dependency relationship. That is, a way to say "A must be built
before B" that doesn't force B to be built when A changes. This is
very important for parallel builds: sometimes you need some stuff
done first but you don't want to rebuild everything because of it.
11) Improved debugging/logging/etc. capabilities. This area is in
desparate need of work; the current -d, -s, etc. options are simply
insufficient. We need different levels of output: some that are
much less verbose. E.g., maybe just print one line about why make
decides to rebuild each target. Also, we could use something like
the -E option for preprocessors; this would print out makefiles
after resolving all includes, immediate variable reverences, etc.
Also, a way to turn on and off obeying the "@" token for scripts
that's independent of -n (so we could have them in effect for -n,
and have them not in effect without -n).
Maybe other things. Contact me about the user interface.

View File

@@ -85,50 +85,133 @@ changequote([,])dnl
])dnl
dnl ---------------------------------------------------------------------------
dnl Got this from the GNU fileutils 3.16r distribution
dnl Got this from the GNU tar 1.13.11 distribution
dnl by Paul Eggert <eggert@twinsun.com>
dnl ---------------------------------------------------------------------------
dnl The problem is that the default compilation flags in Solaris 2.6 won't
dnl let programs access large files; you need to tell the compiler that
dnl you actually want your programs to work on large files. For more
dnl details about this brain damage please see:
dnl By default, many hosts won't let programs access large files;
dnl one must use special compiler options to get large-file access to work.
dnl For more details about this brain damage please see:
dnl http://www.sas.com/standards/large.file/x_open.20Mar96.html
AC_DEFUN(AC_LFS,
[dnl
# If available, prefer support for large files unless the user specified
# one of the CPPFLAGS, LDFLAGS, or LIBS variables.
AC_MSG_CHECKING(whether large file support needs explicit enabling)
ac_getconfs=''
ac_result=yes
ac_set=''
ac_shellvars='CPPFLAGS LDFLAGS LIBS'
for ac_shellvar in $ac_shellvars; do
case $ac_shellvar in
CPPFLAGS) ac_lfsvar=LFS_CFLAGS ;;
*) ac_lfsvar=LFS_$ac_shellvar ;;
esac
eval test '"${'$ac_shellvar'+set}"' = set && ac_set=$ac_shellvar
(getconf $ac_lfsvar) >/dev/null 2>&1 || { ac_result=no; break; }
ac_getconf=`getconf $ac_lfsvar`
ac_getconfs=$ac_getconfs$ac_getconf
eval ac_test_$ac_shellvar=\$ac_getconf
done
case "$ac_result$ac_getconfs" in
yes) ac_result=no ;;
esac
case "$ac_result$ac_set" in
yes?*) ac_result="yes, but $ac_set is already set, so use its settings"
esac
AC_MSG_RESULT($ac_result)
case $ac_result in
yes)
for ac_shellvar in $ac_shellvars; do
eval $ac_shellvar=\$ac_test_$ac_shellvar
done ;;
esac
])
dnl Written by Paul Eggert <eggert@twinsun.com>.
dnl Internal subroutine of AC_SYS_LARGEFILE.
dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
AC_DEFUN(AC_SYS_LARGEFILE_FLAGS,
[AC_CACHE_CHECK([for $1 value to request large file support],
ac_cv_sys_largefile_$1,
[ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
ac_cv_sys_largefile_$1=no
ifelse($1, CFLAGS,
[case "$host_os" in
# HP-UX 10.20 requires -D__STDC_EXT__ with gcc 2.95.1.
changequote(, )dnl
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
changequote([, ])dnl
if test "$GCC" = yes; then
ac_cv_sys_largefile_CFLAGS=-D__STDC_EXT__
fi
;;
# IRIX 6.2 and later require cc -n32.
changequote(, )dnl
irix6.[2-9]* | irix6.1[0-9]* | irix[7-9].* | irix[1-9][0-9]*)
changequote([, ])dnl
if test "$GCC" != yes; then
ac_cv_sys_largefile_CFLAGS=-n32
fi
esac
if test "$ac_cv_sys_largefile_CFLAGS" != no; then
ac_save_CC="$CC"
CC="$CC $ac_cv_sys_largefile_CFLAGS"
AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
CC="$ac_save_CC"
fi])
}])])
dnl Internal subroutine of AC_SYS_LARGEFILE.
dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
AC_DEFUN(AC_SYS_LARGEFILE_SPACE_APPEND,
[case $2 in
no) ;;
?*)
case "[$]$1" in
'') $1=$2 ;;
*) $1=[$]$1' '$2 ;;
esac ;;
esac])
dnl Internal subroutine of AC_SYS_LARGEFILE.
dnl AC_SYS_LARGEFILE_MACRO_VALUE(C-MACRO, CACHE-VAR, COMMENT, CODE-TO-SET-DEFAULT)
AC_DEFUN(AC_SYS_LARGEFILE_MACRO_VALUE,
[AC_CACHE_CHECK([for $1], $2,
[$2=no
changequote(, )dnl
$4
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
case "$ac_flag" in
-D$1)
$2=1 ;;
-D$1=*)
$2=`expr " $ac_flag" : '[^=]*=\(.*\)'` ;;
esac
done
changequote([, ])dnl
])
if test "[$]$2" != no; then
AC_DEFINE_UNQUOTED([$1], [$]$2, [$3])
fi])
AC_DEFUN(AC_SYS_LARGEFILE,
[AC_REQUIRE([AC_CANONICAL_HOST])
AC_ARG_ENABLE(largefile,
[ --disable-largefile omit support for large files])
if test "$enable_largefile" != no; then
AC_CHECK_TOOL(GETCONF, getconf)
AC_SYS_LARGEFILE_FLAGS(CFLAGS)
AC_SYS_LARGEFILE_FLAGS(LDFLAGS)
AC_SYS_LARGEFILE_FLAGS(LIBS)
for ac_flag in $ac_cv_sys_largefile_CFLAGS no; do
case "$ac_flag" in
no) ;;
-D_FILE_OFFSET_BITS=*) ;;
-D_LARGEFILE_SOURCE | -D_LARGEFILE_SOURCE=*) ;;
-D_LARGE_FILES | -D_LARGE_FILES=*) ;;
-D?* | -I?*)
AC_SYS_LARGEFILE_SPACE_APPEND(CPPFLAGS, "$ac_flag") ;;
*)
AC_SYS_LARGEFILE_SPACE_APPEND(CFLAGS, "$ac_flag") ;;
esac
done
AC_SYS_LARGEFILE_SPACE_APPEND(LDFLAGS, "$ac_cv_sys_largefile_LDFLAGS")
AC_SYS_LARGEFILE_SPACE_APPEND(LIBS, "$ac_cv_sys_largefile_LIBS")
AC_SYS_LARGEFILE_MACRO_VALUE(_FILE_OFFSET_BITS,
ac_cv_sys_file_offset_bits,
[Number of bits in a file offset, on hosts where this is settable.],
[case "$host_os" in
# HP-UX 10.20 and later
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
ac_cv_sys_file_offset_bits=64 ;;
esac])
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGEFILE_SOURCE,
ac_cv_sys_largefile_source,
[Define to make fseeko etc. visible, on some hosts.],
[case "$host_os" in
# HP-UX 10.20 and later
hpux10.[2-9][0-9]* | hpux1[1-9]* | hpux[2-9][0-9]*)
ac_cv_sys_largefile_source=1 ;;
esac])
AC_SYS_LARGEFILE_MACRO_VALUE(_LARGE_FILES,
ac_cv_sys_large_files,
[Define for large files, on AIX-style hosts.],
[case "$host_os" in
# AIX 4.2 and later
aix4.[2-9]* | aix4.1[0-9]* | aix[5-9].* | aix[1-9][0-9]*)
ac_cv_sys_large_files=1 ;;
esac])
fi
])
dnl ---------------------------------------------------------------------------
@@ -197,8 +280,9 @@ AC_DEFUN(jm_AC_TYPE_UINTMAX_T,
AC_REQUIRE([jm_AC_HEADER_INTTYPES_H])
if test $jm_ac_cv_header_inttypes_h = no; then
AC_CACHE_CHECK([for unsigned long long], ac_cv_type_unsigned_long_long,
[AC_TRY_COMPILE([],
[unsigned long long i = (unsigned long long) -1;],
[AC_TRY_LINK([unsigned long long ull = 1; int i = 63;],
[unsigned long long ullmax = (unsigned long long) -1;
return ull << i | ull >> i | ullmax / ull | ullmax % ull;],
ac_cv_type_unsigned_long_long=yes,
ac_cv_type_unsigned_long_long=no)])
if test $ac_cv_type_unsigned_long_long = yes; then
@@ -297,3 +381,100 @@ changequote([,]),dnl
AC_DEFINE_UNQUOTED(SELECT_FD_SET_CAST,$ac_cast)
fi
])
# The following is taken from automake 1.4,
# except that it prefers the compiler option -Ae to "-Aa -D_HPUX_SOURCE"
# because only the former supports 64-bit integral types on HP-UX 10.20.
## ----------------------------------------- ##
## ANSIfy the C compiler whenever possible. ##
## From Franc,ois Pinard ##
## ----------------------------------------- ##
# serial 2
# @defmac AC_PROG_CC_STDC
# @maindex PROG_CC_STDC
# @ovindex CC
# If the C compiler in not in ANSI C mode by default, try to add an option
# to output variable @code{CC} to make it so. This macro tries various
# options that select ANSI C on some system or another. It considers the
# compiler to be in ANSI C mode if it handles function prototypes correctly.
#
# If you use this macro, you should check after calling it whether the C
# compiler has been set to accept ANSI C; if not, the shell variable
# @code{am_cv_prog_cc_stdc} is set to @samp{no}. If you wrote your source
# code in ANSI C, you can make an un-ANSIfied copy of it by using the
# program @code{ansi2knr}, which comes with Ghostscript.
# @end defmac
AC_DEFUN(AM_PROG_CC_STDC,
[AC_REQUIRE([AC_PROG_CC])
AC_BEFORE([$0], [AC_C_INLINE])
AC_BEFORE([$0], [AC_C_CONST])
dnl Force this before AC_PROG_CPP. Some cpp's, eg on HPUX, require
dnl a magic option to avoid problems with ANSI preprocessor commands
dnl like #elif.
dnl FIXME: can't do this because then AC_AIX won't work due to a
dnl circular dependency.
dnl AC_BEFORE([$0], [AC_PROG_CPP])
AC_MSG_CHECKING(for ${CC-cc} option to accept ANSI C)
AC_CACHE_VAL(am_cv_prog_cc_stdc,
[am_cv_prog_cc_stdc=no
ac_save_CC="$CC"
# Don't try gcc -ansi; that turns off useful extensions and
# breaks some systems' header files.
# AIX -qlanglvl=ansi
# Ultrix and OSF/1 -std1
# HP-UX -Aa -D_HPUX_SOURCE
# SVR4 -Xc -D__EXTENSIONS__
for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
AC_TRY_COMPILE(
[#include <stdarg.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
static char *e (p, i)
char **p;
int i;
{
return p[i];
}
static char *f (char * (*g) (char **, int), char **p, ...)
{
char *s;
va_list v;
va_start (v,p);
s = g (p, va_arg (v,int));
va_end (v);
return s;
}
int test (int i, double x);
struct s1 {int (*f) (int a);};
struct s2 {int (*f) (double a);};
int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
int argc;
char **argv;
], [
return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
],
[am_cv_prog_cc_stdc="$ac_arg"; break])
done
CC="$ac_save_CC"
])
if test -z "$am_cv_prog_cc_stdc"; then
AC_MSG_RESULT([none needed])
else
AC_MSG_RESULT($am_cv_prog_cc_stdc)
fi
case "x$am_cv_prog_cc_stdc" in
x|xno) ;;
*) CC="$CC $am_cv_prog_cc_stdc" ;;
esac
])

12
ar.c
View File

@@ -47,7 +47,7 @@ ar_name (name)
return 0;
if (p[1] == '(' && end[-1] == ')')
fatal (NILF, "attempt to use unsupported feature: `%s'", name);
fatal (NILF, _("attempt to use unsupported feature: `%s'"), name);
return 1;
}
@@ -138,7 +138,7 @@ int
ar_touch (name)
char *name;
{
error (NILF, "touch archive member is not available on VMS");
error (NILF, _("touch archive member is not available on VMS"));
return -1;
}
#else
@@ -170,24 +170,24 @@ ar_touch (name)
switch (ar_member_touch (arname, memname))
{
case -1:
error (NILF, "touch: Archive `%s' does not exist", arname);
error (NILF, _("touch: Archive `%s' does not exist"), arname);
break;
case -2:
error (NILF, "touch: `%s' is not a valid archive", arname);
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);
_("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);
_("touch: Bad return code from ar_member_touch on `%s'"), name);
}
if (!arname_used)

View File

@@ -70,7 +70,7 @@ VMS_get_member_info (module, rfa)
&bufdesc.dsc$w_length, 0);
if (! status)
{
error (NILF, "lbr$set_module failed to extract module info, status = %d",
error (NILF, _("lbr$set_module failed to extract module info, status = %d"),
status);
lbr$close (&VMS_lib_idx);
@@ -152,7 +152,7 @@ ar_scan (archive, function, arg)
if (! status)
{
error (NILF, "lbr$ini_control failed with status = %d",status);
error (NILF, _("lbr$ini_control failed with status = %d"),status);
return -2;
}
@@ -163,7 +163,7 @@ ar_scan (archive, function, arg)
if (! status)
{
error (NILF, "unable to open library `%s' to lookup member `%s'",
error (NILF, _("unable to open library `%s' to lookup member `%s'"),
archive, (char *)arg);
return -1;
}
@@ -775,12 +775,9 @@ ar_member_touch (arname, memname)
if (AR_HDR_SIZE != write (fd, (char *) &ar_hdr, AR_HDR_SIZE))
goto lose;
/* The file's mtime is the time we we want. */
#ifdef EINTR
while (fstat (fd, &statbuf) < 0 && errno == EINTR);
#else
fstat (fd, &statbuf);
#endif
#if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG)
while (fstat (fd, &statbuf) < 0 && EINTR_SET)
;
#if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || defined(WINDOWS32)
/* Advance member's time to that time */
for (i = 0; i < sizeof ar_hdr.ar_date; i++)
ar_hdr.ar_date[i] = ' ';
@@ -820,11 +817,11 @@ describe_member (desc, name, truncated,
{
extern char *ctime ();
printf ("Member `%s'%s: %ld bytes at %ld (%ld).\n",
name, truncated ? " (name might be truncated)" : "",
printf (_("Member `%s'%s: %ld bytes at %ld (%ld).\n"),
name, truncated ? _(" (name might be truncated)") : "",
size, hdrpos, datapos);
printf (" Date %s", ctime (&date));
printf (" uid = %d, gid = %d, mode = 0%o.\n", uid, gid, mode);
printf (_(" Date %s"), ctime (&date));
printf (_(" uid = %d, gid = %d, mode = 0%o.\n"), uid, gid, mode);
return 0;
}

View File

@@ -386,7 +386,7 @@ fatal_error_signal (sig)
#ifdef _AMIGA
remove_intermediates (1);
if (sig == SIGINT)
fputs ("*** Break.\n", stderr);
fputs (_("*** Break.\n"), stderr);
exit (10);
#else /* not Amiga */
@@ -478,10 +478,10 @@ delete_target (file, on_behalf_of)
if (ar_member_date (file->name) != FILE_TIMESTAMP_S (file->last_mtime))
{
if (on_behalf_of)
error (NILF, "*** [%s] Archive member `%s' may be bogus; not deleted",
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",
error (NILF, _("*** Archive member `%s' may be bogus; not deleted"),
file->name);
}
return;
@@ -493,9 +493,9 @@ delete_target (file, on_behalf_of)
&& FILE_TIMESTAMP_STAT_MODTIME (st) != file->last_mtime)
{
if (on_behalf_of)
error (NILF, "*** [%s] Deleting file `%s'", on_behalf_of, file->name);
error (NILF, _("*** [%s] Deleting file `%s'"), on_behalf_of, file->name);
else
error (NILF, "*** Deleting file `%s'", file->name);
error (NILF, _("*** Deleting file `%s'"), file->name);
if (unlink (file->name) < 0
&& errno != ENOENT) /* It disappeared; so what. */
perror_with_name ("unlink: ", file->name);
@@ -533,12 +533,12 @@ print_commands (cmds)
{
register char *s;
fputs ("# commands to execute", stdout);
fputs (_("# commands to execute"), stdout);
if (cmds->fileinfo.filenm == 0)
puts (" (built-in):");
puts (_(" (built-in):"));
else
printf (" (from `%s', line %lu):\n",
printf (_(" (from `%s', line %lu):\n"),
cmds->fileinfo.filenm, cmds->fileinfo.lineno);
s = cmds->commands;

View File

@@ -308,3 +308,6 @@
/* Define for Case Insensitve behavior */
#define HAVE_CASE_INSENSITIVE_FS
/* Build host information. */
#define MAKE_HOST "Amiga"

1088
config.guess vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -341,3 +341,5 @@
#define PARAMS(protos) ()
#endif /* C++ or ANSI C. */
/* Build host information. */
#define MAKE_HOST "VMS"

View File

@@ -332,21 +332,43 @@
/* Define if you have the sun library (-lsun). */
/* #undef HAVE_LIBSUN */
/* Build host information. */
#define MAKE_HOST "Windows32"
/*
* Refer to README.W32 for info on the following settings
*/
/*
Define if you have the Cygnus GNU WIN32 tool set or a shell
that does not grok 'sh -c quoted-command-line' correctly.
* If you have a shell that does not grok 'sh -c quoted-command-line'
* correctly, you need this setting. Please see below for specific
* shell support.
*/
#undef BATCH_MODE_ONLY_SHELL
#define BATCH_MODE_ONLY_SHELL 1
/*
Define if you have the MKS tool set or shell. Do NOT define
BATCH_MODE_ONLY_SHELL if you define HAVE_MKS_SHELL
* Define if you have the Cygnus "Cygwin" GNU Windows32 tool set.
* Do NOT define BATCH_MODE_ONLY_SHELL if you define HAVE_CYGWIN_SHELL
*/
#undef HAVE_CYGWIN_SHELL
/*
* Define if you have the MKS tool set or shell. Do NOT define
* BATCH_MODE_ONLY_SHELL if you define HAVE_MKS_SHELL
*/
#undef HAVE_MKS_SHELL
/* Define if you prefer Case Insensitve behavior */
/*
* Enforce the mutual exclusivity restriction.
*/
#ifdef HAVE_MKS_SHELL
#undef BATCH_MODE_ONLY_SHELL
#endif
#ifdef HAVE_CYGWIN_SHELL
#undef BATCH_MODE_ONLY_SHELL
#endif
/* Define if you prefer Case Insensitive behavior */
#undef HAVE_CASE_INSENSITIVE_FS

1220
config.sub vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -33,3 +33,20 @@
#define HAVE_MEMMOVE 1
#define SCCS_GET "get"
/* Define to `unsigned long' or `unsigned long long'
if <inttypes.h> doesn't define. */
#define uintmax_t unsigned long long
/* Define the type of the first arg to select(). */
#define fd_set_size_t int
/* Define if you have the select function. */
#define HAVE_SELECT 1
/* Define if you have the vprintf library function. */
#undef HAVE_VPRINTF
#define HAVE_VPRINTF 1
/* Build host information. */
#define MAKE_HOST "i386-pc-msdosdjgpp"

View File

@@ -3,11 +3,12 @@ AC_REVISION([$Id$])
AC_PREREQ(2.13)dnl dnl Minimum Autoconf version required.
AC_INIT(vpath.c)dnl dnl A distinctive file to look for in srcdir.
AM_INIT_AUTOMAKE(make, 3.77.90)
AM_INIT_AUTOMAKE(make, 3.78.1)
AM_CONFIG_HEADER(config.h)
dnl Regular configure stuff
AC_CANONICAL_HOST
AC_PROG_MAKE_SET
AC_PROG_CC
AC_PROG_INSTALL
@@ -18,10 +19,13 @@ AC_AIX
AC_ISC_POSIX
AC_MINIX
AC_CHECK_PROG(PERL, perl, perl, perl) dnl Needed for the test suite (only)
dnl This test must come as early as possible after the compiler configuration
dnl tests, because the choice of the file model can (in principle) affect
dnl whether functions and headers are available, whether they work, etc.
AC_LFS
AC_SYS_LARGEFILE
AC_HEADER_STDC
AC_HEADER_DIRENT
@@ -31,6 +35,7 @@ AC_TYPE_SIGNAL
AC_CHECK_HEADERS(stdlib.h unistd.h limits.h sys/param.h fcntl.h string.h \
memory.h sys/timeb.h)
AC_PROG_CC_C_O
AM_PROG_CC_STDC
AC_C_CONST dnl getopt needs this.
AC_HEADER_STAT
@@ -56,8 +61,9 @@ AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
AC_CHECK_LIB(posix4, clock_gettime)
AC_CHECK_FUNCS(memmove strdup psignal mktemp pstat_getdynamic \
clock_gettime dup2 getcwd sigsetmask getgroups setlinebuf \
seteuid setegid setreuid setregid strerror strsignal pipe)
clock_gettime dup2 getcwd sigsetmask sigaction getgroups \
setlinebuf seteuid setegid setreuid setregid pipe \
strerror strsignal)
AC_CHECK_SYMBOL(sys_siglist)
AC_FUNC_ALLOCA
AC_FUNC_VFORK
@@ -65,9 +71,10 @@ AC_FUNC_VPRINTF
AC_FUNC_STRCOLL
AC_FUNC_CLOSEDIR_VOID
AC_FUNC_SETVBUF_REVERSED
AC_FUNC_GETLOADAVG
AC_FUNC_SELECT
AC_CHECK_LIB(kstat, kstat_open)
AC_CHECK_LIB(kstat, kstat_open) dnl _Must_ come before AC_FUNC_GETLOADAVG.
AC_FUNC_GETLOADAVG
# Check out the wait reality.
AC_CHECK_HEADERS(sys/wait.h)
@@ -129,11 +136,16 @@ dnl See if we can handle the job server feature, and if the user wants it.
AC_ARG_ENABLE(job-server,
[ --disable-job-server Disallow recursive make communication during -jN],
[make_cv_job_server="$enableval"],
[make_cv_job_server="$enableval" user_job_server="$enableval"],
[make_cv_job_server="yes"])
case "$ac_cv_func_pipe $make_cv_job_server" in
"yes yes") AC_DEFINE(MAKE_JOBSERVER) ;;
has_wait_nohang=yes
case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
no/no) has_wait_nohang=no ;;
esac
case "$ac_cv_func_pipe/$ac_cv_func_sigaction/$has_wait_nohang/$make_cv_job_server" in
yes/yes/yes/yes) AC_DEFINE(MAKE_JOBSERVER) ;;
esac
dnl Allow building with dmalloc
@@ -199,19 +211,24 @@ case "$make_cv_sys_gnu_glob" in
;;
esac
AC_DEFINE_UNQUOTED(MAKE_HOST,"$host",[Build host information.])
MAKE_HOST="$host"
AC_SUBST(MAKE_HOST)
MAINT_MAKEFILE=/dev/null
if test -r $srcdir/maintMakefile; then
if test -r "$srcdir/maintMakefile"; then
MAINT_MAKEFILE="$srcdir/maintMakefile"
fi
AC_SUBST_FILE(MAINT_MAKEFILE)
dnl build.sh is also an AC_OUTPUT, but we can't specify it here because
dnl it's built from build.template and autoconf will crap out. So, we
dnl build it in the makefiles themselves.
AC_OUTPUT(build.sh Makefile glob/Makefile)
dnl If we don't yet have build.sh.in, build.sh is a bogus 0-length file
dnl so remove it.
dnl Can't do this because then remote builds with build.sh don't work.
dnl test -f build.sh.in || rm -f build.sh
case "$make_badcust" in
yes) echo
echo "WARNING: --with-customs specified but no customs.h could be found;"
@@ -232,13 +249,23 @@ case "$with_customs" in
fi ;;
esac
case "$ac_cv_func_waitpid/$ac_cv_func_wait3" in
no/no) echo
echo "WARNING: Your system has neither waitpid() nor wait3()."
echo " Without one of these, signal handling is unreliable."
echo " You should be aware that running GNU make with -j"
echo " could result in erratic behavior."
echo ;;
case "$has_wait_nohang" in
no) echo
echo "WARNING: Your system has neither waitpid() nor wait3()."
echo " Without one of these, signal handling is unreliable."
echo " You should be aware that running GNU make with -j"
echo " could result in erratic behavior."
echo ;;
esac
case "$make_cv_job_server/$user_job_server" in
no/yes) echo
echo "WARNING: Make job server requires a POSIX-ish system that"
echo " supports the pipe(), sigaction(), and either"
echo " waitpid() or wait3() functions. Your system doesn't"
echo " appear to provide one or more of those."
echo " Disabling job server support."
echo ;;
esac
dnl Local Variables:

34
dir.c
View File

@@ -884,7 +884,7 @@ print_dir_data_base ()
register unsigned int i, dirs, files, impossible;
register struct directory *dir;
puts ("\n# Directories\n");
puts (_("\n# Directories\n"));
dirs = files = impossible = 0;
for (i = 0; i < DIRECTORY_BUCKETS; ++i)
@@ -892,19 +892,19 @@ print_dir_data_base ()
{
++dirs;
if (dir->contents == 0)
printf ("# %s: could not be stat'd.\n", dir->name);
printf (_("# %s: could not be stat'd.\n"), dir->name);
else if (dir->contents->files == 0)
#ifdef WINDOWS32
printf ("# %s (key %s, mtime %d): could not be opened.\n",
printf (_("# %s (key %s, mtime %d): could not be opened.\n"),
dir->name, dir->contents->path_key,dir->contents->mtime);
#else /* WINDOWS32 */
#ifdef VMS
printf ("# %s (device %d, inode [%d,%d,%d]): could not be opened.\n",
printf (_("# %s (device %d, inode [%d,%d,%d]): could not be opened.\n"),
dir->name, dir->contents->dev,
dir->contents->ino[0], dir->contents->ino[1],
dir->contents->ino[2]);
#else
printf ("# %s (device %ld, inode %ld): could not be opened.\n",
printf (_("# %s (device %ld, inode %ld): could not be opened.\n"),
dir->name, (long int) dir->contents->dev,
(long int) dir->contents->ino);
#endif
@@ -921,34 +921,34 @@ print_dir_data_base ()
else
++f;
#ifdef WINDOWS32
printf ("# %s (key %s, mtime %d): ",
printf (_("# %s (key %s, mtime %d): "),
dir->name, dir->contents->path_key, dir->contents->mtime);
#else /* WINDOWS32 */
#ifdef VMS
printf ("# %s (device %d, inode [%d,%d,%d]): ",
printf (_("# %s (device %d, inode [%d,%d,%d]): "),
dir->name, dir->contents->dev,
dir->contents->ino[0], dir->contents->ino[1],
dir->contents->ino[2]);
#else
printf ("# %s (device %ld, inode %ld): ",
printf (_("# %s (device %ld, inode %ld): "),
dir->name,
(long)dir->contents->dev, (long)dir->contents->ino);
#endif
#endif /* WINDOWS32 */
if (f == 0)
fputs ("No", stdout);
fputs (_("No"), stdout);
else
printf ("%u", f);
fputs (" files, ", stdout);
fputs (_(" files, "), stdout);
if (im == 0)
fputs ("no", stdout);
fputs (_("no"), stdout);
else
printf ("%u", im);
fputs (" impossibilities", stdout);
fputs (_(" impossibilities"), stdout);
if (dir->contents->dirstream == 0)
puts (".");
else
puts (" so far.");
puts (_(" so far."));
files += f;
impossible += im;
}
@@ -956,15 +956,15 @@ print_dir_data_base ()
fputs ("\n# ", stdout);
if (files == 0)
fputs ("No", stdout);
fputs (_("No"), stdout);
else
printf ("%u", files);
fputs (" files, ", stdout);
fputs (_(" files, "), stdout);
if (impossible == 0)
fputs ("no", stdout);
fputs (_("no"), stdout);
else
printf ("%u", impossible);
printf (" impossibilities in %u directories.\n", dirs);
printf (_(" impossibilities in %u directories.\n"), dirs);
}
/* Hooks for globbing. */

View File

@@ -98,7 +98,8 @@ recursively_expand (v)
if (v->expanding)
/* Expanding V causes infinite recursion. Lose. */
fatal (reading_file,
"Recursive variable `%s' references itself (eventually)", v->name);
_("Recursive variable `%s' references itself (eventually)"),
v->name);
v->expanding = 1;
value = allocated_variable_expand (v->value);
@@ -119,7 +120,7 @@ warn_undefined (name, length)
{
if (warn_undefined_variables_flag)
error (reading_file,
"warning: undefined variable `%.*s'", (int)length, name);
_("warning: undefined variable `%.*s'"), (int)length, name);
}
/* Expand a simple reference to variable NAME, which is LENGTH chars long. */
@@ -231,7 +232,7 @@ variable_expand_string (line, string, length)
end = index (beg, closeparen);
if (end == 0)
/* Unterminated variable reference. */
fatal (reading_file, "unterminated variable reference");
fatal (reading_file, _("unterminated variable reference"));
p1 = lindex (beg, end, '$');
if (p1 != 0)
{
@@ -441,7 +442,10 @@ variable_expand_for_file (line, file)
save = current_variable_set_list;
current_variable_set_list = file->variables;
reading_file = &file->cmds->fileinfo;
if (file->cmds && file->cmds->fileinfo.filenm)
reading_file = &file->cmds->fileinfo;
else
reading_file = 0;
fnext = file->variables->next;
/* See if there's a pattern-specific variable struct for this target. */
if (!file->pat_searched)

74
file.c
View File

@@ -301,22 +301,22 @@ file_hash_enter (file, name, oldhash, oldname)
but give a message to let the user know what's going on. */
if (oldfile->cmds->fileinfo.filenm != 0)
error (&file->cmds->fileinfo,
"Commands were specified for \
file `%s' at %s:%lu,",
_("Commands were specified for \
file `%s' at %s:%lu,"),
oldname, oldfile->cmds->fileinfo.filenm,
oldfile->cmds->fileinfo.lineno);
else
error (&file->cmds->fileinfo,
"Commands for file `%s' were found by \
implicit rule search,",
_("Commands for file `%s' were found by \
implicit rule search,"),
oldname);
error (&file->cmds->fileinfo,
"but `%s' is now considered the same file \
as `%s'.",
_("but `%s' is now considered the same file \
as `%s'."),
oldname, name);
error (&file->cmds->fileinfo,
"Commands for `%s' will be ignored \
in favor of those for `%s'.",
_("Commands for `%s' will be ignored \
in favor of those for `%s'."),
name, oldname);
}
}
@@ -336,12 +336,12 @@ in favor of those for `%s'.",
merge_variable_set_lists (&oldfile->variables, file->variables);
if (oldfile->double_colon && file->is_target && !file->double_colon)
fatal (NILF, "can't rename single-colon `%s' to double-colon `%s'",
fatal (NILF, _("can't rename single-colon `%s' to double-colon `%s'"),
oldname, name);
if (!oldfile->double_colon && file->double_colon)
{
if (oldfile->is_target)
fatal (NILF, "can't rename double-colon `%s' to single-colon `%s'",
fatal (NILF, _("can't rename double-colon `%s' to single-colon `%s'"),
oldname, name);
else
oldfile->double_colon = file->double_colon;
@@ -408,7 +408,7 @@ remove_intermediates (sig)
if (!f->dontcare)
{
if (sig)
error (NILF, "*** Deleting intermediate file `%s'", f->name);
error (NILF, _("*** Deleting intermediate file `%s'"), f->name);
else if (!silent_flag)
{
if (! doneany)
@@ -612,7 +612,7 @@ print_file (f)
putchar ('\n');
if (!f->is_target)
puts ("# Not a target:");
puts (_("# Not a target:"));
printf ("%s:%s", f->name, f->double_colon ? ":" : "");
for (d = f->deps; d != 0; d = d->next)
@@ -620,45 +620,45 @@ print_file (f)
putchar ('\n');
if (f->precious)
puts ("# Precious file (dependency of .PRECIOUS).");
puts (_("# Precious file (prerequisite of .PRECIOUS)."));
if (f->phony)
puts ("# Phony target (dependency of .PHONY).");
puts (_("# Phony target (prerequisite of .PHONY)."));
if (f->cmd_target)
puts ("# Command-line target.");
puts (_("# Command-line target."));
if (f->dontcare)
puts ("# A default or MAKEFILES makefile.");
printf ("# Implicit rule search has%s been done.\n",
f->tried_implicit ? "" : " not");
puts (_("# A default or MAKEFILES makefile."));
printf (_("# Implicit rule search has%s been done.\n"),
f->tried_implicit ? "" : _(" not"));
if (f->stem != 0)
printf ("# Implicit/static pattern stem: `%s'\n", f->stem);
printf (_("# Implicit/static pattern stem: `%s'\n"), f->stem);
if (f->intermediate)
puts ("# File is an intermediate dependency.");
puts (_("# File is an intermediate prerequisite."));
if (f->also_make != 0)
{
fputs ("# Also makes:", stdout);
fputs (_("# Also makes:"), stdout);
for (d = f->also_make; d != 0; d = d->next)
printf (" %s", dep_name (d));
putchar ('\n');
}
if (f->last_mtime == 0)
puts ("# Modification time never checked.");
puts (_("# Modification time never checked."));
else if (f->last_mtime == (FILE_TIMESTAMP) -1)
puts ("# File does not exist.");
puts (_("# File does not exist."));
else
{
char buf[FILE_TIMESTAMP_PRINT_LEN_BOUND + 1];
file_timestamp_sprintf (buf, f->last_mtime);
printf ("# Last modified %s\n", buf);
printf (_("# Last modified %s\n"), buf);
}
printf ("# File has%s been updated.\n",
f->updated ? "" : " not");
printf (_("# File has%s been updated.\n"),
f->updated ? "" : _(" not"));
switch (f->command_state)
{
case cs_running:
puts ("# Commands currently running (THIS IS A BUG).");
puts (_("# Commands currently running (THIS IS A BUG)."));
break;
case cs_deps_running:
puts ("# Dependencies commands running (THIS IS A BUG).");
puts (_("# Dependencies commands running (THIS IS A BUG)."));
break;
case cs_not_started:
case cs_finished:
@@ -667,24 +667,24 @@ print_file (f)
case -1:
break;
case 0:
puts ("# Successfully updated.");
puts (_("# Successfully updated."));
break;
case 1:
assert (question_flag);
puts ("# Needs to be updated (-q is set).");
puts (_("# Needs to be updated (-q is set)."));
break;
case 2:
puts ("# Failed to be updated.");
puts (_("# Failed to be updated."));
break;
default:
puts ("# Invalid value in `update_status' member!");
puts (_("# Invalid value in `update_status' member!"));
fflush (stdout);
fflush (stderr);
abort ();
}
break;
default:
puts ("# Invalid value in `command_state' member!");
puts (_("# Invalid value in `command_state' member!"));
fflush (stdout);
fflush (stderr);
abort ();
@@ -703,7 +703,7 @@ print_file_data_base ()
register unsigned int i, nfiles, per_bucket;
register struct file *file;
puts ("\n# Files");
puts (_("\n# Files"));
per_bucket = nfiles = 0;
for (i = 0; i < FILE_BUCKETS; ++i)
@@ -726,12 +726,12 @@ print_file_data_base ()
}
if (nfiles == 0)
puts ("\n# No files.");
puts (_("\n# No files."));
else
{
printf ("\n# %u files in %u hash buckets.\n", nfiles, FILE_BUCKETS);
printf (_("\n# %u files in %u hash buckets.\n"), nfiles, FILE_BUCKETS);
#ifndef NO_FLOAT
printf ("# average %.3f files per bucket, max %u files in one bucket.\n",
printf (_("# average %.3f files per bucket, max %u files in one bucket.\n"),
((double) nfiles) / ((double) FILE_BUCKETS), per_bucket);
#endif
}

View File

@@ -472,7 +472,7 @@ func_origin(o, argv, funcname)
#ifdef VMS
#define IS_PATHSEP(c) ((c) == ']')
#else
#ifdef __MSDOS__
#if defined(__MSDOS__) || defined(WINDOWS32)
#define IS_PATHSEP(c) ((c) == '/' || (c) == '\\')
#else
#define IS_PATHSEP(c) ((c) == '/')
@@ -699,16 +699,13 @@ int
is_numeric (p)
char *p;
{
char *end = p + strlen (p) -1;
char *end = p + strlen (p) - 1;
char *beg = p;
strip_whitespace (&p, &end);
while (p <= end)
{
if (!isdigit (*p))
return 0;
p++;
}
while (p <= end)
if (!ISDIGIT (*(p++))) /* ISDIGIT only evals its arg once: see make.h. */
return 0;
return (end - beg >= 0);
}
@@ -735,11 +732,11 @@ func_word(o, argv, funcname)
char *p=0;
/* Check the first argument. */
check_numeric (argv[0], "non-numeric first argument to `word' function");
check_numeric (argv[0], _("non-numeric first argument to `word' function"));
i = atoi (argv[0]);
if (i == 0)
fatal (reading_file, "the `word' function takes a positive index argument");
fatal (reading_file, _("the `word' function takes a positive index argument"));
end_p = argv[1];
@@ -764,10 +761,10 @@ func_wordlist (o, argv, funcname)
/* Check the first argument. */
check_numeric (argv[0],
"non-numeric first argument to `wordlist' function");
_("non-numeric first argument to `wordlist' function"));
i =atoi(argv[0]);
check_numeric (argv[1],
"non-numeric second argument to `wordlist' function");
_("non-numeric second argument to `wordlist' function"));
j = atoi(argv[1]);
@@ -817,9 +814,9 @@ func_foreach (o, argv, funcname)
const char *funcname;
{
/* expand only the first two. */
char *varname = expand_argument (argv[0], argv[1] -1);
char *varname = expand_argument (argv[0], argv[1] - 1);
char *list = expand_argument (argv[1], argv[2] -1);
char *body = savestring (argv[2], argv[3] - argv[2] -1 );
char *body = savestring (argv[2], argv[3] - argv[2] - 1);
int len =0;
char *list_iterator = list;
@@ -1075,6 +1072,68 @@ func_sort (o, argv, funcname)
return o;
}
/*
$(if condition,true-part[,false-part])
CONDITION is false iff it evaluates to an empty string. White
space before and after condition are stripped before evaluation.
If CONDITION is true, then TRUE-PART is evaluated, otherwise FALSE-PART is
evaluated (if it exists). Because only one of the two PARTs is evaluated,
you can use $(if ...) to create side-effects (with $(shell ...), for
example).
*/
static char *
func_if (o, argv, funcname)
char *o;
char **argv;
const char *funcname;
{
char *begp = argv[0];
char *endp = argv[1]-1;
int result = 0;
/* Find the result of the condition: if we have a value, and it's not
empty, the condition is true. If we don't have a value, or it's the
empty string, then it's false. */
strip_whitespace (&begp, &endp);
if (begp < endp)
{
char *expansion = expand_argument (begp, endp);
result = strlen (expansion);
free (expansion);
}
/* If the result is true (1) we want to eval the first argument, and if
it's false (0) we want to eval the second. If the argument doesn't
exist we do nothing, otherwise expand it and add to the buffer. */
argv += 1 + !result;
if (argv[0] != NULL && argv[1] != NULL)
{
char *expansion;
char **endp = argv+1;
/* If we're doing the else-clause, make sure we concatenate any
potential extra arguments into the last argument. */
if (!result)
while (*endp && **endp != '\0')
++endp;
expansion = expand_argument (*argv, *endp-1);
o = variable_buffer_output (o, expansion, strlen (expansion));
free (expansion);
}
return o;
}
static char *
func_wildcard(o, argv, funcname)
char *o;
@@ -1156,7 +1215,7 @@ windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
0,
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) {
fatal (NILF, "create_child_process: DuplicateHandle(In) failed (e=%d)\n",
fatal (NILF, _("create_child_process: DuplicateHandle(In) failed (e=%d)\n"),
GetLastError());
}
@@ -1167,19 +1226,19 @@ windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
0,
TRUE,
DUPLICATE_SAME_ACCESS) == FALSE) {
fatal (NILF, "create_child_process: DuplicateHandle(Err) failed (e=%d)\n",
fatal (NILF, _("create_child_process: DuplicateHandle(Err) failed (e=%d)\n"),
GetLastError());
}
if (!CreatePipe(&hChildOutRd, &hChildOutWr, &saAttr, 0))
fatal (NILF, "CreatePipe() failed (e=%d)\n", GetLastError());
fatal (NILF, _("CreatePipe() failed (e=%d)\n"), GetLastError());
hProcess = process_init_fd(hIn, hChildOutWr, hErr);
if (!hProcess)
fatal (NILF, "windows32_openpipe (): process_init_fd() failed\n");
fatal (NILF, _("windows32_openpipe (): process_init_fd() failed\n"));
else
process_register(hProcess);
@@ -1190,7 +1249,7 @@ windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
if (!process_begin(hProcess, command_argv, envp, command_argv[0], NULL))
*pid_p = (int) hProcess;
else
fatal (NILF, "windows32_openpipe (): unable to launch process (e=%d)\n",
fatal (NILF, _("windows32_openpipe (): unable to launch process (e=%d)\n"),
process_last_err(hProcess));
/* set up to read data from child */
@@ -1203,15 +1262,11 @@ windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
#ifdef __MSDOS__
/*
untested
*/
int
FILE *
msdos_openpipe (int* pipedes, int *pidp, char *text)
{
FILE *fpipe=0;
/* MSDOS can't fork, but it has `popen'.
(Bwt, why isn't `popen' used in all the versions?) */
/* MSDOS can't fork, but it has `popen'. */
struct variable *sh = lookup_variable ("SHELL", 5);
int e;
extern int dos_command_running, dos_status;
@@ -1235,6 +1290,9 @@ msdos_openpipe (int* pipedes, int *pidp, char *text)
errno = 0;
dos_command_running = 1;
dos_status = 0;
/* If dos_status becomes non-zero, it means the child process
was interrupted by a signal, like SIGINT or SIGQUIT. See
fatal_error_signal in commands.c. */
fpipe = popen (text, "rt");
dos_command_running = 0;
if (!fpipe || dos_status)
@@ -1250,7 +1308,7 @@ msdos_openpipe (int* pipedes, int *pidp, char *text)
else
{
pipedes[0] = fileno (fpipe);
*pidp = 42; /* uh? The meaning of Life?*/
*pidp = 42; /* Yes, the Meaning of Life, the Universe, and Everything! */
errno = e;
shell_function_completed = 1;
}
@@ -1308,11 +1366,9 @@ func_shell (o, argv, funcname)
/* For error messages. */
if (reading_file != 0)
{
error_prefix = (char *) alloca (strlen(reading_file->filenm)+100);
error_prefix = (char *) alloca (strlen(reading_file->filenm)+11+4);
sprintf (error_prefix,
"%s:%lu: ", reading_file->filenm, reading_file->lineno);
}
else
error_prefix = "";
@@ -1322,11 +1378,11 @@ func_shell (o, argv, funcname)
#else /* WINDOWS32 */
# ifdef __MSDOS__
fpipe = msdos_openpipe (pipedes, argv[0], command_argv, envp);
if (!fpipe || pipedes[0] < 0)
fpipe = msdos_openpipe (pipedes, &pid, argv[0]);
if (pipedes[0] < 0)
{
perror_with_name (error_prefix, "pipe");
return o;
perror_with_name (error_prefix, "pipe");
return o;
}
# else
if (pipe (pipedes) < 0)
@@ -1384,11 +1440,7 @@ func_shell (o, argv, funcname)
if (cc > 0)
i += cc;
}
#ifdef EINTR
while (cc > 0 || errno == EINTR);
#else
while (cc > 0);
#endif
while (cc > 0 || EINTR_SET);
/* Close the read side of the pipe. */
#ifdef __MSDOS__
@@ -1405,7 +1457,7 @@ func_shell (o, argv, funcname)
if (batch_filename) {
if (debug_flag)
printf("Cleaning up temporary batch file %s\n", batch_filename);
printf(_("Cleaning up temporary batch file %s\n"), batch_filename);
remove(batch_filename);
free(batch_filename);
}
@@ -1553,54 +1605,6 @@ func_not (char* o, char **argv, char *funcname)
o = variable_buffer_output (o, result ? "1" : "", result);
return o;
}
/*
This is an experimental conditional function.
Syntax:
$(if condition, true-part, false-part)
This is fully not consistent with make's syntax, but more in line
with `normal' programming languages.
Semantics:
- CONDITION is false iff it evaluates to an empty string. White
space before and after condition are stripped before evaluation.
- If CONDITION is true, then TRUE-PART is evaluated, otherwise
FALSE-PART is evaluated. Because only one of the two PARTs is
evaluated, you can use $(if ) to create side-effects with the
$(shell ) function
*/
static char *
func_if (char* o, char **argv, char *funcname)
{
char *begp = argv[0];
char *endp = argv[1]-2;
char *expansion =0;
int result = 0;
strip_whitespace (&begp, &endp);
if(begp <= endp)
expansion = expand_argument (begp, endp + 1);
result = expansion
? strlen (expansion)
: 0;
result = !result;
free (expansion);
expansion = expand_argument (argv[1 + result], argv[2+result] -1);
o = variable_buffer_output (o, expansion, strlen (expansion));
return o;
}
#endif
@@ -1652,9 +1656,9 @@ static struct function_table_entry function_table[] =
{ STRING_SIZE_TUPLE("call"), -1, 1, func_call},
{ STRING_SIZE_TUPLE("error"), 1, 1, func_error},
{ STRING_SIZE_TUPLE("warning"), 1, 1, func_error},
{ STRING_SIZE_TUPLE("if"), -2, 0, func_if},
#ifdef EXPERIMENTAL
{ STRING_SIZE_TUPLE("eq"), 2, 1, func_eq},
{ STRING_SIZE_TUPLE("if"), 3, 0, func_if},
{ STRING_SIZE_TUPLE("not"), 1, 1, func_not},
#endif
{ 0 }
@@ -1676,11 +1680,11 @@ expand_builtin_function (o, argc, argv, entry_p)
if (argc < min)
fatal (reading_file,
"Insufficient number of arguments (%d) to function `%s'",
_("Insufficient number of arguments (%d) to function `%s'"),
argc, entry_p->name);
if (!entry_p->func_ptr)
fatal (reading_file, "Unimplemented on this platform: function `%s'",
fatal (reading_file, _("Unimplemented on this platform: function `%s'"),
entry_p->name);
return entry_p->func_ptr (o, argv, entry_p->name);
@@ -1736,7 +1740,7 @@ handle_function (op, stringp)
if (count >= 0)
fatal (reading_file,
"unterminated call to function `%s': missing `%c'",
_("unterminated call to function `%s': missing `%c'"),
entry_p->name, closeparen);
/* Get some memory to store the arg pointers. */

View File

@@ -1,3 +1,25 @@
1999-09-12 Paul D. Smith <psmith@gnu.org>
* fnmatch.c: Last GLIBC version wouldn't compile outside of GLIBC
(undefined reference to internal_function). Update to the latest
version
1999-09-11 Paul Eggert <eggert@twinsun.com>
* glob.h (glob): If #defining to glob64, do this before
declaring it, so that all declarations and uses match, and
do not declare glob64, to avoid a declaration clash.
(globfree): Likewise with globfree64.
1999-09-08 Eli Zaretskii <eliz@is.elta.co.il>
* glob.c (prefix_array) [__MSDOS__,WINDOWS32]: Keep the trailing
slash unless DIRNAME is just "x:/".
1999-09-06 Paul D. Smith <psmith@gnu.org>
* fnmatch.c: Update to latest version from GLIBC.
1999-07-21 Paul D. Smith <psmith@gnu.org>
* glob.c, glob.h, fnmatch.c, fnmatch.h: Update to latest version

View File

@@ -64,27 +64,27 @@
# define ISASCII(c) isascii(c)
# endif
#ifdef isblank
# define ISBLANK(c) (ISASCII (c) && isblank (c))
#else
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
#endif
#ifdef isgraph
# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
#else
# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
#endif
# ifdef isblank
# define ISBLANK(c) (ISASCII (c) && isblank (c))
# else
# define ISBLANK(c) ((c) == ' ' || (c) == '\t')
# endif
# ifdef isgraph
# define ISGRAPH(c) (ISASCII (c) && isgraph (c))
# else
# define ISGRAPH(c) (ISASCII (c) && isprint (c) && !isspace (c))
# endif
#define ISPRINT(c) (ISASCII (c) && isprint (c))
#define ISDIGIT(c) (ISASCII (c) && isdigit (c))
#define ISALNUM(c) (ISASCII (c) && isalnum (c))
#define ISALPHA(c) (ISASCII (c) && isalpha (c))
#define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
#define ISLOWER(c) (ISASCII (c) && islower (c))
#define ISPUNCT(c) (ISASCII (c) && ispunct (c))
#define ISSPACE(c) (ISASCII (c) && isspace (c))
#define ISUPPER(c) (ISASCII (c) && isupper (c))
#define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
# define ISPRINT(c) (ISASCII (c) && isprint (c))
# define ISDIGIT(c) (ISASCII (c) && isdigit (c))
# define ISALNUM(c) (ISASCII (c) && isalnum (c))
# define ISALPHA(c) (ISASCII (c) && isalpha (c))
# define ISCNTRL(c) (ISASCII (c) && iscntrl (c))
# define ISLOWER(c) (ISASCII (c) && islower (c))
# define ISPUNCT(c) (ISASCII (c) && ispunct (c))
# define ISSPACE(c) (ISASCII (c) && isspace (c))
# define ISUPPER(c) (ISASCII (c) && isupper (c))
# define ISXDIGIT(c) (ISASCII (c) && isxdigit (c))
# define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
@@ -132,22 +132,29 @@ extern int errno;
# if !defined HAVE___STRCHRNUL && !defined _LIBC
static char *
__strchrnul (s, c)
register const char *s;
const char *s;
int c;
{
c = (unsigned char)c;
while (*s && *s != c)
++s;
return (char *)s;
char *result = strchr (s, c);
if (result == NULL)
result = strchr (s, '\0');
return result;
}
# endif
# ifndef internal_function
/* Inside GNU libc we mark some function in a special way. In other
environments simply ignore the marking. */
# define internal_function
# endif
/* Match STRING against the filename pattern PATTERN, returning zero if
it matches, nonzero if not. */
static int internal_fnmatch __P ((const char *pattern, const char *string,
int no_leading_period, int flags))
internal_function;
static int
#ifdef _LIBC
internal_function
#endif
internal_fnmatch (pattern, string, no_leading_period, flags)
const char *pattern;
const char *string;

View File

@@ -1105,7 +1105,7 @@ prefix_array (dirname, array, n)
#if defined __MSDOS__ || defined WINDOWS32
else if (dirlen > 1)
{
if (dirname[dirlen - 1] == '/')
if (dirname[dirlen - 1] == '/' && dirname[dirlen - 2] == ':')
/* DIRNAME is "d:/". Don't prepend the slash from DIRNAME. */
--dirlen;
else if (dirname[dirlen - 1] == ':')

View File

@@ -140,6 +140,19 @@ typedef struct
} glob64_t;
#endif
#if _FILE_OFFSET_BITS == 64 && __GNUC__ < 2
# define glob glob64
# define globfree globfree64
#else
# ifdef _LARGEFILE64_SOURCE
extern int glob64 __P ((__const char *__pattern, int __flags,
int (*__errfunc) (__const char *, int),
glob64_t *__pglob));
extern void globfree64 __P ((glob64_t *__pglob));
# endif
#endif
/* Do glob searching for PATTERN, placing results in PGLOB.
The bits defined above may be set in FLAGS.
If a directory cannot be opened or read and ERRFUNC is not nil,
@@ -148,7 +161,7 @@ typedef struct
`glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
Otherwise, `glob' returns zero. */
#if _FILE_OFFSET_BITS != 64
#if _FILE_OFFSET_BITS != 64 || __GNUC__ < 2
extern int glob __P ((__const char *__pattern, int __flags,
int (*__errfunc) (__const char *, int),
glob_t *__pglob));
@@ -156,24 +169,11 @@ extern int glob __P ((__const char *__pattern, int __flags,
/* Free storage allocated in PGLOB by a previous `glob' call. */
extern void globfree __P ((glob_t *__pglob));
#else
# if __GNUC__ >= 2
extern int glob __P ((__const char *__pattern, int __flags,
int (*__errfunc) (__const char *, int),
glob_t *__pglob)) __asm__ ("glob64");
extern void globfree __P ((glob_t *__pglob)) __asm__ ("globfree64");
# else
# define glob glob64
# define globfree globfree64
# endif
#endif
#ifdef _LARGEFILE64_SOURCE
extern int glob64 __P ((__const char *__pattern, int __flags,
int (*__errfunc) (__const char *, int),
glob64_t *__pglob));
extern void globfree64 __P ((glob64_t *__pglob));
#endif

View File

@@ -36,7 +36,7 @@ try_implicit_rule (file, depth)
struct file *file;
unsigned int depth;
{
DEBUGPR ("Looking for an implicit rule for `%s'.\n");
DEBUGPR (_("Looking for an implicit rule for `%s'.\n"));
/* The order of these searches was previously reversed. My logic now is
that since the non-archive search uses more information in the target
@@ -51,7 +51,7 @@ try_implicit_rule (file, depth)
archive member name to search for implicit rules. */
if (ar_name (file->name))
{
DEBUGPR ("Looking for archive-member implicit rule for `%s'.\n");
DEBUGPR (_("Looking for archive-member implicit rule for `%s'.\n"));
if (pattern_search (file, 1, depth, 0))
return 1;
}
@@ -168,7 +168,7 @@ pattern_search (file, archive, depth, recursions)
lastslash = rindex (filename, ']');
#else
lastslash = rindex (filename, '/');
#ifdef __MSDOS__
#if defined(__MSDOS__) || defined(WINDOWS32)
/* Handle backslashes (possibly mixed with forward slashes)
and the case of "d:file". */
{
@@ -199,7 +199,7 @@ pattern_search (file, archive, depth, recursions)
don't use it here. */
if (rule->in_use)
{
DEBUGP2 ("Avoiding implicit rule recursion.%s%s\n", "", "");
DEBUGP2 (_("Avoiding implicit rule recursion.%s%s\n"), "", "");
continue;
}
@@ -335,7 +335,7 @@ pattern_search (file, archive, depth, recursions)
stemlen -= (lastslash - filename) + 1;
}
DEBUGP2 ("Trying pattern rule with stem `%.*s'.\n",
DEBUGP2 (_("Trying pattern rule with stem `%.*s'.\n"),
(int) stemlen, stem);
/* Try each dependency; see if it "exists". */
@@ -376,16 +376,16 @@ pattern_search (file, archive, depth, recursions)
"impossible", then the rule fails and don't
bother trying it on the second pass either
since we know that will fail too. */
DEBUGP2 ("Rejecting impossible %s dependency `%s'.\n",
p == depname ? "implicit" : "rule", p);
DEBUGP2 (_("Rejecting impossible %s prerequisite `%s'.\n"),
p == depname ? _("implicit") : _("rule"), p);
tryrules[i] = 0;
break;
}
intermediate_files[deps_found] = 0;
DEBUGP2 ("Trying %s dependency `%s'.\n",
p == depname ? "implicit" : "rule", p);
DEBUGP2 (_("Trying %s prerequisite `%s'.\n"),
p == depname ? _("implicit") : _("rule"), p);
/* The DEP->changed flag says that this dependency resides in a
nonexistent directory. So we normally can skip looking for
@@ -408,8 +408,9 @@ pattern_search (file, archive, depth, recursions)
vp = p;
if (vpath_search (&vp, (FILE_TIMESTAMP *) 0))
{
DEBUGP2 ("Found dependency `%s' as VPATH `%s'\n", p, vp);
strcpy(vp, p);
DEBUGP2 (_("Found prerequisite `%s' as VPATH `%s'\n"),
p, vp);
strcpy (vp, p);
found_files[deps_found++] = vp;
continue;
}
@@ -424,8 +425,8 @@ pattern_search (file, archive, depth, recursions)
intermediate_file
= (struct file *) alloca (sizeof (struct file));
DEBUGP2 ("Looking for a rule with %s file `%s'.\n",
"intermediate", p);
DEBUGP2 (_("Looking for a rule with %s file `%s'.\n"),
_("intermediate"), p);
bzero ((char *) intermediate_file, sizeof (struct file));
intermediate_file->name = p;

630
job.c
View File

@@ -145,6 +145,17 @@ extern int wait ();
#endif /* Don't have `union wait'. */
/* How to set close-on-exec for a file descriptor. */
#if !defined F_SETFD
# define CLOSE_ON_EXEC(_d)
#else
# ifndef FD_CLOEXEC
# define FD_CLOEXEC 1
# endif
# define CLOSE_ON_EXEC(_d) (void) fcntl ((_d), F_SETFD, FD_CLOEXEC)
#endif
#ifdef VMS
static int vms_jobsefnmask = 0;
#endif /* !VMS */
@@ -198,6 +209,9 @@ static struct child *waiting_jobs = 0;
/* Non-zero if we use a *real* shell (always so on Unix). */
int unixy_shell = 1;
/* #define debug_flag 1 */
#ifdef WINDOWS32
/*
@@ -205,10 +219,11 @@ int unixy_shell = 1;
*/
int w32_kill(int pid, int sig)
{
return ((process_kill(pid, sig) == TRUE) ? 0 : -1);
return ((process_kill(pid, sig) == TRUE) ? 0 : -1);
}
#endif /* WINDOWS32 */
/* Write an error message describing the exit status given in
EXIT_CODE, EXIT_SIG, and COREDUMP, for the target TARGET_NAME.
Append "(ignored)" if IGNORED is nonzero. */
@@ -224,16 +239,16 @@ child_error (target_name, exit_code, exit_sig, coredump, ignored)
#ifdef VMS
if (!(exit_code & 1))
error (NILF, "*** [%s] Error 0x%x%s", target_name, exit_code, ((ignored)? " (ignored)" : ""));
error (NILF, _("*** [%s] Error 0x%x%s"), target_name, exit_code, ((ignored)? _(" (ignored)") : ""));
#else
if (exit_sig == 0)
error (NILF, ignored ? "[%s] Error %d (ignored)" :
"*** [%s] Error %d",
error (NILF, ignored ? _("[%s] Error %d (ignored)") :
_("*** [%s] Error %d"),
target_name, exit_code);
else
error (NILF, "*** [%s] %s%s",
target_name, strsignal (exit_sig),
coredump ? " (core dumped)" : "");
coredump ? _(" (core dumped)") : "");
#endif /* VMS */
}
@@ -257,47 +272,66 @@ vmsWaitForChildren(int *status)
#endif
/* Count the number of dead children we have. If we can use wait3() or
waitpid() then we'll never use this count: it's completely unnecessary.
But we need the handler installed to interrupt the select() call for
the jobs pipe, so we might as well keep it. */
/* Handle a dead child. This handler may or may not ever be installed.
If we're using the jobserver feature, we need it. First, installing it
ensures the read will interrupt on SIGCHLD. Second, we close the dup'd
read FD to ensure we don't enter another blocking read without reaping all
the dead children. In this case we don't need the dead_children count.
If we don't have either waitpid or wait3, then make is unreliable, but we
use the dead_children count to reap children as best we can. */
static unsigned int dead_children = 0;
/* Notice that a child died.
reap_children should be called when convenient. */
RETSIGTYPE
child_handler (sig)
int sig;
{
++dead_children;
if (job_rfd >= 0)
{
close (job_rfd);
job_rfd = -1;
}
if (debug_flag)
printf ("Got a SIGCHLD; %u unreaped children.\n", dead_children);
printf (_("Got a SIGCHLD; %u unreaped children.\n"), dead_children);
}
extern int shell_function_pid, shell_function_completed;
/* Reap dead children, storing the returned status and the new command
/* Reap all dead children, storing the returned status and the new command
state (`cs_finished') in the `file' member of the `struct child' for the
dead child, and removing the child from the chain. If BLOCK nonzero,
reap at least one child, waiting for it to die if necessary. If ERR is
nonzero, print an error message first. */
dead child, and removing the child from the chain. In addition, if BLOCK
nonzero, we block in this function until we've reaped at least one
complete child, waiting for it to die if necessary. If ERR is nonzero,
print an error message first. */
void
reap_children (block, err)
int block, err;
{
WAIT_T status;
#ifdef WAIT_NOHANG
/* Initially, assume we have some. */
int reap_more = 1;
#ifdef WAIT_NOHANG
# define REAP_MORE reap_more
#else
# define REAP_MORE dead_children
#endif
/* As long as:
We have at least one child outstanding OR a shell function in progress,
AND
We're blocking for a complete child OR there are more children to reap
we'll keep reaping children. */
while ((children != 0 || shell_function_pid != 0) &&
(block || REAP_MORE))
{
@@ -312,7 +346,7 @@ reap_children (block, err)
{
/* We might block for a while, so let the user know why. */
fflush (stdout);
error (NILF, "*** Waiting for unfinished jobs....");
error (NILF, _("*** Waiting for unfinished jobs...."));
}
/* We have one less dead child to reap. As noted in
@@ -342,9 +376,9 @@ reap_children (block, err)
any_remote |= c->remote;
any_local |= ! c->remote;
if (debug_flag)
printf ("Live child 0x%08lx PID %ld%s\n",
(unsigned long int) c,
(long) c->pid, c->remote ? " (remote)" : "");
printf (_("Live child 0x%08lx (%s) PID %ld %s\n"),
(unsigned long int) c, c->file->name,
(long) c->pid, c->remote ? _(" (remote)") : "");
#ifdef VMS
break;
#endif
@@ -363,19 +397,18 @@ reap_children (block, err)
{
/* A remote status command failed miserably. Punt. */
remote_status_lose:
#ifdef EINTR
if (errno == EINTR)
if (EINTR_SET)
continue;
#endif
pfatal_with_name ("remote_status");
}
else
{
/* No remote children. Check for local children. */
#if !defined(__MSDOS__) && !defined(_AMIGA) && !defined(WINDOWS32)
if (any_local)
{
local_wait:
#ifdef VMS
vmsWaitForChildren (&status);
pid = c->pid;
@@ -393,16 +426,16 @@ reap_children (block, err)
if (pid < 0)
{
/* EINTR? Try again. */
if (EINTR_SET)
goto local_wait;
/* The wait*() failed miserably. Punt. */
#ifdef EINTR
if (errno == EINTR)
continue;
#endif
pfatal_with_name ("wait");
}
else if (pid > 0)
{
/* We got one; chop the status word up. */
/* We got a child exit; chop the status word up. */
exit_code = WEXITSTATUS (status);
exit_sig = WIFSIGNALED (status) ? WTERMSIG (status) : 0;
coredump = WCOREDUMP (status);
@@ -410,26 +443,24 @@ reap_children (block, err)
else
{
/* No local children are dead. */
#ifdef WAIT_NOHANG
reap_more = 0;
#endif
if (block && any_remote)
{
/* Now try a blocking wait for a remote child. */
pid = remote_status (&exit_code, &exit_sig, &coredump, 1);
if (pid < 0)
goto remote_status_lose;
else if (pid == 0)
/* No remote children either. Finally give up. */
break;
else
/* We got a remote child. */
remote = 1;
}
else
break;
if (!block || !any_remote)
break;
/* Now try a blocking wait for a remote child. */
pid = remote_status (&exit_code, &exit_sig, &coredump, 1);
if (pid < 0)
goto remote_status_lose;
else if (pid == 0)
/* No remote children either. Finally give up. */
break;
/* We got a remote child. */
remote = 1;
}
#endif /* !__MSDOS__, !Amiga, !WINDOWS32. */
#ifdef __MSDOS__
/* Life is very different on MSDOS. */
pid = dos_pid - 1;
@@ -499,162 +530,147 @@ reap_children (block, err)
break;
if (c == 0)
{
/* An unknown child died.
Ignore it; it was inherited from our invoker. */
continue;
}
/* An unknown child died.
Ignore it; it was inherited from our invoker. */
continue;
if (debug_flag)
printf (_("Reaping %s child 0x%08lx PID %ld %s\n"),
child_failed ? _("losing") : _("winning"),
(unsigned long int) c, (long) c->pid,
c->remote ? _(" (remote)") : "");
if (c->sh_batch_file) {
if (debug_flag)
printf (_("Cleaning up temp batch file %s\n"), c->sh_batch_file);
/* just try and remove, don't care if this fails */
remove (c->sh_batch_file);
/* all done with memory */
free (c->sh_batch_file);
c->sh_batch_file = NULL;
}
/* If this child had the good stdin, say it is now free. */
if (c->good_stdin)
good_stdin_used = 0;
if (child_failed && !c->noerror && !ignore_errors_flag)
{
/* The commands failed. Write an error message,
delete non-precious targets, and abort. */
static int delete_on_error = -1;
child_error (c->file->name, exit_code, exit_sig, coredump, 0);
c->file->update_status = 2;
if (delete_on_error == -1)
{
struct file *f = lookup_file (".DELETE_ON_ERROR");
delete_on_error = f != 0 && f->is_target;
}
if (exit_sig != 0 || delete_on_error)
delete_child_targets (c);
}
else
{
if (debug_flag)
printf ("Reaping %s child 0x%08lx PID %ld%s\n",
child_failed ? "losing" : "winning",
(unsigned long int) c,
(long) c->pid, c->remote ? " (remote)" : "");
{
if (child_failed)
{
/* The commands failed, but we don't care. */
child_error (c->file->name,
exit_code, exit_sig, coredump, 1);
child_failed = 0;
}
if (c->sh_batch_file) {
if (debug_flag)
printf("Cleaning up temp batch file %s\n", c->sh_batch_file);
/* If there are more commands to run, try to start them. */
if (job_next_command (c))
{
if (handling_fatal_signal)
{
/* Never start new commands while we are dying.
Since there are more commands that wanted to be run,
the target was not completely remade. So we treat
this as if a command had failed. */
c->file->update_status = 2;
}
else
{
/* Check again whether to start remotely.
Whether or not we want to changes over time.
Also, start_remote_job may need state set up
by start_remote_job_p. */
c->remote = start_remote_job_p (0);
start_job_command (c);
/* Fatal signals are left blocked in case we were
about to put that child on the chain. But it is
already there, so it is safe for a fatal signal to
arrive now; it will clean up this child's targets. */
unblock_sigs ();
if (c->file->command_state == cs_running)
/* We successfully started the new command.
Loop to reap more children. */
continue;
}
/* just try and remove, don't care if this fails */
remove(c->sh_batch_file);
if (c->file->update_status != 0)
/* We failed to start the commands. */
delete_child_targets (c);
}
else
/* There are no more commands. We got through them all
without an unignored error. Now the target has been
successfully updated. */
c->file->update_status = 0;
}
/* all done with memory */
free(c->sh_batch_file);
c->sh_batch_file = NULL;
}
/* When we get here, all the commands for C->file are finished
(or aborted) and C->file->update_status contains 0 or 2. But
C->file->command_state is still cs_running if all the commands
ran; notice_finish_file looks for cs_running to tell it that
it's interesting to check the file's modtime again now. */
/* If this child had the good stdin, say it is now free. */
if (c->good_stdin)
good_stdin_used = 0;
if (! handling_fatal_signal)
/* Notice if the target of the commands has been changed.
This also propagates its values for command_state and
update_status to its also_make files. */
notice_finished_file (c->file);
if (child_failed && !c->noerror && !ignore_errors_flag)
{
/* The commands failed. Write an error message,
delete non-precious targets, and abort. */
static int delete_on_error = -1;
child_error (c->file->name, exit_code, exit_sig, coredump, 0);
c->file->update_status = 2;
if (delete_on_error == -1)
{
struct file *f = lookup_file (".DELETE_ON_ERROR");
delete_on_error = f != 0 && f->is_target;
}
if (exit_sig != 0 || delete_on_error)
delete_child_targets (c);
}
else
{
if (child_failed)
{
/* The commands failed, but we don't care. */
child_error (c->file->name,
exit_code, exit_sig, coredump, 1);
child_failed = 0;
}
if (debug_flag)
printf (_("Removing child 0x%08lx PID %ld %s from chain.\n"),
(unsigned long int) c, (long) c->pid,
c->remote ? _(" (remote)") : "");
/* If there are more commands to run, try to start them. */
if (job_next_command (c))
{
if (handling_fatal_signal)
{
/* Never start new commands while we are dying.
Since there are more commands that wanted to be run,
the target was not completely remade. So we treat
this as if a command had failed. */
c->file->update_status = 2;
}
else
{
/* Check again whether to start remotely.
Whether or not we want to changes over time.
Also, start_remote_job may need state set up
by start_remote_job_p. */
c->remote = start_remote_job_p (0);
start_job_command (c);
/* Fatal signals are left blocked in case we were
about to put that child on the chain. But it is
already there, so it is safe for a fatal signal to
arrive now; it will clean up this child's targets. */
unblock_sigs ();
if (c->file->command_state == cs_running)
/* We successfully started the new command.
Loop to reap more children. */
continue;
}
/* Block fatal signals while frobnicating the list, so that
children and job_slots_used are always consistent. Otherwise
a fatal signal arriving after the child is off the chain and
before job_slots_used is decremented would believe a child was
live and call reap_children again. */
block_sigs ();
if (c->file->update_status != 0)
/* We failed to start the commands. */
delete_child_targets (c);
}
else
/* There are no more commands. We got through them all
without an unignored error. Now the target has been
successfully updated. */
c->file->update_status = 0;
}
/* There is now another slot open. */
if (job_slots_used > 0)
--job_slots_used;
/* When we get here, all the commands for C->file are finished
(or aborted) and C->file->update_status contains 0 or 2. But
C->file->command_state is still cs_running if all the commands
ran; notice_finish_file looks for cs_running to tell it that
it's interesting to check the file's modtime again now. */
/* Remove the child from the chain and free it. */
if (lastc == 0)
children = c->next;
else
lastc->next = c->next;
if (! handling_fatal_signal)
/* Notice if the target of the commands has been changed.
This also propagates its values for command_state and
update_status to its also_make files. */
notice_finished_file (c->file);
free_child (c);
if (debug_flag)
printf ("Removing child 0x%08lx PID %ld%s from chain.\n",
(unsigned long int) c,
(long) c->pid, c->remote ? " (remote)" : "");
unblock_sigs ();
/* Block fatal signals while frobnicating the list, so that
children and job_slots_used are always consistent. Otherwise
a fatal signal arriving after the child is off the chain and
before job_slots_used is decremented would believe a child was
live and call reap_children again. */
block_sigs ();
#ifdef MAKE_JOBSERVER
/* If this job has a token out, return it. */
if (c->job_token)
{
assert(job_slots_used > 0);
write (job_fds[1], &c->job_token, 1);
if (debug_flag)
printf ("Released token `%c' for child 0x%08lx.\n",
c->job_token, (unsigned long int) c);
c->job_token = 0;
}
#endif
/* There is now another slot open. */
if (job_slots_used > 0)
--job_slots_used;
/* Remove the child from the chain and free it. */
if (lastc == 0)
children = c->next;
else
lastc->next = c->next;
if (! handling_fatal_signal) /* Don't bother if about to die. */
free_child (c);
unblock_sigs ();
/* If the job failed, and the -k flag was not given, die,
unless we are already in the process of dying. */
if (!err && child_failed && !keep_going_flag &&
/* fatal_error_signal will die with the right signal. */
!handling_fatal_signal)
die (2);
}
/* If the job failed, and the -k flag was not given, die,
unless we are already in the process of dying. */
if (!err && child_failed && !keep_going_flag &&
/* fatal_error_signal will die with the right signal. */
!handling_fatal_signal)
die (2);
/* Only block for one child. */
block = 0;
}
return;
}
@@ -664,6 +680,28 @@ static void
free_child (child)
register struct child *child;
{
/* If this child is the only one it was our "free" job, so don't put a
token back for it. This child has already been removed from the list,
so if there any left this wasn't the last one. */
if (job_fds[1] >= 0 && children)
{
char token = '+';
/* Write a job token back to the pipe. */
while (write (job_fds[1], &token, 1) != 1)
if (!EINTR_SET)
pfatal_with_name (_("write jobserver"));
if (debug_flag)
printf (_("Released token for child 0x%08lx (%s).\n"),
(unsigned long int) child, child->file->name);
}
if (handling_fatal_signal) /* Don't bother free'ing if about to die. */
return;
if (child->command_lines != 0)
{
register unsigned int i;
@@ -680,19 +718,6 @@ free_child (child)
free ((char *) child->environment);
}
#ifdef MAKE_JOBSERVER
/* If this child has a token it hasn't relinquished, give it up now.
This can happen if the job completes immediately, mainly because
all the command lines evaluated to empty strings. */
if (child->job_token)
{
write (job_fds[1], &child->job_token, 1);
if (debug_flag)
printf ("Freed token `%c' for child 0x%08lx.\n",
child->job_token, (unsigned long int) child);
}
#endif
free ((char *) child);
}
@@ -764,7 +789,7 @@ start_job_command (child)
flags |= COMMANDS_RECURSE;
else if (*p == '-')
child->noerror = 1;
else if (!isblank (*p) && *p != '+')
else if (!isblank (*p))
break;
++p;
}
@@ -840,17 +865,18 @@ start_job_command (child)
? "%s" : (char *) 0, p);
/* Optimize an empty command. People use this for timestamp rules,
and forking a useless shell all the time leads to inefficiency. */
so avoid forking a useless shell. */
#if !defined(VMS) && !defined(_AMIGA)
if (
#ifdef __MSDOS__
unixy_shell /* the test is complicated and we already did it */
#else
(argv[0] && !strcmp(argv[0], "/bin/sh"))
(argv[0] && !strcmp (argv[0], "/bin/sh"))
#endif
&& (argv[1] && !strcmp(argv[1], "-c"))
&& (argv[2] && !strcmp(argv[2], ":"))
&& (argv[1]
&& argv[1][0] == '-' && argv[1][1] == 'c' && argv[1][2] == '\0')
&& (argv[2] && argv[2][0] == ':' && argv[2][1] == '\0')
&& argv[3] == NULL)
{
free (argv[0]);
@@ -904,12 +930,7 @@ start_job_command (child)
/* Set the descriptor to close on exec, so it does not litter any
child's descriptor table. When it is dup2'd onto descriptor 0,
that descriptor will not close on exec. */
#ifdef F_SETFD
#ifndef FD_CLOEXEC
#define FD_CLOEXEC 1
#endif
(void) fcntl (bad_stdin, F_SETFD, FD_CLOEXEC);
#endif
CLOSE_ON_EXEC (bad_stdin);
}
}
@@ -986,6 +1007,17 @@ start_job_command (child)
{
/* We are the child side. */
unblock_sigs ();
/* If we aren't running a recursive command and we have a jobserver
pipe, close it before exec'ing. */
if (!(flags & COMMANDS_RECURSE) && job_fds[0] >= 0)
{
close (job_fds[0]);
close (job_fds[1]);
}
if (job_rfd >= 0)
close (job_rfd);
child_execute_job (child->good_stdin ? 0 : bad_stdin, 1,
argv, child->environment);
}
@@ -1090,11 +1122,11 @@ start_job_command (child)
int i;
unblock_sigs();
fprintf(stderr,
"process_easy() failed failed to launch process (e=%d)\n",
_("process_easy() failed failed to launch process (e=%d)\n"),
process_last_err(hPID));
for (i = 0; argv[i]; i++)
fprintf(stderr, "%s ", argv[i]);
fprintf(stderr, "\nCounted %d args in failed launch\n", i);
fprintf(stderr, _("\nCounted %d args in failed launch\n"), i);
}
}
#endif /* WINDOWS32 */
@@ -1135,64 +1167,16 @@ start_waiting_job (c)
c->remote = start_remote_job_p (1);
/* If not, start it locally. */
if (!c->remote)
/* If we are running at least one job already and the load average
is too high, make this one wait. */
if (!c->remote && job_slots_used > 0 && load_too_high ())
{
#ifdef MAKE_JOBSERVER
/* If this is not a recurse command and we are controlling
multiple jobs, and we don't yet have one, obtain a token before
starting child. */
if (job_fds[0] >= 0 && !f->cmds->any_recurse && !c->job_token)
{
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(job_fds[0], &rfds);
/* Read a token. We set the non-blocking bit on this earlier,
so if there's no token to be read we'll fall through to the
select. The select blocks until (a) there's data to read,
in which case we come back around and try to grab the token
before someone else does, or (b) a signal, such as SIGCHLD,
is caught (because we installed a handler for it). If the
latter, call reap_children() to try to free up some slots. */
while (read (job_fds[0], &c->job_token, 1) < 1)
{
int r = select (job_fds[0]+1, SELECT_FD_SET_CAST &rfds,
NULL, NULL, NULL);
if (r < 0)
{
#ifdef EINTR
if (errno != EINTR)
/* We should definitely handle this more gracefully!
What kinds of things can happen here? ^C closes the
pipe? Something else closes it? */
pfatal_with_name ("read jobs pipe");
#endif
/* We were interrupted; handle any dead children. */
reap_children (1, 0);
}
}
assert(c->job_token != 0);
if (debug_flag)
printf ("Obtained token `%c' for child 0x%08lx.\n",
c->job_token, (unsigned long int) c);
}
#endif
/* If we are running at least one job already and the load average
is too high, make this one wait. */
if (job_slots_used > 0 && load_too_high ())
{
/* Put this child on the chain of children waiting
for the load average to go down. */
set_command_state (f, cs_running);
c->next = waiting_jobs;
waiting_jobs = c;
return 0;
}
/* Put this child on the chain of children waiting for the load average
to go down. */
set_command_state (f, cs_running);
c->next = waiting_jobs;
waiting_jobs = c;
return 0;
}
/* Start the first command; reap_children will run later command lines. */
@@ -1203,9 +1187,9 @@ start_waiting_job (c)
case cs_running:
c->next = children;
if (debug_flag)
printf ("Putting child 0x%08lx PID %ld%s on the chain.\n",
(unsigned long int) c,
(long) c->pid, c->remote ? " (remote)" : "");
printf (_("Putting child 0x%08lx (%s) PID %ld%s on the chain.\n"),
(unsigned long int) c, c->file->name,
(long) c->pid, c->remote ? _(" (remote)") : "");
children = c;
/* One more job slot is in use. */
++job_slots_used;
@@ -1251,12 +1235,6 @@ new_job (file)
/* Chop the commands up into lines if they aren't already. */
chop_commands (cmds);
/* Wait for a job slot to be freed up. If we allow an infinite number
don't bother; also job_slots will == 0 if we're using the job pipe. */
if (job_slots != 0)
while (job_slots_used == job_slots)
reap_children (1, 0);
/* Expand the command lines and store the results in LINES. */
lines = (char **) xmalloc (cmds->ncommand_lines * sizeof (char *));
for (i = 0; i < cmds->ncommand_lines; ++i)
@@ -1368,14 +1346,69 @@ new_job (file)
c->command_ptr = 0;
c->environment = 0;
c->sh_batch_file = NULL;
c->job_token = 0;
/* Fetch the first command line to be run. */
job_next_command (c);
/* Wait for a job slot to be freed up. If we allow an infinite number
don't bother; also job_slots will == 0 if we're using the jobserver. */
if (job_slots != 0)
while (job_slots_used == job_slots)
reap_children (1, 0);
#ifdef MAKE_JOBSERVER
/* If we are controlling multiple jobs make sure we have a token before
starting the child. */
/* This can be inefficient. There's a decent chance that this job won't
actually have to run any subprocesses: the command script may be empty
or otherwise optimized away. It would be nice if we could defer
obtaining a token until just before we need it, in start_job_command.
To do that we'd need to keep track of whether we'd already obtained a
token (since start_job_command is called for each line of the job, not
just once). Also more thought needs to go into the entire algorithm;
this is where the old parallel job code waits, so... */
else if (job_fds[0] >= 0)
while (1)
{
char token;
/* If we don't already have a job started, use our "free" token. */
if (!children)
break;
/* Read a token. As long as there's no token available we'll block.
If we get a SIGCHLD we'll return with EINTR. If one happened
before we got here we'll return immediately with EBADF because
the signal handler closes the dup'd file descriptor. */
if (read (job_rfd, &token, 1) == 1)
{
if (debug_flag)
printf (_("Obtained token for child 0x%08lx (%s).\n"),
(unsigned long int) c, c->file->name);
break;
}
if (errno != EINTR && errno != EBADF)
pfatal_with_name (_("read jobs pipe"));
/* Re-dup the read side of the pipe, so the signal handler can
notify us if we miss a child. */
if (job_rfd < 0)
job_rfd = dup (job_fds[0]);
/* Something's done. We don't want to block for a whole child,
just reap whatever's there. */
reap_children (0, 0);
}
#endif
/* The job is now primed. Start it running.
(This will notice if there are in fact no commands.) */
(void)start_waiting_job (c);
(void) start_waiting_job (c);
if (job_slots == 1)
/* Since there is only one job slot, make things run linearly.
@@ -1429,9 +1462,9 @@ load_too_high ()
{
if (errno == 0)
/* An errno value of zero means getloadavg is just unsupported. */
error (NILF, "cannot enforce load limits on this operating system");
error (NILF, _("cannot enforce load limits on this operating system"));
else
perror_with_name ("cannot enforce load limit: ", "getloadavg");
perror_with_name (_("cannot enforce load limit: "), "getloadavg");
}
lossage = errno;
load = 0;
@@ -1534,7 +1567,7 @@ int vmsHandleChildTerm(struct child *child)
break;
default:
error (NILF, "internal error: `%s' command_state", c->file->name);
error (NILF, _("internal error: `%s' command_state"), c->file->name);
abort ();
break;
}
@@ -1640,7 +1673,7 @@ child_execute_job (argv, child)
sprintf (cmd, "$ @%s", comname);
if (debug_flag)
printf ("Executing %s instead\n", cmd);
printf (_("Executing %s instead\n"), cmd);
}
cmddsc.dsc$w_length = strlen(cmd);
@@ -1671,7 +1704,7 @@ child_execute_job (argv, child)
if (!(status & 1))
{
printf("Error spawning, %d\n",status);
printf(_("Error spawning, %d\n"),status);
fflush(stdout);
}
@@ -1740,11 +1773,11 @@ exec_command (argv, envp)
{
int i;
fprintf(stderr,
"process_easy() failed failed to launch process (e=%d)\n",
_("process_easy() failed failed to launch process (e=%d)\n"),
process_last_err(hPID));
for (i = 0; argv[i]; i++)
fprintf(stderr, "%s ", argv[i]);
fprintf(stderr, "\nCounted %d args in failed launch\n", i);
fprintf(stderr, _("\nCounted %d args in failed launch\n"), i);
exit(EXIT_FAILURE);
}
@@ -1769,7 +1802,7 @@ exec_command (argv, envp)
break;
else
fprintf(stderr,
"make reaped child pid %d, still waiting for pid %d\n",
_("make reaped child pid %d, still waiting for pid %d\n"),
hWaitPID, hPID);
}
@@ -1788,7 +1821,7 @@ exec_command (argv, envp)
switch (errno)
{
case ENOENT:
error (NILF, "%s: Command not found", argv[0]);
error (NILF, _("%s: Command not found"), argv[0]);
break;
case ENOEXEC:
{
@@ -1817,7 +1850,7 @@ exec_command (argv, envp)
execvp (shell, new_argv);
if (errno == ENOENT)
error (NILF, "%s: Shell program not found", shell);
error (NILF, _("%s: Shell program not found"), shell);
else
perror_with_name ("execvp: ", shell);
break;
@@ -1899,11 +1932,12 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
"vol", ":", 0 };
static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^";
static char *sh_cmds_sh[] = { "cd", "eval", "exec", "exit", "login",
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", 0 };
"shift", "times", "trap", "switch", "unset",
0 };
char *sh_chars;
char **sh_cmds;
@@ -1997,7 +2031,7 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
{
extern int _is_unixy_shell (const char *_path);
message (1, "$SHELL changed (was `%s', now `%s')", default_shell, shell);
message (1, _("$SHELL changed (was `%s', now `%s')"), default_shell, shell);
unixy_shell = _is_unixy_shell (shell);
default_shell = shell;
}
@@ -2108,7 +2142,7 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
/* Note these overlap and strcpy() is undefined for
overlapping objects in ANSI C. The strlen() _IS_ right,
since we need to copy the nul byte too. */
bcopy (p + 1, p, strlen(p));
bcopy (p + 1, p, strlen (p));
if (instring)
goto string_char;
@@ -2276,7 +2310,7 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
}
*dptr = 0;
new_argv = (char **) xmalloc(2 * sizeof(char *));
new_argv = (char **) xmalloc (2 * sizeof (char *));
new_argv[0] = buffer;
new_argv[1] = 0;
}
@@ -2399,7 +2433,7 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
}
if (debug_flag)
printf("Creating temporary batch file %s\n", *batch_filename_ptr);
printf(_("Creating temporary batch file %s\n"), *batch_filename_ptr);
/* create batch file to execute command */
batch = fopen (*batch_filename_ptr, "w");
@@ -2440,7 +2474,7 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
}
#else
else
fatal (NILF, "%s (line %d) Bad shell context (!unixy && !batch_mode_shell)\n",
fatal (NILF, _("%s (line %d) Bad shell context (!unixy && !batch_mode_shell)\n"),
__FILE__, __LINE__);
#endif
}

1
job.h
View File

@@ -46,7 +46,6 @@ struct child
unsigned int good_stdin:1; /* Nonzero if this child has a good stdin. */
unsigned int deleted:1; /* Nonzero if targets have been deleted. */
char job_token; /* The token read from the job pipe. */
};
extern struct child *children;

450
main.c
View File

@@ -79,14 +79,13 @@ static char *quote_as_word PARAMS ((char *out, char *in, int double_dollars));
struct command_switch
{
char c; /* The switch character. */
int c; /* The switch character. */
enum /* Type of the value. */
{
flag, /* Turn int flag on. */
flag_off, /* Turn int flag off. */
string, /* One string per switch. */
int_string, /* One string. */
positive_int, /* A positive integer. */
floating, /* A floating-point number (double). */
ignore /* Ignored. */
@@ -104,8 +103,12 @@ struct command_switch
char *long_name; /* Long option name. */
char *argdesc; /* Descriptive word for argument. */
char *description; /* Description for usage message. */
/* 0 means internal; don't display help. */
};
/* True if C is a switch value that corresponds to a short option. */
#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. */
@@ -195,16 +198,16 @@ static struct stringlist *makefiles = 0;
unsigned int job_slots = 1;
unsigned int default_job_slots = 1;
static char *job_slots_str = "1";
#ifndef MAKE_JOBSERVER
/* Value of job_slots that means no limit. */
static unsigned int inf_jobs = 0;
#endif
/* File descriptors for the jobs pipe. */
static struct stringlist *jobserver_fds = 0;
int job_fds[2] = { -1, -1 };
int job_rfd = -1;
/* Maximum load average at which multiple jobs will be run.
Negative values mean unlimited, while zero means limit to
@@ -249,103 +252,102 @@ static const struct command_switch switches[] =
{
{ 'b', ignore, 0, 0, 0, 0, 0, 0,
0, 0,
"Ignored for compatibility" },
_("Ignored for compatibility") },
{ 'C', string, (char *) &directories, 0, 0, 0, 0, 0,
"directory", "DIRECTORY",
"Change to DIRECTORY before doing anything" },
"directory", _("DIRECTORY"),
_("Change to DIRECTORY before doing anything") },
{ 'd', flag, (char *) &debug_flag, 1, 1, 0, 0, 0,
"debug", 0,
"Print lots of debugging information" },
_("Print lots of debugging information") },
#ifdef WINDOWS32
{ 'D', flag, (char *) &suspend_flag, 1, 1, 0, 0, 0,
"suspend-for-debug", 0,
"Suspend process to allow a debugger to attach" },
_("Suspend process to allow a debugger to attach") },
#endif
{ 'e', flag, (char *) &env_overrides, 1, 1, 0, 0, 0,
"environment-overrides", 0,
"Environment variables override makefiles" },
_("Environment variables override makefiles") },
{ 'f', string, (char *) &makefiles, 0, 0, 0, 0, 0,
"file", "FILE",
"Read FILE as a makefile" },
"file", _("FILE"),
_("Read FILE as a makefile") },
{ 'h', flag, (char *) &print_usage_flag, 0, 0, 0, 0, 0,
"help", 0,
"Print this message and exit" },
_("Print this message and exit") },
{ 'i', flag, (char *) &ignore_errors_flag, 1, 1, 0, 0, 0,
"ignore-errors", 0,
"Ignore errors from commands" },
_("Ignore errors from commands") },
{ 'I', string, (char *) &include_directories, 1, 1, 0, 0, 0,
"include-dir", "DIRECTORY",
"Search DIRECTORY for included makefiles" },
"include-dir", _("DIRECTORY"),
_("Search DIRECTORY for included makefiles") },
{ 'j',
#ifndef MAKE_JOBSERVER
positive_int, (char *) &job_slots, 1, 1, 0,
(char *) &inf_jobs, (char *) &default_job_slots,
#else
int_string, (char *)&job_slots_str, 1, 1, 0, "0", "1",
#endif
"jobs", "N",
"Allow N jobs at once; infinite jobs with no arg" },
_("Allow N jobs at once; infinite jobs with no arg") },
{ CHAR_MAX+1, string, (char *) &jobserver_fds, 1, 1, 0, 0, 0,
"jobserver-fds", 0,
0 },
{ 'k', flag, (char *) &keep_going_flag, 1, 1, 0,
0, (char *) &default_keep_going_flag,
"keep-going", 0,
"Keep going when some targets can't be made" },
_("Keep going when some targets can't be made") },
#ifndef NO_FLOAT
{ 'l', floating, (char *) &max_load_average, 1, 1, 0,
(char *) &default_load_average, (char *) &default_load_average,
"load-average", "N",
"Don't start multiple jobs unless load is below N" },
_("Don't start multiple jobs unless load is below N") },
#else
{ 'l', positive_int, (char *) &max_load_average, 1, 1, 0,
(char *) &default_load_average, (char *) &default_load_average,
"load-average", "N",
"Don't start multiple jobs unless load is below N" },
_("Don't start multiple jobs unless load is below N") },
#endif
{ 'm', ignore, 0, 0, 0, 0, 0, 0,
0, 0,
"-b" },
{ 'n', flag, (char *) &just_print_flag, 1, 1, 1, 0, 0,
"just-print", 0,
"Don't actually run any commands; just print them" },
_("Don't actually run any commands; just print them") },
{ 'o', string, (char *) &old_files, 0, 0, 0, 0, 0,
"old-file", "FILE",
"Consider FILE to be very old and don't remake it" },
"old-file", _("FILE"),
_("Consider FILE to be very old and don't remake it") },
{ 'p', flag, (char *) &print_data_base_flag, 1, 1, 0, 0, 0,
"print-data-base", 0,
"Print make's internal database" },
_("Print make's internal database") },
{ 'q', flag, (char *) &question_flag, 1, 1, 1, 0, 0,
"question", 0,
"Run no commands; exit status says if up to date" },
_("Run no commands; exit status says if up to date") },
{ 'r', flag, (char *) &no_builtin_rules_flag, 1, 1, 0, 0, 0,
"no-builtin-rules", 0,
"Disable the built-in implicit rules" },
_("Disable the built-in implicit rules") },
{ 'R', flag, (char *) &no_builtin_variables_flag, 1, 1, 0, 0, 0,
"no-builtin-variables", 0,
"Disable the built-in variable settings" },
_("Disable the built-in variable settings") },
{ 's', flag, (char *) &silent_flag, 1, 1, 0, 0, 0,
"silent", 0,
"Don't echo commands" },
_("Don't echo commands") },
{ 'S', flag_off, (char *) &keep_going_flag, 1, 1, 0,
0, (char *) &default_keep_going_flag,
"no-keep-going", 0,
"Turns off -k" },
_("Turns off -k") },
{ 't', flag, (char *) &touch_flag, 1, 1, 1, 0, 0,
"touch", 0,
"Touch targets instead of remaking them" },
_("Touch targets instead of remaking them") },
{ 'v', flag, (char *) &print_version_flag, 1, 1, 0, 0, 0,
"version", 0,
"Print the version number of make and exit" },
_("Print the version number of make and exit") },
{ 'w', flag, (char *) &print_directory_flag, 1, 1, 0, 0, 0,
"print-directory", 0,
"Print the current directory" },
{ 2, flag, (char *) &inhibit_print_directory_flag, 1, 1, 0, 0, 0,
_("Print the current directory") },
{ CHAR_MAX+2, flag, (char *) &inhibit_print_directory_flag, 1, 1, 0, 0, 0,
"no-print-directory", 0,
"Turn off -w, even if it was turned on implicitly" },
_("Turn off -w, even if it was turned on implicitly") },
{ 'W', string, (char *) &new_files, 0, 0, 0, 0, 0,
"what-if", "FILE",
"Consider FILE to be infinitely new" },
{ 3, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
"what-if", _("FILE"),
_("Consider FILE to be infinitely new") },
{ CHAR_MAX+3, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
"warn-undefined-variables", 0,
"Warn when an undefined variable is referenced" },
_("Warn when an undefined variable is referenced") },
{ '\0', }
};
@@ -438,7 +440,7 @@ enter_command_line_file (name)
char *name;
{
if (name[0] == '\0')
fatal (NILF, "empty string invalid as file name");
fatal (NILF, _("empty string invalid as file name"));
if (name[0] == '~')
{
@@ -504,7 +506,7 @@ handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo )
if (!debug_flag)
{
sprintf(errmsg, "%s: Interrupt/Exception caught ", prg);
sprintf(errmsg, _("%s: Interrupt/Exception caught "), prg);
sprintf(&errmsg[strlen(errmsg)],
"(code = 0x%x, addr = 0x%x)\r\n",
exrec->ExceptionCode, exrec->ExceptionAddress);
@@ -513,7 +515,7 @@ handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo )
}
sprintf(errmsg,
"\r\nUnhandled exception filter called from program %s\r\n", prg);
_("\r\nUnhandled exception filter called from program %s\r\n"), prg);
sprintf(&errmsg[strlen(errmsg)], "ExceptionCode = %x\r\n",
exrec->ExceptionCode);
sprintf(&errmsg[strlen(errmsg)], "ExceptionFlags = %x\r\n",
@@ -524,8 +526,8 @@ handle_runtime_exceptions( struct _EXCEPTION_POINTERS *exinfo )
if (exrec->ExceptionCode == EXCEPTION_ACCESS_VIOLATION
&& exrec->NumberParameters >= 2)
sprintf(&errmsg[strlen(errmsg)],
"Access violation: %s operation at address %x\r\n",
exrec->ExceptionInformation[0] ? "write": "read",
_("Access violation: %s operation at address %x\r\n"),
exrec->ExceptionInformation[0] ? _("write"): _("read"),
exrec->ExceptionInformation[1]);
/* turn this on if we want to put stuff in the event log too */
@@ -590,7 +592,7 @@ find_and_set_default_shell(char *token)
sprintf(sh_path, "%s", search_token);
default_shell = xstrdup(w32ify(sh_path,0));
if (debug_flag)
printf("find_and_set_shell setting default_shell = %s\n", default_shell);
printf(_("find_and_set_shell setting default_shell = %s\n"), default_shell);
sh_found = 1;
} else {
char *p;
@@ -632,7 +634,7 @@ find_and_set_default_shell(char *token)
}
if (debug_flag && sh_found)
printf("find_and_set_shell path search set default_shell = %s\n", default_shell);
printf(_("find_and_set_shell path search set default_shell = %s\n"), default_shell);
}
}
@@ -929,9 +931,9 @@ int main (int argc, char ** argv)
#ifdef WINDOWS32
if (suspend_flag) {
fprintf(stderr, "%s (pid = %d)\n", argv[0], GetCurrentProcessId());
fprintf(stderr, "%s is suspending for 30 seconds...", argv[0]);
fprintf(stderr, _("%s is suspending for 30 seconds..."), argv[0]);
Sleep(30 * 1000);
fprintf(stderr, "done sleep(30). Continuing.\n");
fprintf(stderr, _("done sleep(30). Continuing.\n"));
}
#endif
@@ -944,7 +946,7 @@ int main (int argc, char ** argv)
if (print_version_flag)
die (0);
#if !defined(__MSDOS__) && !defined(VMS)
#ifndef VMS
/* Set the "MAKE_COMMAND" variable to the name we were invoked with.
(If it is a relative pathname with a slash, prepend our directory name
so the result will run the same program regardless of the current dir.
@@ -962,9 +964,28 @@ int main (int argc, char ** argv)
strneq(argv[0], "//", 2))
argv[0] = xstrdup(w32ify(argv[0],1));
#else /* WINDOWS32 */
#ifdef __MSDOS__
if (strchr (argv[0], '\\'))
{
char *p;
argv[0] = xstrdup (argv[0]);
for (p = argv[0]; *p; p++)
if (*p == '\\')
*p = '/';
}
/* If argv[0] is not in absolute form, prepend the current
directory. This can happen when Make is invoked by another DJGPP
program that uses a non-absolute name. */
if (current_directory[0] != '\0'
&& argv[0] != 0
&& (argv[0][0] != '/' && (argv[0][0] == '\0' || argv[0][1] != ':')))
argv[0] = concat (current_directory, "/", argv[0]);
#else /* !__MSDOS__ */
if (current_directory[0] != '\0'
&& argv[0] != 0 && argv[0][0] != '/' && index (argv[0], '/') != 0)
argv[0] = concat (current_directory, "/", argv[0]);
#endif /* !__MSDOS__ */
#endif /* WINDOWS32 */
#endif
@@ -1130,17 +1151,17 @@ int main (int argc, char ** argv)
#endif
if (stdin_nm)
fatal (NILF, "Makefile from standard input specified twice.");
fatal (NILF, _("Makefile from standard input specified twice."));
outfile = fopen (name, "w");
if (outfile == 0)
pfatal_with_name ("fopen (temporary file)");
pfatal_with_name (_("fopen (temporary file)"));
while (!feof (stdin))
{
char buf[2048];
unsigned int n = fread (buf, 1, sizeof(buf), stdin);
unsigned int n = fread (buf, 1, sizeof (buf), stdin);
if (n > 0 && fwrite (buf, 1, n, outfile) != n)
pfatal_with_name ("fwrite (temporary file)");
pfatal_with_name (_("fwrite (temporary file)"));
}
(void) fclose (outfile);
@@ -1155,7 +1176,7 @@ int main (int argc, char ** argv)
}
/* Make sure the temporary file will not be remade. */
stdin_nm = savestring (name, sizeof(name) -1);
stdin_nm = savestring (name, sizeof (name) -1);
f = enter_file (stdin_nm);
f->updated = 1;
f->update_status = 0;
@@ -1168,23 +1189,41 @@ int main (int argc, char ** argv)
}
#if defined(MAKE_JOBSERVER) || !defined(HAVE_WAIT_NOHANG)
/* If we don't have a hanging wait we have to fall back to old, broken
/* Set up to handle children dying. This must be done before
reading in the makefiles so that `shell' function calls will work.
If we don't have a hanging wait we have to fall back to old, broken
functionality here and rely on the signal handler and counting
children.
Also, if we're using the jobs pipe we need a signal handler so that
SIGCHLD is not ignored; we need it to interrupt select(2) in
job.c:start_waiting_job() if we're waiting on the pipe for a token. */
If we're using the jobs pipe we need a signal handler so that
SIGCHLD is not ignored; we need it to interrupt the read(2) of the
jobserver pipe in job.c if we're waiting for a token.
If none of these are true, we don't need a signal handler at all. */
{
extern RETSIGTYPE child_handler PARAMS ((int sig));
/* Set up to handle children dying. This must be done before
reading in the makefiles so that `shell' function calls will work. */
# if defined HAVE_SIGACTION
struct sigaction sa;
bzero ((char *)&sa, sizeof (struct sigaction));
sa.sa_handler = child_handler;
# if defined SA_INTERRUPT
/* This is supposed to be the default, but what the heck... */
sa.sa_flags = SA_INTERRUPT;
# endif
# define HANDLESIG(s) sigaction (s, &sa, NULL)
# else
# define HANDLESIG(s) signal (s, child_handler)
# endif
/* OK, now actually install the handlers. */
# if defined SIGCHLD
(void) signal (SIGCHLD, child_handler);
(void) HANDLESIG (SIGCHLD);
# endif
# if defined SIGCLD && SIGCLD != SIGCHLD
(void) signal (SIGCLD, child_handler);
(void) HANDLESIG (SIGCLD);
# endif
}
#endif
@@ -1231,8 +1270,8 @@ int main (int argc, char ** argv)
no_default_sh_exe = !find_and_set_default_shell(NULL);
if (no_default_sh_exe && job_slots != 1) {
error (NILF, "Do not specify -j or --jobs if sh.exe is not available.");
error (NILF, "Resetting make for single job mode.");
error (NILF, _("Do not specify -j or --jobs if sh.exe is not available."));
error (NILF, _("Resetting make for single job mode."));
job_slots = 1;
}
#endif /* WINDOWS32 */
@@ -1241,7 +1280,7 @@ int main (int argc, char ** argv)
/* We need to know what kind of shell we will be using. */
{
extern int _is_unixy_shell (const char *_path);
struct variable *shv = lookup_variable("SHELL", 5);
struct variable *shv = lookup_variable ("SHELL", 5);
extern int unixy_shell;
extern char *default_shell;
@@ -1265,56 +1304,101 @@ int main (int argc, char ** argv)
decode_env_switches ("MFLAGS", 6);
#endif
#ifdef MAKE_JOBSERVER
/* If extended jobs are available then the -j option can have one of 4
formats: (1) not specified: default is "1"; (2) specified with no
value: default is "0" (infinite); (3) specified with a single
value: this means the user wants N job slots; or (4) specified with
2 values separated by commas. The latter means we're a submake and
the two values are the read and write FDs, respectively, for the
pipe. Note this last form is undocumented for the user!
*/
sscanf(job_slots_str, "%d", &job_slots);
{
char *cp = index(job_slots_str, ',');
#ifdef __MSDOS__
if (job_slots != 1)
{
error (NILF,
_("Parallel jobs (-j) are not supported on this platform."));
error (NILF, _("Resetting to single job (-j1) mode."));
job_slots = 1;
}
#endif
if (cp && sscanf(cp+1, "%d", &job_fds[1]) == 1)
#ifdef MAKE_JOBSERVER
/* If the jobserver-fds option is seen, make sure that -j is reasonable. */
if (jobserver_fds)
{
char *cp;
for (i=1; i < jobserver_fds->idx; ++i)
if (!streq (jobserver_fds->list[0], jobserver_fds->list[i]))
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];
if (sscanf (cp, "%d,%d", &job_fds[0], &job_fds[1]) != 2)
fatal (NILF,
_("internal error: invalid --jobserver-fds string `%s'"), cp);
/* The combination of a pipe + !job_slots means we're using the
jobserver. If !job_slots and we don't have a pipe, we can start
infinite jobs. If we see both a pipe and job_slots >0 that means the
user set -j explicitly. This is broken; in this case obey the user
(ignore the jobserver pipe for this make) but print a message. */
if (job_slots > 0)
error (NILF,
_("warning: -jN forced in submake: disabling jobserver mode."));
/* Create a duplicate pipe, that will be closed in the SIGCHLD
handler. If this fails with EBADF, the parent has closed the pipe
on us because it didn't think we were a submake. If so, print a
warning then default to -j1. */
else if ((job_rfd = dup (job_fds[0])) < 0)
{
job_fds[0] = job_slots;
job_slots = 0;
if (errno != EBADF)
pfatal_with_name (_("dup jobserver"));
error (NILF,
_("warning: jobserver unavailable: using -j1. Add `+' to parent make rule."));
job_slots = 1;
}
if (job_slots > 0)
{
close (job_fds[0]);
close (job_fds[1]);
job_fds[0] = job_fds[1] = -1;
free (jobserver_fds->list);
free (jobserver_fds);
jobserver_fds = 0;
}
}
/* In case #3 above, set up the pipe and set up the submake options
properly. */
/* If we have >1 slot but no jobserver-fds, then we're a top-level make.
Set up the pipe and install the fds option for our children. */
if (job_slots > 1)
{
char buf[(sizeof("1024")*2)+1];
char c = '0';
char c = '+';
if (pipe(job_fds) < 0)
pfatal_with_name("creating jobs pipe");
if (pipe (job_fds) < 0 || (job_rfd = dup (job_fds[0])) < 0)
pfatal_with_name (_("creating jobs pipe"));
/* Set the read FD to nonblocking; we'll use select() to wait
for it in job.c. */
fcntl (job_fds[0], F_SETFL, O_NONBLOCK);
/* Every make assumes that it always has one job it can run. For the
submakes it's the token they were given by their parent. For the
top make, we just subtract one from the number the user wants. We
want job_slots to be 0 to indicate we're using the jobserver. */
for (; job_slots; --job_slots)
{
write(job_fds[1], &c, 1);
if (c == '9')
c = 'a';
else if (c == 'z')
c = 'A';
else if (c == 'Z')
c = '0'; /* Start over again!! */
else
++c;
}
while (--job_slots)
while (write (job_fds[1], &c, 1) != 1)
if (!EINTR_SET)
pfatal_with_name (_("init jobserver pipe"));
sprintf(buf, "%d,%d", job_fds[0], job_fds[1]);
job_slots_str = xstrdup(buf);
/* Fill in the jobserver_fds struct for our children. */
jobserver_fds = (struct stringlist *)
xmalloc (sizeof (struct stringlist));
jobserver_fds->list = (char **) xmalloc (sizeof (char *));
jobserver_fds->list[0] = xmalloc ((sizeof ("1024")*2)+1);
sprintf (jobserver_fds->list[0], "%d,%d", job_fds[0], job_fds[1]);
jobserver_fds->idx = 1;
jobserver_fds->max = 1;
}
#endif
@@ -1385,7 +1469,7 @@ int main (int argc, char ** argv)
int nargc = argc;
if (debug_flag)
puts ("Updating makefiles....");
puts (_("Updating makefiles...."));
/* Remove any makefiles we don't want to try to update.
Also record the current modtimes so we can compare them later. */
@@ -1410,7 +1494,7 @@ int main (int argc, char ** argv)
you write your makefiles.) */
if (debug_flag)
printf ("Makefile `%s' might loop; not remaking it.\n",
printf (_("Makefile `%s' might loop; not remaking it.\n"),
f->name);
if (last == 0)
@@ -1484,7 +1568,7 @@ int main (int argc, char ** argv)
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'.",
error (NILF, _("Failed to remake makefile `%s'."),
d->file->name);
mtime = file_mtime_no_search (d->file);
any_remade |= (mtime != (FILE_TIMESTAMP) -1
@@ -1499,12 +1583,13 @@ int main (int argc, char ** argv)
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.",
error (NILF,
_("Included makefile `%s' was not found."),
dep_name (d));
else
{
/* A normal makefile. We must die later. */
error (NILF, "Makefile `%s' was not found",
error (NILF, _("Makefile `%s' was not found"),
dep_name (d));
any_failed = 1;
}
@@ -1550,9 +1635,9 @@ int main (int argc, char ** argv)
/* Add -o option for the stdin temporary file, if necessary. */
if (stdin_nm)
{
nargv = (char **)xmalloc((nargc + 2) * sizeof(char *));
bcopy((char *)argv, (char *)nargv, argc * sizeof(char *));
nargv[nargc++] = concat("-o", stdin_nm, "");
nargv = (char **) xmalloc ((nargc + 2) * sizeof (char *));
bcopy ((char *) argv, (char *) nargv, argc * sizeof (char *));
nargv[nargc++] = concat ("-o", stdin_nm, "");
nargv[nargc] = 0;
}
@@ -1572,7 +1657,7 @@ int main (int argc, char ** argv)
else
bad = 1;
if (bad)
fatal (NILF, "Couldn't change back to original directory.");
fatal (NILF, _("Couldn't change back to original directory."));
}
#ifndef _AMIGA
@@ -1606,7 +1691,7 @@ int main (int argc, char ** argv)
if (debug_flag)
{
char **p;
fputs ("Re-executing:", stdout);
fputs (_("Re-executing:"), stdout);
for (p = nargv; *p != 0; ++p)
printf (" %s", *p);
puts ("");
@@ -1615,6 +1700,10 @@ int main (int argc, char ** argv)
fflush (stdout);
fflush (stderr);
/* Close the dup'd jobserver pipe if we opened one. */
if (job_rfd >= 0)
close (job_rfd);
#ifndef _AMIGA
exec_command (nargv, environ);
#else
@@ -1630,8 +1719,8 @@ int main (int argc, char ** argv)
/* If there is a temp file from reading a makefile from stdin, get rid of
it now. */
if (stdin_nm && unlink(stdin_nm) < 0 && errno != ENOENT)
perror_with_name("unlink (temporary file): ", stdin_nm);
if (stdin_nm && unlink (stdin_nm) < 0 && errno != ENOENT)
perror_with_name (_("unlink (temporary file): "), stdin_nm);
{
int status;
@@ -1653,15 +1742,15 @@ int main (int argc, char ** argv)
if (!goals)
{
if (read_makefiles == 0)
fatal (NILF, "No targets specified and no makefile found");
fatal (NILF, _("No targets specified and no makefile found"));
fatal (NILF, "No targets");
fatal (NILF, _("No targets"));
}
/* Update the goals. */
if (debug_flag)
puts ("Updating goal targets....");
puts (_("Updating goal targets...."));
switch (update_goal_chain (goals, 0))
{
@@ -1686,7 +1775,7 @@ int main (int argc, char ** argv)
/* 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.");
error (NILF, _("*** Warning: Clock skew detected. Your build may be incomplete."));
/* Exit. */
die (status);
@@ -1726,7 +1815,7 @@ init_switches ()
switches[i].long_name);
long_options[i].flag = 0;
long_options[i].val = switches[i].c;
if (isalnum (switches[i].c))
if (short_option (switches[i].c))
*p++ = switches[i].c;
switch (switches[i].type)
{
@@ -1736,15 +1825,14 @@ init_switches ()
long_options[i].has_arg = no_argument;
break;
case int_string:
case string:
case positive_int:
case floating:
if (isalnum (switches[i].c))
if (short_option (switches[i].c))
*p++ = ':';
if (switches[i].noarg_value != 0)
{
if (isalnum (switches[i].c))
if (short_option (switches[i].c))
*p++ = ':';
long_options[i].has_arg = optional_argument;
}
@@ -1797,8 +1885,7 @@ handle_non_switch_argument (arg, env)
}
else
{
lastgoal->next
= (struct dep *) xmalloc (sizeof (struct dep));
lastgoal->next = (struct dep *) xmalloc (sizeof (struct dep));
lastgoal = lastgoal->next;
}
lastgoal->name = 0;
@@ -1809,7 +1896,7 @@ handle_non_switch_argument (arg, env)
struct variable *v;
char *value;
v = lookup_variable("MAKECMDGOALS", 12);
v = lookup_variable ("MAKECMDGOALS", 12);
if (v == 0)
value = f->name;
else
@@ -1817,14 +1904,14 @@ handle_non_switch_argument (arg, env)
/* Paste the old and new values together */
unsigned int oldlen, newlen;
oldlen = strlen(v->value);
newlen = strlen(f->name);
value = (char *)alloca(oldlen + 1 + newlen + 1);
bcopy(v->value, value, oldlen);
oldlen = strlen (v->value);
newlen = strlen (f->name);
value = (char *) alloca (oldlen + 1 + newlen + 1);
bcopy (v->value, value, oldlen);
value[oldlen] = ' ';
bcopy(f->name, &value[oldlen + 1], newlen + 1);
bcopy (f->name, &value[oldlen + 1], newlen + 1);
}
define_variable("MAKECMDGOALS", 12, value, o_default, 0);
define_variable ("MAKECMDGOALS", 12, value, o_default, 0);
}
}
}
@@ -1843,14 +1930,14 @@ print_usage (bad)
usageto = bad ? stderr : stdout;
fprintf (usageto, "Usage: %s [options] [target] ...\n", program);
fprintf (usageto, _("Usage: %s [options] [target] ...\n"), program);
fputs ("Options:\n", usageto);
fputs (_("Options:\n"), usageto);
for (cs = switches; cs->c != '\0'; ++cs)
{
char buf[1024], shortarg[50], longarg[50], *p;
if (cs->description[0] == '-')
if (!cs->description || cs->description[0] == '-')
continue;
switch (long_options[cs - switches].has_arg)
@@ -1870,7 +1957,7 @@ print_usage (bad)
p = buf;
if (isalnum (cs->c))
if (short_option (cs->c))
{
sprintf (buf, " -%c%s", cs->c, shortarg);
p += strlen (p);
@@ -1879,7 +1966,7 @@ print_usage (bad)
{
unsigned int i;
sprintf (p, "%s--%s%s",
!isalnum (cs->c) ? " " : ", ",
!short_option (cs->c) ? " " : ", ",
cs->long_name, longarg);
p += strlen (p);
for (i = 0; i < (sizeof (long_option_aliases) /
@@ -1895,8 +1982,9 @@ print_usage (bad)
{
const struct command_switch *ncs = cs;
while ((++ncs)->c != '\0')
if (ncs->description[0] == '-' &&
ncs->description[1] == cs->c)
if (ncs->description
&& ncs->description[0] == '-'
&& ncs->description[1] == cs->c)
{
/* This is another switch that does the same
one as the one we are processing. We want
@@ -1990,20 +2078,6 @@ decode_switches (argc, argv, env)
*(int *) cs->value_ptr = cs->type == flag;
break;
case int_string:
if (optarg == 0 && argc > optind
&& isdigit (argv[optind][0]))
optarg = argv[optind++];
if (!doit)
break;
if (optarg == 0)
optarg = cs->noarg_value;
*(char **)cs->value_ptr = optarg;
break;
case string:
if (!doit)
break;
@@ -2034,7 +2108,7 @@ decode_switches (argc, argv, env)
case positive_int:
if (optarg == 0 && argc > optind
&& isdigit (argv[optind][0]))
&& ISDIGIT (argv[optind][0]))
optarg = argv[optind++];
if (!doit)
@@ -2046,8 +2120,7 @@ decode_switches (argc, argv, env)
if (i < 1)
{
if (doit)
error (NILF, "the `-%c' option requires a \
positive integral argument",
error (NILF, _("the `-%c' option requires a positive integral argument"),
cs->c);
bad = 1;
}
@@ -2062,7 +2135,7 @@ positive integral argument",
#ifndef NO_FLOAT
case floating:
if (optarg == 0 && optind < argc
&& (isdigit (argv[optind][0]) || argv[optind][0] == '.'))
&& (ISDIGIT (argv[optind][0]) || argv[optind][0] == '.'))
optarg = argv[optind++];
if (doit)
@@ -2089,7 +2162,7 @@ positive integral argument",
if (!env && (bad || print_usage_flag))
{
print_usage(bad);
print_usage (bad);
die (bad ? 2 : 0);
}
}
@@ -2234,7 +2307,7 @@ define_makeflags (all, makefile)
++flagslen; /* Just a single flag letter. */ \
else \
flagslen += 1 + 1 + 1 + 1 + 3 * (LEN); /* " -x foo" */ \
if (!isalnum (cs->c)) \
if (!short_option (cs->c)) \
/* This switch has no single-letter version, so we use the long. */ \
flagslen += 2 + strlen (cs->long_name); \
} while (0)
@@ -2302,22 +2375,6 @@ define_makeflags (all, makefile)
break;
#endif
case int_string:
if (all)
{
char *vp = *(char **)cs->value_ptr;
if (cs->default_value != 0
&& streq(vp, cs->default_value))
break;
if (cs->noarg_value != 0
&& streq(vp, cs->noarg_value))
ADD_FLAG("", 0); /* Optional value omitted; see below. */
else
ADD_FLAG(vp, strlen(vp));
}
break;
case string:
if (all)
{
@@ -2342,20 +2399,26 @@ define_makeflags (all, makefile)
/* Construct the value in FLAGSTRING.
We allocate enough space for a preceding dash and trailing null. */
flagstring = (char *) alloca (1 + flagslen + 1);
bzero (flagstring, 1 + flagslen + 1);
p = flagstring;
words = 1;
*p++ = '-';
while (flags != 0)
{
/* Add the flag letter or name to the string. */
if (!isalnum (flags->cs->c))
if (short_option (flags->cs->c))
*p++ = flags->cs->c;
else
{
if (*p != '-')
{
*p++ = ' ';
*p++ = '-';
}
*p++ = '-';
strcpy (p, flags->cs->long_name);
p += strlen (p);
}
else
*p++ = flags->cs->c;
if (flags->arg != 0)
{
/* A flag that takes an optional argument which in this case is
@@ -2365,7 +2428,7 @@ define_makeflags (all, makefile)
if (flags->arg[0] != '\0')
{
/* Add its argument too. */
*p++ = !isalnum (flags->cs->c) ? '=' : ' ';
*p++ = !short_option (flags->cs->c) ? '=' : ' ';
p = quote_as_word (p, flags->arg, 1);
}
++words;
@@ -2373,7 +2436,7 @@ define_makeflags (all, makefile)
*p++ = ' ';
*p++ = '-';
}
else if (!isalnum (flags->cs->c))
else if (!short_option (flags->cs->c))
{
++words;
/* Long options must each go in their own word,
@@ -2474,6 +2537,7 @@ define_makeflags (all, makefile)
static void
print_version ()
{
extern char *make_host;
static int printed_version = 0;
char *precede = print_data_base_flag ? "# " : "";
@@ -2486,13 +2550,15 @@ print_version ()
if (remote_description != 0 && *remote_description != '\0')
printf ("-%s", remote_description);
printf (", by Richard Stallman and Roland McGrath.\n\
printf (_(", by Richard Stallman and Roland McGrath.\n\
%sBuilt for %s\n\
%sCopyright (C) 1988, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99\n\
%s\tFree Software Foundation, Inc.\n\
%sThis is free software; see the source for copying conditions.\n\
%sThere is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
%sPARTICULAR PURPOSE.\n\n\
%sReport bugs to <bug-make@gnu.org>.\n\n",
%sReport bugs to <bug-make@gnu.org>.\n\n"),
precede, make_host,
precede, precede, precede, precede, precede, precede);
printed_version = 1;
@@ -2510,7 +2576,7 @@ print_data_base ()
time_t when;
when = time ((time_t *) 0);
printf ("\n# Make data base, printed on %s", ctime (&when));
printf (_("\n# Make data base, printed on %s"), ctime (&when));
print_variable_data_base ();
print_dir_data_base ();
@@ -2519,7 +2585,7 @@ print_data_base ()
print_vpath_data_base ();
when = time ((time_t *) 0);
printf ("\n# Finished Make data base on %s\n", ctime (&when));
printf (_("\n# Finished Make data base on %s\n"), ctime (&when));
}
/* Exit with STATUS, cleaning up as necessary. */
@@ -2574,7 +2640,7 @@ log_working_directory (entering)
int entering;
{
static int entered = 0;
char *msg = entering ? "Entering" : "Leaving";
char *msg = entering ? _("Entering") : _("Leaving");
/* Print nothing without the flag. Don't print the entering message
again if we already have. Don't print the leaving message if we
@@ -2593,7 +2659,7 @@ log_working_directory (entering)
printf ("%s[%u]: %s ", program, makelevel, msg);
if (starting_directory == 0)
puts ("an unknown directory");
puts (_("an unknown directory"));
else
printf ("directory `%s'\n", starting_directory);
printf (_("directory `%s'\n"), starting_directory);
}

View File

@@ -8,39 +8,40 @@
globsrc := $(wildcard glob/*.c)
globhdr := $(wildcard glob/*.h)
TEMPLATES = README README.DOS config.ami configh.dos config.h.W32 config.h-vms
TEMPLATES = README README.DOS README.W32 \
config.ami configh.dos config.h.W32 config.h-vms
MTEMPLATES = Makefile.DOS SMakefile
# We need this to ensure that README is created on time to avoid errors
# by automake.
# We need this to ensure that README and build.sh.in are created on time to
# avoid errors by automake.
#
Makefile.in: README
#Makefile.in: README build.sh.in
# General rule for turning a .template into a regular file.
#
$(TEMPLATES) : % : %.template configure.in
$(TEMPLATES) : % : %.template Makefile
rm -f $@
sed -e 's@%VERSION%@$(VERSION)@' \
-e 's@%PACKAGE%@$(PACKAGE)@' \
sed -e 's@%VERSION%@$(VERSION)@g' \
-e 's@%PACKAGE%@$(PACKAGE)@g' \
$< > $@
chmod a-w $@
# Construct Makefiles by adding on dependencies, etc.
#
$(MTEMPLATES) : % : %.template .dep_segment Makefile.am maintMakefile
$(MTEMPLATES) : % : %.template .dep_segment Makefile
rm -f $@
sed -e 's@%VERSION%@$(VERSION)@' \
-e 's@%PROGRAMS%@$(bin_PROGRAMS)@' \
-e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@' \
-e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@' \
-e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@' \
-e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@' \
sed -e 's@%VERSION%@$(VERSION)@g' \
-e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
-e 's@%SOURCES%@$(filter-out remote-%,$(make_SOURCES)) remote-$$(REMOTE).c@g' \
-e 's@%OBJECTS%@$(filter-out remote-%,$(make_OBJECTS)) remote-$$(REMOTE).o@g' \
-e 's@%GLOB_SOURCES%@$(globsrc) $(globhdr)@g' \
-e 's@%GLOB_OBJECTS%@$(globsrc:glob/%.c=%.o)@g' \
$< > $@
echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
cat $(word 2,$^) >>$@
chmod a-w $@
NMakefile: NMakefile.template .dep_segment Makefile.am maintMakefile
NMakefile: NMakefile.template .dep_segment Makefile
rm -f $@
cp $< $@
echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
@@ -49,10 +50,10 @@ NMakefile: NMakefile.template .dep_segment Makefile.am maintMakefile
# Construct build.sh.in
#
build.sh.in: build.template Makefile.am maintMakefile
build.sh.in: build.template Makefile
rm -f $@
sed -e 's@%objs%@$(filter-out remote-%, $(make_OBJECTS)@' \
-e 's@%globobjs%@$(patsubst %.c,%.o,$(globsrc)))@' \
sed -e 's@%objs%@$(filter-out remote-%,$(make_OBJECTS)@g' \
-e 's@%globobjs%@$(patsubst %.c,%.o,$(globsrc)))@g' \
$< > $@
chmod a-w+x $@

31
make.h
View File

@@ -40,6 +40,13 @@ Boston, MA 02111-1307, USA. */
#endif /* C++ or ANSI C. */
/* For now, set gettext macro to a no-op. */
#undef _
#undef N_
#define _(s) s
#define N_(s) s
#ifdef CRAY
/* This must happen before #include <signal.h> so
that the declaration therein is changed. */
@@ -70,6 +77,14 @@ Boston, MA 02111-1307, USA. */
extern int errno;
#endif
/* A shortcut for EINTR checking. Note you should be careful when negating
this! That might not mean what you want if EINTR is not available. */
#ifdef EINTR
# define EINTR_SET (errno == EINTR)
#else
# define EINTR_SET (0)
#endif
#ifndef isblank
# define isblank(c) ((c) == ' ' || (c) == '\t')
#endif
@@ -156,6 +171,10 @@ extern unsigned int get_path_max PARAMS ((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))
#ifndef CHAR_MAX
# define CHAR_MAX INTEGER_TYPE_MAXIMUM (char)
#endif
#ifdef STAT_MACROS_BROKEN
# ifdef S_ISREG
# undef S_ISREG
@@ -284,6 +303,17 @@ extern char *alloca ();
# endif /* HAVE_ALLOCA_H. */
#endif /* GCC. */
/* ISDIGIT offers the following features:
- Its arg may be any int or unsigned int; it need not be an unsigned char.
- It's guaranteed to evaluate its argument exactly once.
NOTE! Make relies on this behavior, don't change it!
- It's typically faster.
Posix 1003.2-1992 section 2.5.2.1 page 50 lines 1556-1558 says that
only '0' through '9' are digits. Prefer ISDIGIT to isdigit() unless
it's important to use the locale's definition of `digit' even when the
host does not conform to Posix. */
#define ISDIGIT(c) ((unsigned) (c) - '0' <= 9)
#ifndef iAPX286
# define streq(a, b) \
((a) == (b) || \
@@ -464,6 +494,7 @@ extern int batch_mode_shell;
extern unsigned int job_slots;
extern int job_fds[2];
extern int job_rfd;
#ifndef NO_FLOAT
extern double max_load_average;
#else

File diff suppressed because it is too large Load Diff

14
misc.c
View File

@@ -304,7 +304,7 @@ fatal (flocp, fmt, va_alist)
VA_PRINTF (stderr, fmt, args);
VA_END (args);
fputs (". Stop.\n", stderr);
fputs (_(". Stop.\n"), stderr);
die (2);
}
@@ -326,7 +326,7 @@ strerror (errnum)
if (errno < sys_nerr)
return sys_errlist[errnum];
sprintf (buf, "Unknown error %d", errnum);
sprintf (buf, _("Unknown error %d"), errnum);
return buf;
}
#endif
@@ -366,7 +366,7 @@ xmalloc (size)
{
char *result = (char *) malloc (size);
if (result == 0)
fatal (NILF, "virtual memory exhausted");
fatal (NILF, _("virtual memory exhausted"));
return result;
}
@@ -381,7 +381,7 @@ xrealloc (ptr, size)
/* Some older implementations of realloc() don't conform to ANSI. */
result = ptr ? realloc (ptr, size) : malloc (size);
if (result == 0)
fatal (NILF, "virtual memory exhausted");
fatal (NILF, _("virtual memory exhausted"));
return result;
}
@@ -399,7 +399,7 @@ xstrdup (ptr)
#endif
if (result == 0)
fatal (NILF, "virtual memory exhausted");
fatal (NILF, _("virtual memory exhausted"));
#ifdef HAVE_STRDUP
return result;
@@ -650,7 +650,7 @@ log_access (flavor)
but we write this one to stderr because it might be
run in a child fork whose stdout is piped. */
fprintf (stderr, "%s access: user %lu (real %lu), group %lu (real %lu)\n",
fprintf (stderr, _("%s access: user %lu (real %lu), group %lu (real %lu)\n"),
flavor, (unsigned long) geteuid (), (unsigned long) getuid (),
(unsigned long) getegid (), (unsigned long) getgid ());
fflush (stderr);
@@ -671,7 +671,7 @@ init_access ()
if (user_uid == -1 || user_gid == -1 || make_uid == -1 || make_gid == -1)
pfatal_with_name ("get{e}[gu]id");
log_access ("Initialized");
log_access (_("Initialized"));
current_access = make;
#endif

163
read.c
View File

@@ -17,11 +17,12 @@ along with GNU Make; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#include "make.h"
#include <assert.h>
#include <glob.h>
#include "make.h"
#include "dep.h"
#include "filedef.h"
#include "job.h"
@@ -149,7 +150,7 @@ read_all_makefiles (makefiles)
unsigned int num_makefiles = 0;
if (debug_flag)
puts ("Reading makefiles...");
puts (_("Reading makefiles..."));
/* If there's a non-null variable MAKEFILES, its value is a list of
files to read first thing. But don't let it prevent reading the
@@ -176,10 +177,12 @@ read_all_makefiles (makefiles)
while ((name = find_next_token (&p, &length)) != 0)
{
name = xstrdup (name);
if (*p != '\0')
*p++ = '\0';
(void) read_makefile (name,
RM_NO_DEFAULT_GOAL | RM_INCLUDED | RM_DONTCARE);
if (read_makefile (name,
RM_NO_DEFAULT_GOAL|RM_INCLUDED|RM_DONTCARE) < 2)
free (name);
}
free (value);
@@ -268,7 +271,9 @@ read_all_makefiles (makefiles)
FILENAME is added to the `read_makefiles' chain.
Returns 1 if a file was found and read, 0 if not. */
Returns 0 if a file was not found or not read.
Returns 1 if FILENAME was found and read.
Returns 2 if FILENAME was read, and we kept a reference (don't free it). */
static int
read_makefile (filename, flags)
@@ -288,6 +293,7 @@ read_makefile (filename, flags)
int len, reading_target;
int ignoring = 0, in_ignored_define = 0;
int no_targets = 0; /* Set when reading a rule without targets. */
int using_filename = 0;
struct floc fileinfo;
char *passed_filename = filename;
@@ -306,10 +312,12 @@ read_makefile (filename, flags)
do \
{ \
if (filenames != 0) \
record_files (filenames, pattern, pattern_percent, deps, \
cmds_started, commands, commands_idx, \
two_colon, &fileinfo, \
!(flags & RM_NO_DEFAULT_GOAL)); \
{ \
record_files (filenames, pattern, pattern_percent, deps, \
cmds_started, commands, commands_idx, two_colon, \
&fileinfo, !(flags & RM_NO_DEFAULT_GOAL)); \
using_filename |= commands_idx > 0; \
} \
filenames = 0; \
commands_idx = 0; \
if (pattern) { free(pattern); pattern = 0; } \
@@ -323,15 +331,15 @@ read_makefile (filename, flags)
if (debug_flag)
{
printf ("Reading makefile `%s'", fileinfo.filenm);
printf (_("Reading makefile `%s'"), fileinfo.filenm);
if (flags & RM_NO_DEFAULT_GOAL)
printf (" (no default goal)");
printf (_(" (no default goal)"));
if (flags & RM_INCLUDED)
printf (" (search path)");
printf (_(" (search path)"));
if (flags & RM_DONTCARE)
printf (" (don't care)");
printf (_(" (don't care)"));
if (flags & RM_NO_TILDE)
printf (" (no ~ expansion)");
printf (_(" (no ~ expansion)"));
puts ("...");
}
@@ -511,7 +519,7 @@ read_makefile (filename, flags)
if (i >= 0)
ignoring = i;
else
fatal (&fileinfo, "invalid syntax in conditional");
fatal (&fileinfo, _("invalid syntax in conditional"));
continue;
}
@@ -520,7 +528,7 @@ read_makefile (filename, flags)
if (in_ignored_define)
in_ignored_define = 0;
else
fatal (&fileinfo, "extraneous `endef'");
fatal (&fileinfo, _("extraneous `endef'"));
continue;
}
@@ -532,7 +540,7 @@ read_makefile (filename, flags)
{
p2 = next_token (p + 6);
if (*p2 == '\0')
fatal (&fileinfo, "empty variable name");
fatal (&fileinfo, _("empty variable name"));
/* Let the variable name be the whole rest of the line,
with trailing blanks stripped (comments have already been
@@ -550,7 +558,7 @@ read_makefile (filename, flags)
{
p2 = next_token (p + 8);
if (*p2 == '\0')
error (&fileinfo, "empty `override' directive");
error (&fileinfo, _("empty `override' directive"));
if (strneq (p2, "define", 6) && (isblank (p2[6]) || p2[6] == '\0'))
{
if (ignoring)
@@ -559,7 +567,7 @@ read_makefile (filename, flags)
{
p2 = next_token (p2 + 6);
if (*p2 == '\0')
fatal (&fileinfo, "empty variable name");
fatal (&fileinfo, _("empty variable name"));
/* Let the variable name be the whole rest of the line,
with trailing blanks stripped (comments have already been
@@ -573,7 +581,7 @@ read_makefile (filename, flags)
}
else if (!ignoring
&& !try_variable_definition (&fileinfo, p2, o_override))
error (&fileinfo, "invalid `override' directive");
error (&fileinfo, _("invalid `override' directive"));
continue;
}
@@ -657,8 +665,7 @@ read_makefile (filename, flags)
if (*p == '\0')
{
error (&fileinfo,
"no file name for `%sinclude'",
noerror ? "-" : "");
_("no file name for `%sinclude'"), noerror ? "-" : "");
continue;
}
@@ -685,15 +692,18 @@ read_makefile (filename, flags)
{
struct nameseq *next = files->next;
char *name = files->name;
int r;
free ((char *)files);
files = next;
if (! read_makefile (name, (RM_INCLUDED | RM_NO_TILDE
| (noerror ? RM_DONTCARE : 0)))
&& ! noerror)
error (&fileinfo,
"%s: %s", name, strerror (errno));
free(name);
r = read_makefile (name, (RM_INCLUDED | RM_NO_TILDE
| (noerror ? RM_DONTCARE : 0)));
if (!r && !noerror)
error (&fileinfo, "%s: %s", name, strerror (errno));
if (r < 2)
free (name);
}
/* Free any space allocated by conditional_line. */
@@ -722,7 +732,7 @@ read_makefile (filename, flags)
because there was no preceding target, and the line
might have been usable as a variable definition.
But now it is definitely lossage. */
fatal(&fileinfo, "commands commence before first target");
fatal(&fileinfo, _("commands commence before first target"));
}
else
{
@@ -770,7 +780,7 @@ read_makefile (filename, flags)
{
case w_eol:
if (cmdleft != 0)
fatal(&fileinfo, "missing rule before commands");
fatal(&fileinfo, _("missing rule before commands"));
/* This line contained something but turned out to be nothing
but whitespace (a comment?). */
continue;
@@ -856,9 +866,9 @@ read_makefile (filename, flags)
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 (&fileinfo, "missing separator%s",
fatal (&fileinfo, _("missing separator%s"),
!strneq(lb.buffer, " ", 8) ? ""
: " (did you mean TAB instead of 8 spaces?)");
: _(" (did you mean TAB instead of 8 spaces?)"));
continue;
}
@@ -879,7 +889,7 @@ read_makefile (filename, flags)
continue;
}
/* This should never be possible; we handled it above. */
assert(*p2 != '\0');
assert (*p2 != '\0');
++p2;
/* Is this a one-colon or two-colon entry? */
@@ -894,25 +904,31 @@ read_makefile (filename, flags)
if (*lb_next != '\0')
{
unsigned int l = p2 - variable_buffer;
plen = strlen(p2);
(void)variable_buffer_output(p2+plen,
lb_next, strlen(lb_next)+1);
plen = strlen (p2);
(void) variable_buffer_output (p2+plen,
lb_next, strlen (lb_next)+1);
p2 = variable_buffer + l;
}
wtype = get_next_mword(p2, NULL, &p, &len);
/* See if it's an "override" keyword; if so see if what comes after
it looks like a variable definition. */
wtype = get_next_mword (p2, NULL, &p, &len);
v_origin = o_file;
if (wtype == w_static && (len == (sizeof("override")-1)
&& strneq(p, "override", len)))
if (wtype == w_static && (len == (sizeof ("override")-1)
&& strneq (p, "override", len)))
{
v_origin = o_override;
(void)get_next_mword(p+len, NULL, &p, &len);
wtype = get_next_mword (p+len, NULL, &p, &len);
}
else if (wtype != w_eol)
wtype = get_next_mword(p+len, NULL, NULL, NULL);
if (wtype == w_varassign || v_origin == o_override)
if (wtype != w_eol)
wtype = get_next_mword (p+len, NULL, NULL, NULL);
if (wtype == w_varassign)
{
record_target_var(filenames, p, two_colon, v_origin, &fileinfo);
record_target_var (filenames, p, two_colon, v_origin, &fileinfo);
filenames = 0;
continue;
}
@@ -928,7 +944,7 @@ read_makefile (filename, flags)
if (*lb_next != '\0')
{
unsigned int l = p2 - variable_buffer;
(void)variable_expand_string(p2 + plen, lb_next, (long)-1);
(void) variable_expand_string (p2 + plen, lb_next, (long)-1);
p2 = variable_buffer + l;
/* Look for a semicolon in the expanded line. */
@@ -987,14 +1003,13 @@ read_makefile (filename, flags)
target = parse_file_seq (&p2, ':', sizeof (struct nameseq), 1);
++p2;
if (target == 0)
fatal (&fileinfo, "missing target pattern");
fatal (&fileinfo, _("missing target pattern"));
else if (target->next != 0)
fatal (&fileinfo, "multiple target patterns");
fatal (&fileinfo, _("multiple target patterns"));
pattern = target->name;
pattern_percent = find_percent (pattern);
if (pattern_percent == 0)
fatal (&fileinfo,
"target pattern contains no `%%'");
fatal (&fileinfo, _("target pattern contains no `%%'"));
free((char *)target);
}
else
@@ -1035,7 +1050,7 @@ read_makefile (filename, flags)
}
if (conditionals->if_cmds)
fatal (&fileinfo, "missing `endif'");
fatal (&fileinfo, _("missing `endif'"));
/* At eof, record the last rule. */
record_waiting_files ();
@@ -1046,7 +1061,7 @@ read_makefile (filename, flags)
reading_file = 0;
return 1;
return 1+using_filename;
}
/* Execute a `define' directive.
@@ -1094,7 +1109,7 @@ do_define (name, namelen, origin, infile, flocp)
p += 5;
remove_comments (p);
if (*next_token (p) != '\0')
error (flocp, "Extraneous text after `endef' directive");
error (flocp, _("Extraneous text after `endef' directive"));
/* Define the variable. */
if (idx == 0)
definition[0] = '\0';
@@ -1123,7 +1138,7 @@ do_define (name, namelen, origin, infile, flocp)
}
/* No `endef'!! */
fatal (flocp, "missing `endef', unterminated `define'");
fatal (flocp, _("missing `endef', unterminated `define'"));
/* NOTREACHED */
return;
@@ -1177,16 +1192,15 @@ conditional_line (line, flocp)
if (*cmdname == 'e')
{
if (*line != '\0')
error (flocp,
"Extraneous text after `%s' directive", cmdname);
error (flocp, _("Extraneous text after `%s' directive"), cmdname);
/* "Else" or "endif". */
if (conditionals->if_cmds == 0)
fatal (flocp, "extraneous `%s'", cmdname);
fatal (flocp, _("extraneous `%s'"), cmdname);
/* NOTDEF indicates an `endif' command. */
if (notdef)
--conditionals->if_cmds;
else if (conditionals->seen_else[conditionals->if_cmds - 1])
fatal (flocp, "only one `else' per conditional");
fatal (flocp, _("only one `else' per conditional"));
else
{
/* Toggle the state of ignorance. */
@@ -1334,8 +1348,7 @@ conditional_line (line, flocp)
*line = '\0';
line = next_token (++line);
if (*line != '\0')
error (flocp,
"Extraneous text after `%s' directive", cmdname);
error (flocp, _("Extraneous text after `%s' directive"), cmdname);
s2 = variable_expand (s2);
conditionals->ignoring[conditionals->if_cmds - 1]
@@ -1444,9 +1457,9 @@ record_target_var (filenames, defn, two_colon, origin, flocp)
/* Make the new variable context current and define the variable. */
current_variable_set_list = vlist;
v = try_variable_definition(flocp, defn, origin);
v = try_variable_definition (flocp, defn, origin);
if (!v)
error (flocp, "Malformed per-target variable definition");
error (flocp, _("Malformed per-target variable definition"));
v->per_target = 1;
/* If it's not an override, check to see if there was a command-line
@@ -1457,10 +1470,10 @@ record_target_var (filenames, defn, two_colon, origin, flocp)
int len = strlen(v->name);
current_variable_set_list = global;
gv = lookup_variable(v->name, len);
gv = lookup_variable (v->name, len);
if (gv && (gv->origin == o_env_override || gv->origin == o_command))
define_variable_in_set(v->name, len, gv->value, gv->origin,
gv->recursive, vlist->set);
define_variable_in_set (v->name, len, gv->value, gv->origin,
gv->recursive, vlist->set);
}
/* Free name if not needed further. */
@@ -1528,10 +1541,10 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
implicit |= implicit_percent != 0;
if (implicit && pattern != 0)
fatal (flocp, "mixed implicit and static pattern rules");
fatal (flocp, _("mixed implicit and static pattern rules"));
if (implicit && implicit_percent == 0)
fatal (flocp, "mixed implicit and normal rules");
fatal (flocp, _("mixed implicit and normal rules"));
if (implicit)
{
@@ -1572,7 +1585,7 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
{
/* Give a warning if the rule is meaningless. */
error (flocp,
"target `%s' doesn't match the target pattern", name);
_("target `%s' doesn't match the target pattern"), name);
this = 0;
}
else
@@ -1604,12 +1617,12 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
if (f->double_colon)
fatal (flocp,
"target file `%s' has both : and :: entries", f->name);
_("target file `%s' has both : and :: entries"), f->name);
/* If CMDS == F->CMDS, this target was listed in this rule
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.",
error (flocp, _("target `%s' given more than once in the same rule."),
f->name);
/* Check for two single-colon entries both with commands.
@@ -1618,9 +1631,9 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
else if (cmds != 0 && f->cmds != 0 && f->is_target)
{
error (&cmds->fileinfo,
"warning: overriding commands for target `%s'", f->name);
_("warning: overriding commands for target `%s'"), f->name);
error (&f->cmds->fileinfo,
"warning: ignoring old commands for target `%s'",
_("warning: ignoring old commands for target `%s'"),
f->name);
}
@@ -1702,7 +1715,7 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
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);
_("target file `%s' has both : and :: entries"), f->name);
f = enter_file (name);
/* If there was an existing entry and it was a double-colon
entry, enter_file will have returned a new one, making it the
@@ -1729,7 +1742,7 @@ record_files (filenames, pattern, pattern_percent, deps, cmds_started,
not start with a `.', unless it contains a slash. */
if (default_goal_file == 0 && set_default
&& (*name != '.' || index (name, '/') != 0
#ifdef __MSDOS__
#if defined(__MSDOS__) || defined(WINDOWS32)
|| index (name, '\\') != 0
#endif
))
@@ -2119,7 +2132,7 @@ readline (linebuffer, stream, flocp)
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 (flocp, "warning: NUL character seen; rest of line ignored");
error (flocp, _("warning: NUL character seen; rest of line ignored"));
p[0] = '\n';
len = 1;
}
@@ -2674,7 +2687,7 @@ multi_glob (chain, size)
}
case GLOB_NOSPACE:
fatal (NILF, "virtual memory exhausted");
fatal (NILF, _("virtual memory exhausted"));
break;
default:

196
remake.c
View File

@@ -1,5 +1,5 @@
/* Basic dependency engine for GNU Make.
Copyright (C) 1988,89,90,91,92,93,94,95,96,97 Free Software Foundation, Inc.
Copyright (C) 1988,89,90,91,92,93,94,95,96,97,99 Free Software Foundation, Inc.
This file is part of GNU Make.
GNU Make is free software; you can redistribute it and/or modify
@@ -32,10 +32,6 @@ Boston, MA 02111-1307, USA. */
#include <sys/file.h>
#endif
#ifdef __MSDOS__
#include "variable.h"
#endif
#ifdef VMS
#include <starlet.h>
#endif
@@ -163,44 +159,47 @@ update_goal_chain (goals, makefiles)
decide when to give an "up to date" diagnostic. */
g->changed += commands_started - ocommands_started;
stop = 0;
if (x != 0 || file->updated)
{
/* If 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. */
/* 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. */
if (status < 1)
{
if (file->update_status != 0)
{
/* Updating failed, or -q triggered.
The STATUS value tells our caller which. */
status = file->update_status;
/* If -q just triggered, stop immediately.
It doesn't matter how much more we run,
since we already know the answer to return. */
stop = (!keep_going_flag && !question_flag
&& !makefiles);
}
else if (file->updated && g->changed &&
file->last_mtime != file->mtime_before_update)
{
/* Updating was done. If this is a makefile and
just_print_flag or question_flag is set
(meaning -n or -q was given and this file was
specified as a command-line target), don't
change STATUS. If STATUS is changed, we will
get re-exec'd, and fall into an infinite loop. */
if (!makefiles
|| (!just_print_flag && !question_flag))
status = 0;
if (makefiles && file->dontcare)
/* This is a default makefile. Stop remaking. */
stop = 1;
}
}
}
stop = 0;
if ((x != 0 || file->updated) && status < 1)
{
if (file->update_status != 0)
{
/* Updating failed, or -q triggered. The STATUS value
tells our caller which. */
status = file->update_status;
/* If -q just triggered, stop immediately. It doesn't
matter how much more we run, since we already know
the answer to return. */
stop = (!keep_going_flag && !question_flag
&& !makefiles);
}
else
{
FILE_TIMESTAMP mtime = MTIME (file);
check_renamed (file);
if (file->updated && g->changed &&
mtime != file->mtime_before_update)
{
/* Updating was done. If this is a makefile and
just_print_flag or question_flag is set (meaning
-n or -q was given and this file was specified
as a command-line target), don't change STATUS.
If STATUS is changed, we will get re-exec'd, and
enter an infinite loop. */
if (!makefiles
|| (!just_print_flag && !question_flag))
status = 0;
if (makefiles && file->dontcare)
/* This is a default makefile; stop remaking. */
stop = 1;
}
}
}
/* Keep track if any double-colon entry is not finished.
When they are all finished, the goal is finished. */
@@ -226,8 +225,8 @@ update_goal_chain (goals, makefiles)
/* 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."),
? _("Nothing to be done for `%s'.")
: _("`%s' is up to date.")),
file->name);
/* This goal is finished. Remove it from the chain. */
@@ -274,9 +273,9 @@ no_rule_error(file)
struct file *file;
{
static const char msg_noparent[]
= "%sNo rule to make target `%s'%s";
= _("%sNo rule to make target `%s'%s");
static const char msg_parent[]
= "%sNo rule to make target `%s', needed by `%s'%s";
= _("%sNo rule to make target `%s', needed by `%s'%s");
if (keep_going_flag || file->dontcare)
{
@@ -320,19 +319,19 @@ update_file (file, depth)
register int status = 0;
register struct file *f;
/* Prune the dependency graph: if we've already been here on _this_ pass
through the dependency graph, we don't have to go any further. We won't
reap_children until we start the next pass, so no state change is
possible below here until then. */
if (file->considered == considered)
{
DEBUGPR ("Pruning file `%s'.\n");
return 0;
}
file->considered = considered;
for (f = file->double_colon ? file->double_colon : file; f != 0; f = f->prev)
{
/* Prune the dependency graph: if we've already been here on _this_
pass through the dependency graph, we don't have to go any further.
We won't reap_children until we start the next pass, so no state
change is possible below here until then. */
if (f->considered == considered)
{
DEBUGPR (_("Pruning file `%s'.\n"));
continue;
}
f->considered = considered;
status |= update_file_1 (f, depth);
check_renamed (f);
@@ -373,18 +372,18 @@ update_file_1 (file, depth)
register struct dep *d, *lastd;
int running = 0;
DEBUGPR ("Considering target file `%s'.\n");
DEBUGPR (_("Considering target file `%s'.\n"));
if (file->updated)
{
if (file->update_status > 0)
{
DEBUGPR ("Recently tried and failed to update file `%s'.\n");
DEBUGPR (_("Recently tried and failed to update file `%s'.\n"));
no_rule_error(file);
return file->update_status;
}
DEBUGPR ("File `%s' was considered already.\n");
DEBUGPR (_("File `%s' was considered already.\n"));
return 0;
}
@@ -394,10 +393,10 @@ update_file_1 (file, depth)
case cs_deps_running:
break;
case cs_running:
DEBUGPR ("Still updating file `%s'.\n");
DEBUGPR (_("Still updating file `%s'.\n"));
return 0;
case cs_finished:
DEBUGPR ("Finished updating file `%s'.\n");
DEBUGPR (_("Finished updating file `%s'.\n"));
return file->update_status;
default:
abort ();
@@ -418,7 +417,7 @@ update_file_1 (file, depth)
check_renamed (file);
noexist = this_mtime == (FILE_TIMESTAMP) -1;
if (noexist)
DEBUGPR ("File `%s' does not exist.\n");
DEBUGPR (_("File `%s' does not exist.\n"));
must_make = noexist;
@@ -428,15 +427,15 @@ update_file_1 (file, depth)
if (!file->phony && file->cmds == 0 && !file->tried_implicit)
{
if (try_implicit_rule (file, depth))
DEBUGPR ("Found an implicit rule for `%s'.\n");
DEBUGPR (_("Found an implicit rule for `%s'.\n"));
else
DEBUGPR ("No implicit rule found for `%s'.\n");
DEBUGPR (_("No implicit rule found for `%s'.\n"));
file->tried_implicit = 1;
}
if (file->cmds == 0 && !file->is_target
&& default_file != 0 && default_file->cmds != 0)
{
DEBUGPR ("Using default commands for `%s'.\n");
DEBUGPR (_("Using default commands for `%s'.\n"));
file->cmds = default_file->cmds;
}
@@ -456,7 +455,7 @@ update_file_1 (file, depth)
if (d->file->updating)
{
error (NILF, "Circular %s <- %s dependency dropped.",
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
@@ -534,13 +533,13 @@ update_file_1 (file, depth)
file->updating = 0;
DEBUGPR ("Finished dependencies of target file `%s'.\n");
DEBUGPR (_("Finished prerequisites of target file `%s'.\n"));
if (running)
{
set_command_state (file, cs_deps_running);
--depth;
DEBUGPR ("The dependencies of `%s' are being made.\n");
DEBUGPR (_("The prerequisites of `%s' are being made.\n"));
return 0;
}
@@ -553,11 +552,12 @@ update_file_1 (file, depth)
depth--;
DEBUGPR ("Giving up on target file `%s'.\n");
DEBUGPR (_("Giving up on target file `%s'.\n"));
if (depth == 0 && keep_going_flag
&& !just_print_flag && !question_flag)
error (NILF, "Target `%s' not remade because of errors.", file->name);
error (NILF,
_("Target `%s' not remade because of errors."), file->name);
return dep_status;
}
@@ -602,10 +602,10 @@ update_file_1 (file, depth)
{
print_spaces (depth);
if (d_mtime == (FILE_TIMESTAMP) -1)
printf ("Dependency `%s' does not exist.\n", dep_name (d));
printf (_("Prerequisite `%s' does not exist.\n"), dep_name (d));
else
printf ("Dependency `%s' is %s than dependent `%s'.\n",
dep_name (d), d->changed ? "newer" : "older", file->name);
printf (_("Prerequisite `%s' is %s than target `%s'.\n"),
dep_name (d), d->changed ? _("newer") : _("older"), file->name);
fflush (stdout);
}
}
@@ -616,12 +616,12 @@ update_file_1 (file, depth)
if (file->double_colon && file->deps == 0)
{
must_make = 1;
DEBUGPR ("Target `%s' is double-colon and has no dependencies.\n");
DEBUGPR (_("Target `%s' is double-colon and has no prerequisites.\n"));
}
else if (!noexist && file->is_target && !deps_changed && file->cmds == 0)
{
must_make = 0;
DEBUGPR ("No commands for `%s' and no dependencies actually changed.\n");
DEBUGPR (_("No commands for `%s' and no prerequisites actually changed.\n"));
}
if (!must_make)
@@ -629,9 +629,9 @@ update_file_1 (file, depth)
if (debug_flag)
{
print_spaces(depth);
printf("No need to remake target `%s'", file->name);
printf(_("No need to remake target `%s'"), file->name);
if (!streq(file->name, file->hname))
printf("; using VPATH name `%s'", file->hname);
printf(_("; using VPATH name `%s'"), file->hname);
printf(".\n");
fflush(stdout);
}
@@ -651,7 +651,7 @@ update_file_1 (file, depth)
return 0;
}
DEBUGPR ("Must remake target `%s'.\n");
DEBUGPR (_("Must remake target `%s'.\n"));
/* It needs to be remade. If it's VPATH and not reset via GPATH, toss the
VPATH. */
@@ -660,7 +660,7 @@ update_file_1 (file, depth)
if (debug_flag)
{
print_spaces (depth);
printf(" Ignoring VPATH name `%s'.\n", file->hname);
printf(_(" Ignoring VPATH name `%s'.\n"), file->hname);
fflush(stdout);
}
file->ignore_vpath = 1;
@@ -671,20 +671,20 @@ update_file_1 (file, depth)
if (file->command_state != cs_finished)
{
DEBUGPR ("Commands of `%s' are being run.\n");
DEBUGPR (_("Commands of `%s' are being run.\n"));
return 0;
}
switch (file->update_status)
{
case 2:
DEBUGPR ("Failed to remake target file `%s'.\n");
DEBUGPR (_("Failed to remake target file `%s'.\n"));
break;
case 0:
DEBUGPR ("Successfully remade target file `%s'.\n");
DEBUGPR (_("Successfully remade target file `%s'.\n"));
break;
case 1:
DEBUGPR ("Target file `%s' needs remade under -q.\n");
DEBUGPR (_("Target file `%s' needs remade under -q.\n"));
break;
default:
assert (file->update_status >= 0 && file->update_status <= 2);
@@ -740,13 +740,13 @@ notice_finished_file (file)
}
}
if (file->mtime_before_update == 0)
file->mtime_before_update = file->last_mtime;
if (ran && !file->phony)
{
struct file *f;
assert(file->mtime_before_update == 0);
file->mtime_before_update = file->last_mtime;
if (just_print_flag || question_flag
|| (file->is_target && file->cmds == 0))
file->last_mtime = NEW_MTIME;
@@ -823,15 +823,15 @@ check_dep (file, depth, this_mtime, must_make_ptr)
if (!file->phony && file->cmds == 0 && !file->tried_implicit)
{
if (try_implicit_rule (file, depth))
DEBUGPR ("Found an implicit rule for `%s'.\n");
DEBUGPR (_("Found an implicit rule for `%s'.\n"));
else
DEBUGPR ("No implicit rule found for `%s'.\n");
DEBUGPR (_("No implicit rule found for `%s'.\n"));
file->tried_implicit = 1;
}
if (file->cmds == 0 && !file->is_target
&& default_file != 0 && default_file->cmds != 0)
{
DEBUGPR ("Using default commands for `%s'.\n");
DEBUGPR (_("Using default commands for `%s'.\n"));
file->cmds = default_file->cmds;
}
@@ -855,7 +855,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
{
if (d->file->updating)
{
error (NILF, "Circular %s <- %s dependency dropped.",
error (NILF, _("Circular %s <- %s dependency dropped."),
file->name, d->file->name);
if (lastd == 0)
{
@@ -873,7 +873,8 @@ check_dep (file, depth, this_mtime, must_make_ptr)
}
d->file->parent = file;
dep_status |= check_dep (d->file, depth, this_mtime, must_make_ptr);
dep_status |= check_dep (d->file, depth, this_mtime,
must_make_ptr);
check_renamed (d->file);
if (dep_status != 0 && !keep_going_flag)
break;
@@ -922,13 +923,10 @@ touch_file (file)
char buf;
int status;
#ifdef EINTR
do
#endif
status = fstat (fd, &statbuf);
#ifdef EINTR
while (status < 0 && errno == EINTR);
#endif
while (status < 0 && EINTR_SET);
if (status < 0)
TOUCH_ERROR ("touch: fstat: ");
/* Rewrite character 0 same as it already is. */
@@ -1152,7 +1150,7 @@ f_mtime (file, search)
file_timestamp_sprintf (mtimebuf, mtime);
file_timestamp_sprintf (nowbuf, now);
error (NILF, "*** Warning: File `%s' has modification time in the future (%s > %s)",
error (NILF, _("*** Warning: File `%s' has modification time in the future (%s > %s)"),
file->name, mtimebuf, nowbuf);
clock_skew_detected = 1;
}
@@ -1266,7 +1264,7 @@ library_search (lib, mtime_ptr)
{
/* Give a warning if there is no pattern, then remove the
pattern so it's ignored next time. */
error (NILF, ".LIBPATTERNS element `%s' is not a pattern", p);
error (NILF, _(".LIBPATTERNS element `%s' is not a pattern"), p);
for (; len; --len, ++p)
*p = ' ';
*p = c;

14
rule.c
View File

@@ -664,10 +664,10 @@ print_rule_data_base ()
}
if (rules == 0)
puts ("\n# No implicit rules.");
puts (_("\n# No implicit rules."));
else
{
printf ("\n# %u implicit rules, %u", rules, terminal);
printf (_("\n# %u implicit rules, %u"), rules, terminal);
#ifndef NO_FLOAT
printf (" (%.1f%%)", (double) terminal / (double) rules * 100.0);
#else
@@ -676,7 +676,7 @@ print_rule_data_base ()
printf (" (%d.%d%%)", f/10, f%10);
}
#endif
puts (" terminal.");
puts (_(" terminal."));
}
if (num_pattern_rules != rules)
@@ -684,11 +684,11 @@ print_rule_data_base ()
/* 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 wrong! %u != %u",
fatal (NILF, _("BUG: num_pattern_rules wrong! %u != %u"),
num_pattern_rules, rules);
}
puts ("\n# Pattern-specific variable values");
puts (_("\n# Pattern-specific variable values"));
{
struct pattern_var *p;
@@ -703,10 +703,10 @@ print_rule_data_base ()
}
if (rules == 0)
puts ("\n# No pattern-specific variable values.");
puts (_("\n# No pattern-specific variable values."));
else
{
printf ("\n# %u pattern-specific variable values", rules);
printf (_("\n# %u pattern-specific variable values"), rules);
}
}
}

View File

@@ -17,9 +17,7 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "make.h"
#include <stdio.h>
#include <sys/types.h> /* Some systems need this for <signal.h>. */
@@ -56,7 +54,7 @@
/* There is too much variation in Sys V signal numbers and names, so
we must initialize them at runtime. */
static const char undoc[] = "unknown signal";
static const char *undoc;
const char *sys_siglist[NSIG];
@@ -109,6 +107,10 @@ signame_init ()
{
#ifndef HAVE_SYS_SIGLIST
int i;
char *u = _("unknown signal");
undoc = xstrdup(u);
/* Initialize signal names. */
for (i = 0; i < NSIG; i++)
sys_siglist[i] = undoc;
@@ -116,135 +118,135 @@ signame_init ()
/* Initialize signal names. */
#if defined (SIGHUP)
init_sig (SIGHUP, "HUP", "Hangup");
init_sig (SIGHUP, "HUP", _("Hangup"));
#endif
#if defined (SIGINT)
init_sig (SIGINT, "INT", "Interrupt");
init_sig (SIGINT, "INT", _("Interrupt"));
#endif
#if defined (SIGQUIT)
init_sig (SIGQUIT, "QUIT", "Quit");
init_sig (SIGQUIT, "QUIT", _("Quit"));
#endif
#if defined (SIGILL)
init_sig (SIGILL, "ILL", "Illegal Instruction");
init_sig (SIGILL, "ILL", _("Illegal Instruction"));
#endif
#if defined (SIGTRAP)
init_sig (SIGTRAP, "TRAP", "Trace/breakpoint trap");
init_sig (SIGTRAP, "TRAP", _("Trace/breakpoint trap"));
#endif
/* If SIGIOT == SIGABRT, we want to print it as SIGABRT because
SIGABRT is in ANSI and POSIX.1 and SIGIOT isn't. */
#if defined (SIGABRT)
init_sig (SIGABRT, "ABRT", "Aborted");
init_sig (SIGABRT, "ABRT", _("Aborted"));
#endif
#if defined (SIGIOT)
init_sig (SIGIOT, "IOT", "IOT trap");
init_sig (SIGIOT, "IOT", _("IOT trap"));
#endif
#if defined (SIGEMT)
init_sig (SIGEMT, "EMT", "EMT trap");
init_sig (SIGEMT, "EMT", _("EMT trap"));
#endif
#if defined (SIGFPE)
init_sig (SIGFPE, "FPE", "Floating point exception");
init_sig (SIGFPE, "FPE", _("Floating point exception"));
#endif
#if defined (SIGKILL)
init_sig (SIGKILL, "KILL", "Killed");
init_sig (SIGKILL, "KILL", _("Killed"));
#endif
#if defined (SIGBUS)
init_sig (SIGBUS, "BUS", "Bus error");
init_sig (SIGBUS, "BUS", _("Bus error"));
#endif
#if defined (SIGSEGV)
init_sig (SIGSEGV, "SEGV", "Segmentation fault");
init_sig (SIGSEGV, "SEGV", _("Segmentation fault"));
#endif
#if defined (SIGSYS)
init_sig (SIGSYS, "SYS", "Bad system call");
init_sig (SIGSYS, "SYS", _("Bad system call"));
#endif
#if defined (SIGPIPE)
init_sig (SIGPIPE, "PIPE", "Broken pipe");
init_sig (SIGPIPE, "PIPE", _("Broken pipe"));
#endif
#if defined (SIGALRM)
init_sig (SIGALRM, "ALRM", "Alarm clock");
init_sig (SIGALRM, "ALRM", _("Alarm clock"));
#endif
#if defined (SIGTERM)
init_sig (SIGTERM, "TERM", "Terminated");
init_sig (SIGTERM, "TERM", _("Terminated"));
#endif
#if defined (SIGUSR1)
init_sig (SIGUSR1, "USR1", "User defined signal 1");
init_sig (SIGUSR1, "USR1", _("User defined signal 1"));
#endif
#if defined (SIGUSR2)
init_sig (SIGUSR2, "USR2", "User defined signal 2");
init_sig (SIGUSR2, "USR2", _("User defined signal 2"));
#endif
/* If SIGCLD == SIGCHLD, we want to print it as SIGCHLD because that
is what is in POSIX.1. */
#if defined (SIGCHLD)
init_sig (SIGCHLD, "CHLD", "Child exited");
init_sig (SIGCHLD, "CHLD", _("Child exited"));
#endif
#if defined (SIGCLD)
init_sig (SIGCLD, "CLD", "Child exited");
init_sig (SIGCLD, "CLD", _("Child exited"));
#endif
#if defined (SIGPWR)
init_sig (SIGPWR, "PWR", "Power failure");
init_sig (SIGPWR, "PWR", _("Power failure"));
#endif
#if defined (SIGTSTP)
init_sig (SIGTSTP, "TSTP", "Stopped");
init_sig (SIGTSTP, "TSTP", _("Stopped"));
#endif
#if defined (SIGTTIN)
init_sig (SIGTTIN, "TTIN", "Stopped (tty input)");
init_sig (SIGTTIN, "TTIN", _("Stopped (tty input)"));
#endif
#if defined (SIGTTOU)
init_sig (SIGTTOU, "TTOU", "Stopped (tty output)");
init_sig (SIGTTOU, "TTOU", _("Stopped (tty output)"));
#endif
#if defined (SIGSTOP)
init_sig (SIGSTOP, "STOP", "Stopped (signal)");
init_sig (SIGSTOP, "STOP", _("Stopped (signal)"));
#endif
#if defined (SIGXCPU)
init_sig (SIGXCPU, "XCPU", "CPU time limit exceeded");
init_sig (SIGXCPU, "XCPU", _("CPU time limit exceeded"));
#endif
#if defined (SIGXFSZ)
init_sig (SIGXFSZ, "XFSZ", "File size limit exceeded");
init_sig (SIGXFSZ, "XFSZ", _("File size limit exceeded"));
#endif
#if defined (SIGVTALRM)
init_sig (SIGVTALRM, "VTALRM", "Virtual timer expired");
init_sig (SIGVTALRM, "VTALRM", _("Virtual timer expired"));
#endif
#if defined (SIGPROF)
init_sig (SIGPROF, "PROF", "Profiling timer expired");
init_sig (SIGPROF, "PROF", _("Profiling timer expired"));
#endif
#if defined (SIGWINCH)
/* "Window size changed" might be more accurate, but even if that
is all that it means now, perhaps in the future it will be
extended to cover other kinds of window changes. */
init_sig (SIGWINCH, "WINCH", "Window changed");
init_sig (SIGWINCH, "WINCH", _("Window changed"));
#endif
#if defined (SIGCONT)
init_sig (SIGCONT, "CONT", "Continued");
init_sig (SIGCONT, "CONT", _("Continued"));
#endif
#if defined (SIGURG)
init_sig (SIGURG, "URG", "Urgent I/O condition");
init_sig (SIGURG, "URG", _("Urgent I/O condition"));
#endif
#if defined (SIGIO)
/* "I/O pending" has also been suggested. A disadvantage is
that signal only happens when the process has
asked for it, not everytime I/O is pending. Another disadvantage
is the confusion from giving it a different name than under Unix. */
init_sig (SIGIO, "IO", "I/O possible");
init_sig (SIGIO, "IO", _("I/O possible"));
#endif
#if defined (SIGWIND)
init_sig (SIGWIND, "WIND", "SIGWIND");
init_sig (SIGWIND, "WIND", _("SIGWIND"));
#endif
#if defined (SIGPHONE)
init_sig (SIGPHONE, "PHONE", "SIGPHONE");
init_sig (SIGPHONE, "PHONE", _("SIGPHONE"));
#endif
#if defined (SIGPOLL)
init_sig (SIGPOLL, "POLL", "I/O possible");
init_sig (SIGPOLL, "POLL", _("I/O possible"));
#endif
#if defined (SIGLOST)
init_sig (SIGLOST, "LOST", "Resource lost");
init_sig (SIGLOST, "LOST", _("Resource lost"));
#endif
#if defined (SIGDANGER)
init_sig (SIGDANGER, "DANGER", "Danger signal");
init_sig (SIGDANGER, "DANGER", _("Danger signal"));
#endif
#if defined (SIGINFO)
init_sig (SIGINFO, "INFO", "Information request");
init_sig (SIGINFO, "INFO", _("Information request"));
#endif
#if defined (SIGNOFP)
init_sig (SIGNOFP, "NOFP", "Floating point co-processor not available");
init_sig (SIGNOFP, "NOFP", _("Floating point co-processor not available"));
#endif
}

339
tests/COPYING Normal file
View File

@@ -0,0 +1,339 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

73
tests/ChangeLog Normal file
View File

@@ -0,0 +1,73 @@
1999-09-23 Paul D. Smith <psmith@gnu.org>
* scripts/features/parallelism: Add a check to ensure that the
jobserver works when we re-invoke. Also cleaned up the tests a
little, reducing the number of rules we use so the test won't need
as many "sleep" commands.
1999-09-16 Paul D. Smith <psmith@gnu.org>
* scripts/features/reinvoke: Remove invocations of "touch" in
makefiles. See the comments on the touch function rewrite below.
Note that UNIX touch behaves the same way if the file already
exists: it sets the time to the _local_ time. We don't want
this. This is probably a good tip for makefile writers in
general, actually... where practical.
* scripts/options/dash-l: Ditto.
* scripts/options/dash-n: Ditto.
* test_driver.pl (run_each_test): In retrospect, I don't like the
.lN/.bN/.dN postfix required by DOS. So, for non-DOS systems I
changed it back to use .log, .base, and .diff.
* run_make_tests.pl (set_more_defaults): Move the check for the
make pathname to here from set_defaults (that's too early since it
happens before the command line processing).
Create a new variable $port_type, calculated from $osname, to
specify what kind of system we're running on. We should integrate
the VOS stuff here, too.
(valid_option): Comment out the workdir/-work stuff so people
won't be fooled into thinking it works... someone needs to fix
this, though!
* scripts/functions/origin: Use $port_type instead of $osname.
* scripts/functions/foreach: Ditto.
* scripts/features/default_names: Ditto.
1999-09-15 Paul D. Smith <psmith@gnu.org>
* test_driver.pl (touch): Rewrite this function. Previously it
used to use utime() to hard-set the time based on the current
local clock, or, if the file didn't exist, it merely created it.
This mirrors exactly what real UNIX touch does, but it fails badly
on networked filesystems where the FS server clock is skewed from
the local clock: normally modifying a file causes it to get a mod
time based on the _server's_ clock. Hard-setting it based on the
_local_ clock causes gratuitous errors and makes the tests
unreliable except on local filesystems. The new function will
simply modify the file, allowing the filesystem to set the mod
time as it sees fit.
* scripts/features/parallelism: The second test output could
change depending on how fast some scripts completed; use "sleep"
to force the order we want.
* test_driver.pl (toplevel): A bug in Perl 5.000 to Perl 5.004
means that "%ENV = ();" doesn't do the right thing. This worked
in Perl 4 and was fixed in Perl 5.004_01, but use a loop to delete
the environment rather than require specific versions.
* run_make_tests.pl (set_more_defaults): Don't use Perl 5 s///
modifier "s", so the tests will run with Perl 4.
(set_more_defaults): Set $pure_log to empty if there's no -logfile
option in PURIFYOPTIONS.
(setup_for_test): Don't remove any logs unless $pure_log is set.
1999-09-15 Eli Zaretskii <eliz@is.elta.co.il>
* scripts/features/reinvoke: Put the SHELL definition in the right
test makefile.
1999-09-15 Paul D. Smith <psmith@gnu.org>
ChangeLog file for the test suite created.

161
tests/NEWS Normal file
View File

@@ -0,0 +1,161 @@
Changes from 0.4.9 to 3.78 (Sep 6, 1999):
Lots of new tests. Renamed to follow the GNU make scheme. Also
added some support for using Purify with make.
Rob Tulloh contributed some changes to get the test suite running on
NT; I tweaked them a bit (hopefully I didn't break anything!) Note
that NT doesn't grok the self-exec funkiness that Unix shells use,
so instead I broke that out into a separate shell script
"run_make_tests" that invokes perl with the (renamed) script
run_make_tests.pl.
Eli Zaretski contributed changes to get the test suite running on
DOS with DJGPP. I also meddled in these somewhat.
If you're on DOS or NT you should run "perl.exe run_make_tests.pl ..."
If you're on Unix, you can continue to run "./run_make_tests ..." as
before.
Changes from 0.4.8 to 0.4.9 (May 14, 1998):
Release by Paul D. Smith <psmith@baynetworks.com>; I'm the one to
blame for problems in this version :).
Add some perl to test_driver.pl to strip out GNU make clock skew
warning messages from the output before comparing it to the
known-good output.
A new test for escaped :'s in filenames (someone on VMS found this
didn't work anymore in 3.77): scripts/features/escape.
Changes from 0.4.7 to 0.4.8 (May 14, 1998):
Release by Paul D. Smith <psmith@baynetworks.com>; I'm the one to
blame for problems in this version :).
New tests for features to be included in GNU make 3.77.
Changes from 0.4.6 to 0.4.7 (August 18, 1997):
Release by Paul D. Smith <psmith@baynetworks.com>; I'm the one to
blame for problems in this version :).
Reworked some tests to make sure they all work with both perl4 and perl5.
Work around a bug in perl 5.004 which doesn't clean the environment
correctly in all cases (fixed in at least 5.004_02).
Updated functions/strip to test for newline stripping.
Keep a $PURIFYOPTIONS env variable if present.
Changes from 0.4.5 to 0.4.6 (April 07, 1997):
Release by Paul D. Smith <psmith@baynetworks.com>; I'm the one to
blame for problems in this version :).
Updated to work with GNU make 3.76 (and pretests).
Added new tests and updated existing ones. Note that the new tests
weren't tested with perl 4, however I think they should work.
Ignore any tests whose filenames end in "~", so that Emacs backup
files aren't run.
Changes from 0.4.4 to 0.4.5 (April 29, 1995):
Updated to be compatible with perl 5.001 as well as 4.036.
Note: the test suite still won't work on 14-char filesystems
(sorry, Kaveh), but I will get to it.
Also, some tests and stuff still haven't made it in because I
haven't had time to write the test scripts for them. But they,
too, will get in eventually. Contributions of scripts (ie, tests
that I can just drop in) are particularly welcome and will be
incorporated immediately.
Changes from 0.4.3 to 0.4.4 (March 1995):
Updated for changes in make 3.72.12, and to ignore CVS directories
(thanks go to Jim Meyering for the patches for this).
Fixed uname call to not make a mess on BSD/OS 2.0 (whose uname -a
is very verbose). Let me know if this doesn't work correctly on
your system.
Changed to display test name while it is running, not just when it
finishes.
Note: the test suite still won't work on 14-char filesystems
(sorry, Kaveh), but I will get to it.
Also, some tests and stuff still haven't made it in because I
haven't had time to write the test scripts for them. But they,
too, will get in eventually.
Changes from 0.4 to 0.4.3 (October 1994):
Fixed bugs (like dependencies on environment variables).
Caught up with changes in make.
The load_limit test should now silently ignore a failure due to
make not being able to read /dev/kmem.
Reorganized tests into subdirs and renamed lots of things so that
those poor souls who still have to deal with 14-char filename
limits won't hate me any more. Thanks very much to Kaveh R. Ghazi
<ghazi@noc.rutgers.edu> for helping me with the implementation and
testing of these changes, and for putting up with all my whining
about it...
Added a $| = 1 so that systems that don't seem to automatically
flush their output for some reason will still print all the
output. I'd hate for someone to miss out on the smiley that
you're supposed to get when all the tests pass... :-)
Changes from 0.3 to 0.4 (August 1993):
Lost in the mists of time (and my hurry to get it out before I
left my job).
Changes from 0.2 to 0.3 (9-30-92):
Several tests fixed to match the fact that MAKELEVEL > 0 or -C now
imply -w.
parallel_execution test fixed to not use double colon rules any
more since their behavior has changed.
errors_in_commands test fixed to handle different error messages
and return codes from rm.
Several tests fixed to handle -make_path with a relative path
and/or a name other than "make" for make.
dash-e-option test fixed to use $PATH instead of $USER (since the
latter does not exist on some System V systems). This also
removes the dependency on getlogin (which fails under certain
weird conditions).
test_driver_core changed so that you can give a test name like
scripts/errors_in_commands and it will be handled correctly (handy
if you have a shell with filename completion).
Changes from 0.1 to 0.2 (5-4-92):
README corrected to require perl 4.019, not 4.010.
-make_path replaces -old.
errors_in_commands test updated for change in format introduced in
make 3.62.6.
test_driver_core now uses a better way of figuring what OS it is
running on (thanks to meyering@cs.utexas.edu (Jim Meyering) for
suggesting this, as well as discovering the hard way that the old
way (testing for /mnt) fails on his machine).
Some new tests were added.

79
tests/README Normal file
View File

@@ -0,0 +1,79 @@
This is release 3.78 (September 6, 1999) of the GNU make test
suite. See the file NEWS for some of the changes since the last
release.
This release is made by psmith@gnu.org to correspond to GNU make 3.78.
It won't work correctly for versions before that. In addition to some
infrastructure changes I've added a number of new tests.
Rob Tulloh has contributed changes to get the suite running on NT.
Eli Zaretskii and Esa A E Peuha <peuha@cc.helsinki.fi> have contributed
changes to get the suite running on DJGPP/DOS.
This package has a number of problems which preclude me from
distributing it with make as a default "make check" test suite. The
most serious of these is that it's not parallelizable: it scribbles all
over its installation directory and so can only test one make at a
time. I simply don't have time to do more with this than I am so far;
I'm very actively interested in finding someone willing to overhaul the
test suite infrastructure. If you're interested, contact me (see below)!
The test suite thus far has been written by Steve McGee, Chris Arthur,
and Paul D. Smith. It is covered by the GNU General Public License
(Version 2), described in the file COPYING.
The test suite requires Perl and is known to work with Perl 4.036 and
Perl 5.004 (available from ftp.gnu.org, and portable to many machines).
Earlier or later versions may work; I don't know. It assumes that the
first "diff" it finds is GNU diff, but that only matters if a test
fails.
To run the test suite on a UNIX system, use "perl ./run_make_tests"
(or just "./run_make_tests" if you have a perl on your PATH).
To run the test suite on Windows NT or DOS systems, use
"perl.exe ./run_make-tests.pl".
By default, the test engine picks up the first executable called "make"
that it finds in your path. You may use the -make_path option (ie,
"perl run_make_tests -make_path /usr/local/src/make-3.78/make") if
you want to run a particular copy. This now works correctly with
relative paths and when make is called something other than "make" (like
"gmake").
Tests cannot end with a "~" character, as the test suite will ignore any
that do (I was tired of having it run my Emacs backup files as test :)
If you want to run the tests in parallel, you should use the mkshadow
script included here to create temporary "copies" (via symbolic links)
of the test suite, one for each parallel job. This is a pain and one
day maybe the test suite will be rewritten so it's no longer
necessary--volunteers welcome!
Also, sometimes the tests may behave strangely on networked
filesystems. You can use mkshadow to create a copy of the test suite in
/tmp or similar, and try again. If the error disappears, it's an issue
with your network or file server, not GNU make (I believe).
The options/dash-l test will not really test anything if the copy of
make you are using can't obtain the system load. Some systems require
make to be setgid sys or kmem for this; if you don't want to install
make just to test it, make it setgid to kmem or whatever group /dev/kmem
is (ie, "chgrp kmem make;chmod g+s make" as root). In any case, the
options/dash-l test should no longer *fail* because make can't read
/dev/kmem.
A directory named "work" will be created when the tests are run which
will contain any makefiles and "diff" files of tests that fail so that
you may look at them afterward to see the output of make and the
expected result.
There is a -help option which will give you more information about the
other possible options for the test suite.
Any complaints/suggestions/bugs/etc. for the test suite itself (as
opposed to problems in make that the suite finds) should be sent to
psmith@gnu.org. Enjoy!
Paul D. Smith
Chris Arthur

42
tests/mkshadow Executable file
View File

@@ -0,0 +1,42 @@
#!/bin/sh
#
# Simple script to make a "shadow" test directory, using symbolic links.
# Typically you'd put the shadow in /tmp or another local disk
#
case "$1" in
"") echo 'Usage: mkshadow <destdir>'; exit 1 ;;
esac
dest="$1"
if [ ! -d "$dest" ]; then
echo "Destination directory \`$dest' must exist!"
exit 1
fi
if [ ! -f run_make_tests ]; then
echo "The current directory doesn't appear to contain the test suite!"
exit 1
fi
suite=`pwd | sed 's%^/tmp_mnt%%'`
name=`basename "$suite"`
files=`echo *`
set -e
mkdir "$dest/$name"
cd "$dest/$name"
ln -s "$suite" .testdir
for f in $files; do
ln -s .testdir/$f .
done
rm -rf work
echo "Shadow test suite created in \`$dest/$name'."
exit 0

2
tests/run_make_tests Executable file
View File

@@ -0,0 +1,2 @@
#!/bin/sh
exec perl $0.pl ${1+"$@"}

225
tests/run_make_tests.pl Executable file
View File

@@ -0,0 +1,225 @@
#!/usr/local/bin/perl
# -*-perl-*-
# Test driver for the Make test suite
# Usage: run_make_tests [testname]
# [-debug]
# [-help]
# [-verbose]
# [-keep]
# [-make <make prog>]
# (and others)
require "test_driver.pl";
sub valid_option
{
local($option) = @_;
if ($option =~ /^-make([-_]?path)?$/)
{
$make_path = shift @argv;
if (!-f $make_path)
{
print "$option $make_path: Not found.\n";
exit 0;
}
return 1;
}
# This doesn't work--it _should_! Someone needs to fix this badly.
#
# elsif ($option =~ /^-work([-_]?dir)?$/)
# {
# $workdir = shift @argv;
# return 1;
# }
return 0;
}
sub run_make_with_options
{
local ($filename,$options,$logname,$expected_code) = @_;
local($code);
local($command) = $make_path;
$expected_code = 0 unless defined($expected_code);
if ($filename)
{
$command .= " -f $filename";
}
if ($options)
{
$command .= " $options";
}
$code = &run_command_with_output($logname,$command);
# Check to see if we have Purify errors. If so, keep the logfile.
# For this to work you need to build with the Purify flag -exit-status=yes
if ($pure_log && -f $pure_log) {
if ($code & 0x7000) {
$code &= ~0x7000;
# If we have a purify log, save it
$tn = $pure_testname . ($num_of_logfiles ? ".$num_of_logfiles" : "");
print("Renaming purify log file to $tn\n") if $debug;
rename($pure_log, "$tn")
|| die "Can't rename $log to $tn: $!\n";
++$purify_errors;
}
else {
unlink($pure_log);
}
}
if ($code != $expected_code)
{
print "Error running $make_path ($code): $command\n";
$test_passed = 0;
return 0;
}
if ($profile & $vos)
{
system "add_profile $make_path";
}
1;
}
sub print_usage
{
&print_standard_usage ("run_make_tests", "[-make_path make_pathname]");
}
sub print_help
{
&print_standard_help ("-make_path",
"\tYou may specify the pathname of the copy of make to run.");
}
sub get_this_pwd {
if ($vos) {
$delete_command = "delete_file";
$__pwd = `++(current_dir)`;
}
else {
$delete_command = "rm";
chop ($__pwd = `pwd`);
}
return $__pwd;
}
sub set_defaults
{
# $profile = 1;
$testee = "GNU make";
$make_path = "make";
$tmpfilesuffix = "mk";
$pwd = &get_this_pwd;
}
sub set_more_defaults
{
local($string);
local($index);
# find the type of the port. We do this up front to have a single
# point of change if it needs to be tweaked.
#
# This is probably not specific enough.
#
if ($osname =~ /Windows/i) {
$port_type = 'W32';
}
# Bleah, the osname is so variable on DOS. This kind of bites.
# Well, as far as I can tell if we check for some text at the
# beginning of the line with either no spaces or a single space, then
# a D, then either "OS", "os", or "ev" and a space. That should
# match and be pretty specific.
elsif ($osname =~ /^([^ ]*|[^ ]* [^ ]*)D(OS|os|ev) /) {
$port_type = 'DOS';
}
# Everything else, right now, is UNIX. Note that we should integrate
# the VOS support into this as well and get rid of $vos; we'll do
# that next time.
else {
$port_type = 'UNIX';
}
# Find the full pathname of Make. For DOS systems this is more
# complicated, so we ask make itself.
$make_path = `sh -c 'echo "all:;\@echo \\\$(MAKE)" | $make_path -f-'`;
chop $make_path;
print "Make\t= `$make_path'\n" if $debug;
$string = `$make_path -v -f /dev/null 2> /dev/null`;
$string =~ /^(GNU Make [^,\n]*)/;
$testee_version = "$1\n";
$string = `sh -c "$make_path -f /dev/null 2>&1"`;
if ($string =~ /(.*): \*\*\* No targets\. Stop\./) {
$make_name = $1;
}
else {
if ($make_path =~ /$pathsep([^\n$pathsep]*)$/) {
$make_name = $1;
}
else {
$make_name = $make_path;
}
}
# prepend pwd if this is a relative path (ie, does not
# start with a slash, but contains one). Thanks for the
# clue, Roland.
if (index ($make_path, ":") != 1 && index ($make_path, "/") > 0)
{
$mkpath = "$pwd$pathsep$make_path";
}
else
{
$mkpath = $make_path;
}
# Get Purify log info--if any.
$ENV{PURIFYOPTIONS} =~ /.*-logfile=([^ ]+)/;
$pure_log = $1 || '';
$pure_log =~ s/%v/$make_name/;
$purify_errors = 0;
$string = `sh -c "$make_path -j 2 -f /dev/null 2>&1"`;
if ($string =~ /not supported/) {
$parallel_jobs = 0;
}
else {
$parallel_jobs = 1;
}
}
sub setup_for_test
{
$makefile = &get_tmpfile;
if (-f $makefile) {
unlink $makefile;
}
# Get rid of any Purify logs.
if ($pure_log) {
($pure_testname = $testname) =~ tr,/,_,;
$pure_testname = "$pure_log.$pure_testname";
system("rm -f $pure_testname*");
print("Purify testfiles are: $pure_testname*\n") if $debug;
}
}
exit !&toplevel;

View File

@@ -0,0 +1,35 @@
$description = "The following test creates a makefile to test comments\n"
."and comment continuation to the next line using a \n"
."backslash within makefiles.";
$details = "To test comments within a makefile, a semi-colon was placed \n"
."after a comment was started. This should not be reported as\n"
."an error since it is within a comment. We then continue the \n"
."comment to the next line using a backslash. To test whether\n"
."the comment really continued, we place an echo command with some\n"
."text on the line which should never execute since it should be \n"
."within a comment\n";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<\EOF;
# Test comment vs semicolon parsing and line continuation
target: # this ; is just a comment \
@echo This is within a comment.
@echo There should be no errors for this makefile.
EOF
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "There should be no errors for this makefile.\n";
# COMPARE RESULTS
&compare_output($answer,&get_logfile(1))

View File

@@ -0,0 +1,67 @@
# -*-perl-*-
$description = "Check GNU make conditionals.";
$details = "Attempt various different flavors of GNU make conditionals.";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<'EOMAKE';
objects = foo.obj
arg1 = first
arg2 = second
arg3 = third
arg4 = cc
arg5 = second
all:
ifeq ($(arg1),$(arg2))
@echo arg1 equals arg2
else
@echo arg1 NOT equal arg2
endif
ifeq '$(arg2)' "$(arg5)"
@echo arg2 equals arg5
else
@echo arg2 NOT equal arg5
endif
ifneq '$(arg3)' '$(arg4)'
@echo arg3 NOT equal arg4
else
@echo arg3 equal arg4
endif
ifndef undefined
@echo variable is undefined
else
@echo variable undefined is defined
endif
ifdef arg4
@echo arg4 is defined
else
@echo arg4 is NOT defined
endif
EOMAKE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile,0);
# Create the answer to what should be produced by this Makefile
$answer = "arg1 NOT equal arg2
arg2 equals arg5
arg3 NOT equal arg4
variable is undefined
arg4 is defined
";
# COMPARE RESULTS
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,65 @@
# -*-perl-*-
$description = "This script tests to make sure that Make looks for
default makefiles in the correct order (GNUmakefile,makefile,Makefile)";
# Create a makefile called "GNUmakefile"
$makefile = "GNUmakefile";
open(MAKEFILE,"> $makefile");
print MAKEFILE "FIRST: ; \@echo It chose GNUmakefile\n";
close(MAKEFILE);
# DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile.
# Just test what we can here (avoid Makefile versus makefile test).
#
if ($port_type eq 'UNIX')
{
# Create another makefile called "makefile"
open(MAKEFILE,"> makefile");
print MAKEFILE "SECOND: ; \@echo It chose makefile\n";
close(MAKEFILE);
}
# Create another makefile called "Makefile"
open(MAKEFILE,"> Makefile");
print MAKEFILE "THIRD: ; \@echo It chose Makefile\n";
close(MAKEFILE);
&run_make_with_options("","",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "It chose GNUmakefile\n";
# COMPARE RESULTS
&compare_output($answer,&get_logfile(1)) || &error("abort");
unlink $makefile;
# DOS/WIN32 platforms preserve case, but Makefile is the same file as makefile.
# Just test what we can here (avoid Makefile versus makefile test).
#
if ($port_type eq 'UNIX')
{
$answer = "It chose makefile\n";
&run_make_with_options("","",&get_logfile);
&compare_output($answer,&get_logfile(1)) || &error("abort");
unlink "makefile";
}
$answer = "It chose Makefile\n";
&run_make_with_options("","",&get_logfile);
&compare_output($answer,&get_logfile(1)) || &error("abort");
unlink "Makefile";

View File

@@ -0,0 +1,48 @@
$description = "The following test creates a makefile to test Double-Colon\n"
."Rules. They are rules which are written with '::' instead\n"
."of ':' after the target names. This tells make that each \n"
."of these rules are independent of the others and each rule's\n"
."commands are executed if the target is older than any \n"
."dependencies of that rule.";
$details = "The makefile created by this test contains two double-colon \n"
."rules for foo; each with their own commands. When make is run,\n"
."each command should be executed in the sequence that they are \n"
."found. The command is a simple echo statement.";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "foo:: bar.h \n"
."\t\@echo Executing rule foo FIRST\n"
."foo2: bar.h \n"
."foo:: bar2.h \n"
."\t\@echo Executing rule foo SECOND\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&touch("bar.h","bar2.h");
&run_make_with_options($makefile,
"",
&get_logfile,
0);
$answer = "Executing rule foo FIRST\n"
."Executing rule foo SECOND\n";
&compare_output($answer,&get_logfile(1));
unlink("bar.h","bar2.h");
1;

View File

@@ -0,0 +1,90 @@
$description = "The following test creates a makefile to test command \n"
."echoing. It tests that when a command line starts with \n"
."a '\@', the echoing of that line is suppressed. It also \n"
."tests the -n option which tells make to ONLY echo the \n"
."commands and no execution happens. In this case, even \n"
."the commands with '\@' are printed. Lastly, it tests the \n"
."-s flag which tells make to prevent all echoing, as if \n"
."all commands started with a '\@'.";
$details = "This test is similar to the 'clean' test except that a '\@' has\n"
."been placed in front of the delete command line. Four tests \n"
."are run here. First, make is run normally and the first echo\n"
."command should be executed. In this case there is no '\@' so \n"
."we should expect make to display the command AND display the \n"
."echoed message. Secondly, make is run with the clean target, \n"
."but since there is a '\@' at the beginning of the command, we\n"
."expect no output; just the deletion of a file which we check \n"
."for. Third, we give the clean target again except this time\n"
."we give make the -n option. We now expect the command to be \n"
."displayed but not to be executed. In this case we need only \n"
."to check the output since an error message would be displayed\n"
."if it actually tried to run the delete command again and the \n"
."file didn't exist. Lastly, we run the first test again with \n"
."the -s option and check that make did not echo the echo \n"
."command before printing the message.";
$example = "EXAMPLE_FILE";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "all: \n";
print MAKEFILE "\techo This makefile did not clean the dir... good\n";
print MAKEFILE "clean: \n";
print MAKEFILE "\t\@$delete_command $example\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&touch($example);
# TEST #1
# -------
&run_make_with_options($makefile,"",&get_logfile,0);
$answer = "echo This makefile did not clean the dir... good\n"
."This makefile did not clean the dir... good\n";
&compare_output($answer,&get_logfile(1));
# TEST #2
# -------
&run_make_with_options($makefile,"clean",&get_logfile,0);
$answer = "";
&compare_output($answer,&get_logfile(1));
if (-f $example)
{
$test_passed = 0;
}
# TEST #3
# -------
&run_make_with_options($makefile,"-n clean",&get_logfile,0);
$answer = "$delete_command $example\n";
&compare_output($answer,&get_logfile(1));
# TEST #4
# -------
&run_make_with_options($makefile,"-s",&get_logfile,0);
$answer = "This makefile did not clean the dir... good\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,93 @@
$description = "The following tests the -i option and the '-' in front of \n"
."commands to test that make ignores errors in these commands\n"
."and continues processing.";
$details = "This test runs two makes. The first runs on a target with a \n"
."command that has a '-' in front of it (and a command that is \n"
."intended to fail) and then a delete command after that is \n"
."intended to succeed. If make ignores the failure of the first\n"
."command as it is supposed to, then the second command should \n"
."delete a file and this is what we check for. The second make\n"
."that is run in this test is identical except that the make \n"
."command is given with the -i option instead of the '-' in \n"
."front of the command. They should run the same. ";
if ($vos)
{
$delete_command = "delete_file";
}
else
{
$delete_command = "rm";
}
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "clean:\n"
."\t-$delete_command cleanit\n"
."\t$delete_command foo\n"
."clean2: \n"
."\t$delete_command cleanit\n"
."\t$delete_command foo\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&touch("foo");
unlink("cleanit");
$cleanit_error = `sh -c "$delete_command cleanit 2>&1"`;
$delete_error_code = $? >> 8;
# TEST #1
# -------
$answer = "$delete_command cleanit\n"
. $cleanit_error
."$make_name: [clean] Error $delete_error_code (ignored)\n"
."$delete_command foo\n";
&run_make_with_options($makefile,"",&get_logfile);
# The output for this on VOS is too hard to replicate, so we only check it
# on unix.
if (!$vos)
{
&compare_output($answer,&get_logfile(1));
}
# If make acted as planned, it should ignore the error from the first
# command in the target and execute the second which deletes the file "foo"
# This file, therefore, should not exist if the test PASSES.
if (-f "foo")
{
$test_passed = 0;
}
&touch("foo");
# TEST #2
# -------
$answer = "$delete_command cleanit\n"
. $cleanit_error
."$make_name: [clean2] Error $delete_error_code (ignored)\n"
."$delete_command foo\n";
&run_make_with_options($makefile,"clean2 -i",&get_logfile);
if (!$vos)
{
&compare_output($answer,&get_logfile(1));
}
if (-f "foo")
{
$test_passed = 0;
}
1;

View File

@@ -0,0 +1,38 @@
$description = "Test various types of escaping in makefiles.";
$details = "Make sure that escaping of `:' works in target names.";
open(MAKEFILE,"> $makefile");
print MAKEFILE '$(path)foo : ; @echo cp $^ $@
';
close(MAKEFILE);
# TEST 1
&run_make_with_options($makefile, "", &get_logfile);
$answer = "cp foo\n";
&compare_output($answer,&get_logfile(1));
# TEST 2: This one should fail, since the ":" is unquoted.
&run_make_with_options($makefile, "path=p:", &get_logfile, 512);
$answer = "$makefile:1: *** target pattern contains no `%'. Stop.\n";
&compare_output($answer,&get_logfile(1));
# TEST 3: This one should work, since we escape the ":".
&run_make_with_options($makefile, "'path=p\\:'", &get_logfile, 0);
$answer = "cp p:foo\n";
&compare_output($answer,&get_logfile(1));
# TEST 4: This one should fail, since the escape char is escaped.
&run_make_with_options($makefile, "'path=p\\\\:'", &get_logfile, 512);
$answer = "$makefile:1: *** target pattern contains no `%'. Stop.\n";
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,58 @@
# -*-mode: perl; rm-trailing-spaces: nil-*-
$description = "Test various forms of the GNU make `include' command.";
$details = "Test include, -include, sinclude and various regressions involving them.
Test extra whitespace at the end of the include, multiple -includes and
sincludes (should not give an error) and make sure that errors are reported
for targets that were also -included.";
$makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The contents of the Makefile ...
print MAKEFILE <<EOF;
\#Extra space at the end of the following file name
include $makefile2
all: ; \@echo There should be no errors for this makefile.
-include nonexistent.mk
-include nonexistent.mk
sinclude nonexistent.mk
sinclude nonexistent-2.mk
-include makeit.mk
sinclude makeit.mk
error: makeit.mk
EOF
close(MAKEFILE);
open(MAKEFILE,"> $makefile2");
print MAKEFILE "ANOTHER: ; \@echo This is another included makefile\n";
close(MAKEFILE);
# Create the answer to what should be produced by this Makefile
&run_make_with_options($makefile, "all", &get_logfile);
$answer = "There should be no errors for this makefile.\n";
&compare_output($answer, &get_logfile(1));
&run_make_with_options($makefile, "ANOTHER", &get_logfile);
$answer = "This is another included makefile\n";
&compare_output($answer, &get_logfile(1));
# Try to build the "error" target; this will fail since we don't know
# how to create makeit.mk, but we should also get a message (even though
# the -include suppressed it during the makefile read phase, we should
# see one during the makefile run phase).
&run_make_with_options($makefile, "error", &get_logfile, 512);
$answer = "$make_name: *** No rule to make target `makeit.mk', needed by `error'.\n";
&compare_output($answer, &get_logfile(1));
1;

View File

@@ -0,0 +1,78 @@
$description = "\
The following test creates a makefile to test the presence
of multiple rules for one target. One file can be the
target of several rules if at most one rule has commands;
the other rules can only have dependencies.";
$details = "\
The makefile created in this test contains two hardcoded rules
for foo.o and bar.o. It then gives another multiple target rule
with the same names as above but adding more dependencies.
Additionally, another variable extradeps is listed as a
dependency but is defined to be null. It can however be defined
on the make command line as extradeps=extra.h which adds yet
another dependency to the targets.";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<EOF;
objects = foo.o bar.o
foo.o : defs.h
bar.o : defs.h test.h
extradeps =
\$(objects) : config.h \$(extradeps)
\t\@echo EXTRA EXTRA
EOF
# END of Contents of MAKEFILE
close(MAKEFILE);
&touch("defs.h","test.h","config.h");
if ($vos)
{
$error_code = 3307;
}
else
{
$error_code = 512;
}
&run_make_with_options($makefile,
"extradeps=extra.h",
&get_logfile,
$error_code);
# Create the answer to what should be produced by this Makefile
$answer = "$make_name: *** No rule to make target `extra.h', needed by `foo.o'. Stop.\n";
&compare_output($answer,&get_logfile(1));
# TEST #2
# -------
&touch("extra.h");
&run_make_with_options($makefile,
"extradeps=extra.h",
&get_logfile,
0);
# Create the answer to what should be produced by this Makefile
$answer = "EXTRA EXTRA\n";
&compare_output($answer,&get_logfile(1));
unlink("defs.h","test.h","config.h","extra.h");
1;

View File

@@ -0,0 +1,46 @@
$description = "The following test creates a makefile to test that a \n "
."rule with multiple targets is equivalent to writing \n"
."many rules, each with one target, and all identical aside\n"
."from that.";
$details = "A makefile is created with one rule and two targets. Make \n"
."is called twice, once for each target, and the output which \n"
."contains the target name with \$@ is looked at for the changes.\n"
."This test also tests the substitute function by replacing \n"
."the word output with nothing in the target name giving either\n"
."an output of \"I am little\" or \"I am big\"";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "bigoutput littleoutput: test.h\n";
print MAKEFILE "\t\@echo I am \$(subst output,,\$@)\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&touch("test.h");
&run_make_with_options($makefile,"bigoutput",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "I am big\n";
&compare_output($answer,&get_logfile(1));
&run_make_with_options($makefile,"littleoutput",&get_logfile);
$answer = "I am little\n";
&compare_output($answer,&get_logfile(1));
unlink "test.h";
1;

View File

@@ -0,0 +1,34 @@
$description = "The following test creates a makefile to ...";
$details = "";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "override define foo\n"
."\@echo First comes the definition.\n"
."\@echo Then comes the override.\n"
."endef\n"
."all: \n"
."\t\$(foo)\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"foo=Hello",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "First comes the definition.\n"
."Then comes the override.\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,100 @@
# -*-perl-*-
$description = "Test parallelism (-j) option.";
$details = "This test creates a makefile with two double-colon default
rules. The first rule has a series of sleep and echo commands
intended to run in series. The second and third have just an
echo statement. When make is called in this test, it is given
the -j option with a value of 4. This tells make that it may
start up to four jobs simultaneously. In this case, since the
first command is a sleep command, the output of the second
and third commands will appear before the first if indeed
make is running all of these commands in parallel.";
if (!$parallel_jobs) {
return -1;
}
if ($vos) {
$delete_command = "delete_file -no_ask";
$sleep_command = "sleep -seconds";
}
else {
$delete_command = "rm -f";
$sleep_command = "sleep";
}
open(MAKEFILE,"> $makefile");
print MAKEFILE <<"EOF";
all : def_1 def_2 def_3
def_1 : ; \@echo ONE; $sleep_command 3 ; echo TWO
def_2 : ; \@$sleep_command 2 ; echo THREE
def_3 : ; \@$sleep_command 1 ; echo FOUR
EOF
close(MAKEFILE);
&run_make_with_options($makefile, "-j 4", &get_logfile);
$answer = "ONE\nFOUR\nTHREE\nTWO\n";
&compare_output($answer, &get_logfile(1));
# Test parallelism with included files. Here we sleep/echo while
# building the included files, to test that they are being built in
# parallel.
$makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile2");
print MAKEFILE <<"EOF";
all: 1 2; \@echo success
-include 1.inc 2.inc
1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo "1: ; \@echo ONE; $sleep_command 2; echo TWO" > \$\@
2.inc: ; \@$sleep_command 1; echo THREE.inc; echo "2: ; \@$sleep_command 1; echo THREE" > \$\@
EOF
close(MAKEFILE);
&run_make_with_options("$makefile2", "-j 4", &get_logfile);
$answer = "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n";
&compare_output($answer, &get_logfile(1));
unlink('1.inc', '2.inc');
# Test parallelism with included files--this time recurse first and make
# sure the jobserver works.
$makefile3 = &get_tmpfile;
open(MAKEFILE,"> $makefile3");
print MAKEFILE <<"EOF";
recurse: ; \@\$(MAKE) --no-print-directory -f $makefile3 INC=yes all
all: 1 2; \@echo success
INC = no
ifeq (\$(INC),yes)
-include 1.inc 2.inc
endif
1.inc: ; \@echo ONE.inc; $sleep_command 2; echo TWO.inc; echo "1: ; \@echo ONE; $sleep_command 2; echo TWO" > \$\@
2.inc: ; \@$sleep_command 1; echo THREE.inc; echo "2: ; \@$sleep_command 1; echo THREE" > \$\@
EOF
close(MAKEFILE);
&run_make_with_options("$makefile3", "-j 4", &get_logfile);
$answer = "ONE.inc\nTHREE.inc\nTWO.inc\nONE\nTHREE\nTWO\nsuccess\n";
&compare_output($answer, &get_logfile(1));
unlink('1.inc', '2.inc');
1;

View File

@@ -0,0 +1,40 @@
# -*-perl-*-
$description = "Test pattern-specific variable settings.";
$details = "\
Create a makefile containing various flavors of pattern-specific variable
settings, override and non-override, and using various variable expansion
rules, semicolon interference, etc.";
open(MAKEFILE,"> $makefile");
print MAKEFILE <<'EOF';
all: one.x two.x three.x
FOO = foo
BAR = bar
BAZ = baz
thr% : override BAZ = three
t%.x: BAR = four
%.x: BAR = two
%.x: override BAZ = three
one.x: override FOO = one
one.x two.x three.x: ; @echo $(FOO) $(BAR) $(BAZ)
EOF
close(MAKEFILE);
# TEST #1 -- basics
&run_make_with_options($makefile, "", &get_logfile);
$answer = "one two three\nfoo four baz\nfoo bar three\n";
&compare_output($answer,&get_logfile(1));
# TEST #2 -- try the override feature
&run_make_with_options($makefile, "BAZ=five", &get_logfile);
$answer = "one two three\nfoo four five\nfoo bar three\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,32 @@
# -*-perl-*-
$description = "The following test creates a makefile to test using \n" .
"quotes within makefiles.";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<'EOM';
SHELL = /bin/sh
TEXFONTS = NICEFONT
DEFINES = -DDEFAULT_TFM_PATH=\".:$(TEXFONTS)\"
test: ; @"echo" 'DEFINES = $(DEFINES)'
EOM
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = 'DEFINES = -DDEFAULT_TFM_PATH=\".:NICEFONT\"' . "\n";
# COMPARE RESULTS
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,61 @@
# -*-perl-*-
$description = "The following test creates a makefile to ...\n";
$details = "DETAILS";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "all: \n"
."\t\$(MAKE) -f $makefile foo \n"
."foo: \n"
."\t\@echo \$(MAKE) \n"
."\t\@echo MAKELEVEL = \$(MAKELEVEL)\n"
."\t\$(MAKE) -f $makefile last \n"
."last: \n"
."\t\@echo \$(MAKE) \n"
."\t\@echo MAKELEVEL = \$(MAKELEVEL) \n"
."\t\@echo THE END\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
if ($vos)
{
$answer = "$make_name: Entering directory \`$pwd\'\n"
."make 'CFLAGS=-O' -f $makefile foo \n"
."make CFLAGS=-O\n"
."MAKELEVEL = 0\n"
."make 'CFLAGS=-O' -f $makefile last \n"
."make CFLAGS=-O\n"
."MAKELEVEL = 0\n"
."THE END\n"
."$make_name: Leaving directory `$pwd'\n";
}
else
{
$answer = "$make_name: Entering directory `$pwd'\n"
."$mkpath -f $makefile foo \n"
."${make_name}[1]: Entering directory `$pwd'\n"
."$mkpath\n"
."MAKELEVEL = 1\n"
."$mkpath -f $makefile last \n"
."${make_name}[2]: Entering directory `$pwd'\n"
."$mkpath\n"
."MAKELEVEL = 2\n"
."THE END\n"
."${make_name}[2]: Leaving directory `$pwd'\n"
."${make_name}[1]: Leaving directory `$pwd'\n"
."$make_name: Leaving directory `$pwd'\n";
}
$mkoptions = "CFLAGS=-O -w";
$mkoptions .= " -j 2" if ($parallel_jobs);
&run_make_with_options($makefile,$mkoptions,&get_logfile,0);
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,91 @@
# -*-mode: perl-*-
$description = "Test GNU make's auto-reinvocation feature.";
$details = "\
If the makefile or one it includes can be rebuilt then it is, and make
is reinvoked. We create a rule to rebuild the makefile from a temp
file, then touch the temp file to make it newer than the makefile.";
$makefile2 = &get_tmpfile;
$makefile_orig = &get_tmpfile;
open(MAKEFILE,"> $makefile");
print MAKEFILE <<EOM;
all: ; \@echo 'running rules.'
$makefile $makefile2: $makefile_orig
\@echo 'rebuilding \$\@.'
\@echo >> \$\@
include $makefile2
EOM
close(MAKEFILE);
&touch($makefile2);
# Sleep 2 seconds for DOS/Windows FAT volumes which have 2-second
# granularity of file times.
sleep(2);
&touch("$makefile_orig");
&run_make_with_options($makefile, "", &get_logfile, 0);
# Create the answer to what should be produced by this Makefile
$answer = "rebuilding $makefile2.\nrebuilding $makefile.\nrunning rules.\n";
&compare_output($answer,&get_logfile(1))
&& unlink "$makefile_orig";
# In this test we create an included file that's out-of-date, but then
# the rule doesn't update it. Make shouldn't re-exec.
$makefile3 = &get_tmpfile;
open(MAKEFILE, "> $makefile3");
print MAKEFILE <<'EOM';
SHELL = /bin/sh
all: ; @echo hello
a : b ; echo >> $@
b : c ; [ -f $@ ] || echo >> $@
c: ; echo >> $@
include $(F)
EOM
close(MAKEFILE);
&touch('a','b');
sleep(2);
&touch('c');
# First try with the file that's not updated "once removed" from the
# file we're including.
&run_make_with_options($makefile3, "F=a", &get_logfile, 0);
$answer = "[ -f b ] || echo >> b\nhello\n";
&compare_output($answer,&get_logfile(1));
# Now try with the file we're not updating being the actual file we're
# including: this and the previous one test different parts of the code.
&run_make_with_options($makefile3, "F=b", &get_logfile, 0);
$answer = "[ -f b ] || echo >> b\nhello\n";
&compare_output($answer,&get_logfile(1));
unlink('a','b','c');
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,71 @@
$description = "The following test creates a makefile to test static \n"
."pattern rules. Static pattern rules are rules which \n"
."specify multiple targets and construct the dependency \n"
."names for each target based on the target name. ";
$details = "The makefile created in this test has three targets. The \n"
."filter command is used to get those target names ending in \n"
.".o and statically creates a compile command with the target\n"
."name and the target name with .c. It also does the same thing\n"
."for another target filtered with .elc and creates a command\n"
."to emacs a .el file";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "files = foo.elc bar.o lose.o \n\n"
."\$(filter %.o,\$(files)): %.o: %.c\n"
."\t\@echo CC -c \$(CFLAGS) \$< -o \$@ \n"
."\$(filter %.elc,\$(files)): %.elc: %.el \n"
."\t\@echo emacs \$< \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&touch("bar.c","lose.c");
# TEST #1
# -------
&run_make_with_options($makefile,
"",
&get_logfile,
0);
# Create the answer to what should be produced by this Makefile
$answer = "CC -c bar.c -o bar.o\n";
&compare_output($answer,&get_logfile(1));
# TEST #2
# -------
&run_make_with_options($makefile,"lose.o",&get_logfile);
$answer = "CC -c lose.c -o lose.o\n";
&compare_output($answer,&get_logfile(1));
# TEST #3
# -------
&touch("foo.el");
&run_make_with_options($makefile,"foo.elc",&get_logfile);
$answer = "emacs foo.el\n";
&compare_output($answer,&get_logfile(1));
unlink("foo.el","bar.c","lose.c");
1;

View File

@@ -0,0 +1,108 @@
# -*-perl-*-
$description = "Test target-specific variable settings.";
$details = "\
Create a makefile containing various flavors of target-specific variable
values, override and non-override, and using various variable expansion
rules, semicolon interference, etc.";
open(MAKEFILE,"> $makefile");
print MAKEFILE <<'EOF';
SHELL = /bin/sh
export FOO = foo
export BAR = bar
one: override FOO = one
one two: ; @echo $(FOO) $(BAR)
two: BAR = two
three: ; BAR=1000
@echo $(FOO) $(BAR)
# Some things that shouldn't be target vars
funk : override
funk : override adelic
adelic override : ; echo $@
# Test per-target recursive variables
four:FOO=x
four:VAR$(FOO)=ok
four: ; @echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx)'
five:FOO=x
five six : VAR$(FOO)=good
five six: ;@echo '$(FOO) $(VAR$(FOO)) $(VAR) $(VARx) $(VARfoo)'
# Test per-target variable inheritance
seven: eight
seven eight: ; @echo $@: $(FOO) $(BAR)
seven: BAR = seven
seven: FOO = seven
eight: BAR = eight
# Test the export keyword with per-target variables
nine: ; @echo $(FOO) $(BAR) $$FOO $$BAR
nine: FOO = wallace
# Test = escaping
EQ = =
ten: one\=two
ten: one \= two
ten one$(EQ)two $(EQ):;@echo $@
.PHONY: one two three four five six seven eight nine ten $(EQ) one$(EQ)two
# Test target-specific vars with pattern/suffix rules
QVAR = qvar
RVAR = =
%.q : ; @echo $(QVAR) $(RVAR)
foo.q : RVAR += rvar
# Target-specific vars with multiple LHS pattern rules
%.r %.s %.t: ; @echo $(QVAR) $(RVAR) $(SVAR) $(TVAR)
foo.r : RVAR += rvar
foo.t : TVAR := $(QVAR)
EOF
close(MAKEFILE);
# TEST #1
&run_make_with_options($makefile, "one two three", &get_logfile);
$answer = "one bar\nfoo two\nBAR=1000\nfoo bar\n";
&compare_output($answer,&get_logfile(1));
# TEST #2
&run_make_with_options($makefile, "one two FOO=1 BAR=2", &get_logfile);
$answer = "one 2\n1 2\n";
&compare_output($answer,&get_logfile(1));
# TEST #3
&run_make_with_options($makefile, "four", &get_logfile);
$answer = "x ok ok\n";
&compare_output($answer,&get_logfile(1));
# TEST #4
&run_make_with_options($makefile, "seven", &get_logfile);
$answer = "eight: seven eight\nseven: seven seven\n";
&compare_output($answer,&get_logfile(1));
# TEST #5
&run_make_with_options($makefile, "nine", &get_logfile);
$answer = "wallace bar wallace bar\n";
&compare_output($answer,&get_logfile(1));
# TEST #6
&run_make_with_options($makefile, "ten", &get_logfile);
$answer = "one=two\none bar\n=\nfoo two\nten\n";
&compare_output($answer,&get_logfile(1));
# TEST #6
&run_make_with_options($makefile, "foo.q bar.q", &get_logfile);
$answer = "qvar = rvar\nqvar =\n";
&compare_output($answer,&get_logfile(1));
# TEST #7
&run_make_with_options($makefile, "foo.t bar.s", &get_logfile);
$answer = "qvar = qvar\nqvar =\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,34 @@
$description = "The following test creates a makefile to ...";
$details = "";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "x = variable1\n"
."variable2 := Hello\n"
."y = \$(subst 1,2,\$(x))\n"
."z = y\n"
."a := \$(\$(\$(z)))\n"
."all: \n"
."\t\@echo \$(a)\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "Hello\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,62 @@
$description = "The following test creates a makefile to test the \n"
."vpath directive which allows you to specify a search \n"
."path for a particular class of filenames, those that\n"
."match a particular pattern.";
$details = "This tests the vpath directive by specifying search directories\n"
."for one class of filenames with the form: vpath pattern directories"
."\nIn this test, we specify the working directory for all files\n"
."that end in c or h. We also test the variables $@ (which gives\n"
."target name) and $^ (which is a list of all dependencies \n"
."including the directories in which they were found). It also\n"
."uses the function firstword used to extract just the first\n"
."dependency from the entire list.";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "vpath %.c foo\n";
print MAKEFILE "vpath %.c $workdir\n";
print MAKEFILE "vpath %.h $workdir\n";
print MAKEFILE "objects = main.o kbd.o commands.o display.o insert.o\n";
print MAKEFILE "edit: \$(objects)\n";
print MAKEFILE "\t\@echo cc -o \$@ \$^\n";
print MAKEFILE "main.o : main.c defs.h\n";
print MAKEFILE "\t\@echo cc -c \$(firstword \$^)\n";
print MAKEFILE "kbd.o : kbd.c defs.h command.h\n";
print MAKEFILE "\t\@echo cc -c kbd.c\n";
print MAKEFILE "commands.o : command.c defs.h command.h\n";
print MAKEFILE "\t\@echo cc -c commands.c\n";
print MAKEFILE "display.o : display.c defs.h buffer.h\n";
print MAKEFILE "\t\@echo cc -c display.c\n";
print MAKEFILE "insert.o : insert.c defs.h buffer.h\n";
print MAKEFILE "\t\@echo cc -c insert.c\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
"$workdir${pathsep}kbd.c","$workdir${pathsep}command.h",
"$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
"$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c",
"$workdir${pathsep}command.c");
&touch(@files_to_touch);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "cc -c $workdir${pathsep}main.c\ncc -c kbd.c\ncc -c commands.c\n"
."cc -c display.c\n"
."cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o "
."insert.o\n";
if (&compare_output($answer,&get_logfile(1)))
{
unlink @files_to_touch;
}
1;

View File

@@ -0,0 +1,45 @@
$description = "This is part 2 in a series to test the vpath directive\n"
."It tests the three forms of the directive:\n"
." vpath pattern directive\n"
." vpath pattern (clears path associated with pattern)\n"
." vpath (clears all paths specified with vpath)\n";
$details = "This test simply adds many search paths using various vpath\n"
."directive forms and clears them afterwards. It has a simple\n"
."rule to print a message at the end to confirm that the makefile\n"
."ran with no errors.\n";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "VPATH = $workdir:$sourcedir\n";
print MAKEFILE "vpath %.c foo\n";
print MAKEFILE "vpath %.c $workdir\n";
print MAKEFILE "vpath %.c $sourcedir\n";
print MAKEFILE "vpath %.h $workdir\n";
print MAKEFILE "vpath %.c\n";
print MAKEFILE "vpath\n";
print MAKEFILE "all:\n";
print MAKEFILE "\t\@echo ALL IS WELL\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "ALL IS WELL\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,64 @@
# -*-perl-*-
$description = "Tests VPATH+/GPATH functionality.";
$details = "";
$VP = "$workdir$pathsep";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "VPATH = $VP\n";
print MAKEFILE <<'EOMAKE';
GPATH = $(VPATH)
.SUFFIXES: .a .b .c .d
.PHONY: general rename notarget intermediate
%.a:
%.b:
%.c:
%.d:
%.a : %.b ; cat $^ > $@
%.b : %.c ; cat $^ > $@
%.c :: %.d ; cat $^ > $@
# General testing info:
general: foo.b
foo.b: foo.c bar.c
EOMAKE
close(MAKEFILE);
@touchedfiles = ();
sub touchfiles {
foreach (@_) {
($f = $_) =~ s,VP/,$VP,g;
&touch($f);
push(@touchedfiles, $f);
sleep(1);
}
}
# Run the general-case test
&touchfiles("VP/foo.d", "VP/bar.d", "VP/foo.c", "VP/bar.c", "foo.b", "bar.d");
&run_make_with_options($makefile,"general",&get_logfile());
push(@touchedfiles, "bar.c");
$answer = "$make_name: Nothing to be done for `general'.\n";
&compare_output($answer,&get_logfile(1));
unlink(@touchedfiles) unless $keep;
1;

View File

@@ -0,0 +1,125 @@
# -*-perl-*-
$description = "Tests the new VPATH+ functionality added in 3.76.";
$details = "";
$VP = "$workdir$pathsep";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "VPATH = $VP\n";
print MAKEFILE <<'EOMAKE';
SHELL = /bin/sh
.SUFFIXES: .a .b .c .d
.PHONY: general rename notarget intermediate
%.a:
%.b:
%.c:
%.d:
%.a : %.b
cat $^ > $@
%.b : %.c
cat $^ > $@ 2>/dev/null || exit 1
%.c :: %.d
cat $^ > $@
# General testing info:
general: foo.b
foo.b: foo.c bar.c
# Rename testing info:
rename: $(VPATH)/foo.c foo.d
# Target not made testing info:
notarget: notarget.b
notarget.c: notarget.d
-@echo "not creating $@ from $^"
# Intermediate files:
intermediate: inter.a
EOMAKE
close(MAKEFILE);
@touchedfiles = ();
sub touchfiles {
foreach (@_) {
($f = $_) =~ s,VP/,$VP,g;
&touch($f);
push(@touchedfiles, $f);
# Sleep 2 seconds for DOS/Windows FAT volumes which have 2-second
# granularity of file times.
sleep(2);
}
}
# Run the general-case test
&touchfiles("VP/foo.d", "VP/bar.d", "VP/foo.c", "VP/bar.c", "foo.b", "bar.d");
&run_make_with_options($makefile,"general",&get_logfile);
push(@touchedfiles, "bar.c");
$answer = "cat bar.d > bar.c
cat ${VP}foo.c bar.c > foo.b 2>/dev/null || exit 1
";
&compare_output($answer,&get_logfile(1));
# Test rules that don't make the target correctly
&touchfiles("VP/notarget.c", "notarget.b", "notarget.d");
&run_make_with_options($makefile,"notarget",&get_logfile,512);
$answer = "not creating notarget.c from notarget.d
cat notarget.c > notarget.b 2>/dev/null || exit 1
$make_name: *** [notarget.b] Error 1
";
&compare_output($answer,&get_logfile(1));
# Test intermediate file handling (part 1)
&touchfiles("VP/inter.d");
&run_make_with_options($makefile,"intermediate",&get_logfile);
push(@touchedfiles, "inter.a", "inter.b");
$answer = "cat ${VP}inter.d > inter.c
cat inter.c > inter.b 2>/dev/null || exit 1
cat inter.b > inter.a
rm inter.b inter.c
";
&compare_output($answer,&get_logfile(1));
# Test intermediate file handling (part 2)
&touchfiles("VP/inter.b", "VP/inter.d");
&run_make_with_options($makefile,"intermediate",&get_logfile);
$answer = "cat ${VP}inter.d > inter.c
cat inter.c > inter.b 2>/dev/null || exit 1
cat inter.b > inter.a
rm inter.c
";
&compare_output($answer,&get_logfile(1));
unlink @touchedfiles unless $keep;
1;

View File

@@ -0,0 +1,44 @@
$description = "The following test creates a makefile to test the addprefix "
."function.";
$details = "";
# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
# EXAMPLE: $makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "string := \$(addprefix src${pathsep},a.b.z.foo hacks) \n"
."all: \n"
."\t\@echo \$(string) \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile,0);
# Create the answer to what should be produced by this Makefile
$answer = "src${pathsep}a.b.z.foo src${pathsep}hacks\n";
# COMPARE RESULTS
# In this call to compare output, you should use the call &get_logfile(1)
# to send the name of the last logfile created. You may also use
# the special call &get_logfile(1) which returns the same as &get_logfile(1).
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,44 @@
$description = "The following test creates a makefile to test the addsuffix "
."function.";
$details = "";
# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
# EXAMPLE: $makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "string := \$(addsuffix .c,src${pathsep}a.b.z.foo hacks) \n"
."all: \n"
."\t\@echo \$(string) \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile,0);
# Create the answer to what should be produced by this Makefile
$answer = "src${pathsep}a.b.z.foo.c hacks.c\n";
# COMPARE RESULTS
# In this call to compare output, you should use the call &get_logfile(1)
# to send the name of the last logfile created. You may also use
# the special call &get_logfile(1) which returns the same as &get_logfile(1).
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,44 @@
$description = "The following test creates a makefile to test the suffix "
."function.";
$details = "";
# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
# EXAMPLE: $makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "string := \$(basename src${pathsep}a.b.z.foo.c src${pathsep}hacks src.bar${pathsep}a.b.z.foo.c src.bar${pathsep}hacks hacks) \n"
."all: \n"
."\t\@echo \$(string) \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile,0);
# Create the answer to what should be produced by this Makefile
$answer = "src${pathsep}a.b.z.foo src${pathsep}hacks src.bar${pathsep}a.b.z.foo src.bar${pathsep}hacks hacks\n";
# COMPARE RESULTS
# In this call to compare output, you should use the call &get_logfile(1)
# to send the name of the last logfile created. You may also use
# the special call &get_logfile(1) which returns the same as &get_logfile(1).
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,38 @@
# -*-perl-*-
$description = "Test the call function.\n";
$details = "Try various uses of call and ensure they all give the correct
results.\n";
open(MAKEFILE, "> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<'EOMAKE';
# Simple, just reverse something
#
reverse = $2 $1
# A complex `map' function, using recursive `call'.
#
map = $(foreach a,$2,$(call $1,$a))
# Test using a builtin; this is silly as it's simpler to do without call
#
my-notdir = $(call notdir,$(1))
all: ; @echo '$(call reverse,bar,foo)'; \
echo '$(call map,origin,MAKE reverse map)'; \
echo '$(call my-notdir,a/b c/d e/f)'
EOMAKE
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile, "", &get_logfile);
$answer = "foo bar\ndefault file file\nb d f\n";
&compare_output($answer, &get_logfile(1));
1;

View File

@@ -0,0 +1,44 @@
$description = "The following test creates a makefile to test the dir "
."function.";
$details = "";
# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
# EXAMPLE: $makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "string := \$(dir src${pathsep}foo.c hacks) \n"
."all: \n"
."\t\@echo \$(string) \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile,0);
# Create the answer to what should be produced by this Makefile
$answer = "src${pathsep} .${pathsep}\n";
# COMPARE RESULTS
# In this call to compare output, you should use the call &get_logfile(1)
# to send the name of the last logfile created. You may also use
# the special call &get_logfile(1) which returns the same as &get_logfile(1).
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,63 @@
$description = "\
The following test creates a makefile to test the error function.";
$details = "";
open(MAKEFILE,"> $makefile");
print MAKEFILE <<'EOF';
ifdef ERROR1
$(error error is $(ERROR1))
endif
ifdef ERROR2
$(error error is $(ERROR2))
endif
ifdef ERROR3
all: some; @echo $(error error is $(ERROR3))
endif
ifdef ERROR4
all: some; @echo error is $(ERROR4)
@echo $(error error is $(ERROR4))
endif
some: ; @echo Some stuff
EOF
close(MAKEFILE);
# Test #1
&run_make_with_options($makefile, "ERROR1=yes", &get_logfile, 512);
$answer = "$makefile:2: *** error is yes. Stop.\n";
&compare_output($answer,&get_logfile(1));
# Test #2
&run_make_with_options($makefile, "ERROR2=no", &get_logfile, 512);
$answer = "$makefile:6: *** error is no. Stop.\n";
&compare_output($answer,&get_logfile(1));
# Test #3
&run_make_with_options($makefile, "ERROR3=maybe", &get_logfile, 512);
$answer = "Some stuff\n$makefile:10: *** error is maybe. Stop.\n";
&compare_output($answer,&get_logfile(1));
# Test #4
&run_make_with_options($makefile, "ERROR4=definitely", &get_logfile, 512);
$answer = "Some stuff\n$makefile:14: *** error is definitely. Stop.\n";
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,35 @@
$description = "The following test creates a makefile to test static \n"
."pattern rules. Static pattern rules are rules which \n"
."specify multiple targets and construct the dependency \n"
."names for each target based on the target name. ";
$details = "The makefile created in this test has three targets. The \n"
."filter command is used to get those target names ending in \n"
.".o and statically creates a compile command with the target\n"
."name and the target name with .c. It also does the same thing\n"
."for another target filtered with .elc and creates a command\n"
."to emacs a .el file";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "files := \$(filter-out %.o, foo.elc bar.o lose.o) \n"
."all: \n"
."\t\@echo \$(files) \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,
"",
&get_logfile,
0);
# Create the answer to what should be produced by this Makefile
$answer = "foo.elc\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,47 @@
$description = "The following test creates a makefile to test the findstring "
."function.";
$details = "";
# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
# EXAMPLE: $makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "string := \$(findstring port, reporter)\n"
."all: \n"
."\t\@echo \$(string) \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,
"",
&get_logfile,
0);
# Create the answer to what should be produced by this Makefile
$answer = "port\n";
# COMPARE RESULTS
# In this call to compare output, you should use the call &get_logfile(1)
# to send the name of the last logfile created. You may also use
# the special call &get_logfile(1) which returns the same as &get_logfile(1).
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,53 @@
# -*-perl-*-
# Updated 6.16.93 variable "MAKE" is default was environment override
# For make 3.63 and above
$description = "The following test creates a makefile to verify
test the foreach function.";
$details = "This is a test of the foreach function in gnu make.
This function starts with a space separated list of
names and a variable. Each name in the list is subsituted
into the variable and the given text evaluated. The general
form of the command is $(foreach var,$list,$text). Several
types of foreach loops are tested\n";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
# On WIN32 systems, the user's path is found in %Path% ($Path)
#
$pathvar = (($port_type eq 'Windows') ? "Path" : "PATH");
print MAKEFILE <<EOF;
foo = bletch null \@ garf
null :=
space = ' '
auto_var = udef space CC null $pathvar MAKE foo CFLAGS WHITE \@ <
av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
override WHITE := BLACK
for_var = \$(addsuffix .c,foo \$(null) \$(foo) \$(space) \$(av) )
fe = \$(foreach var2, \$(for_var),\$(subst .c,.o, \$(var2) ) )
all: auto for2
auto :
\t\@echo \$(av)
for2:
\t\@echo \$(fe)
EOF
close(MAKEFILE);
&run_make_with_options($makefile,
"-e WHITE=WHITE CFLAGS=",
&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "undefined file default file environment default file command line override automatic automatic
foo.o bletch.o null.o @.o garf.o .o .o undefined.o file.o default.o file.o environment.o default.o file.o command.o line.o override.o automatic.o automatic.o\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,31 @@
# -*-perl-*-
$description = "Test the if function.\n";
$details = "Try various uses of if and ensure they all give the correct
results.\n";
open(MAKEFILE, "> $makefile");
print MAKEFILE <<EOMAKE;
NEQ = \$(subst \$1,,\$2)
all:
\t\@echo \$(if ,true,false)
\t\@echo \$(if ,true,)
\t\@echo \$(if ,true)
\t\@echo \$(if z,true,false)
\t\@echo \$(if z,true,\$(shell echo hi))
\t\@echo \$(if ,\$(shell echo hi),false)
\t\@echo \$(if \$(call NEQ,a,b),true,false)
\t\@echo \$(if \$(call NEQ,a,a),true,false)
\t\@echo \$(if z,true,fal,se)
\t\@echo \$(if ,true,fal,se)
EOMAKE
close(MAKEFILE);
&run_make_with_options($makefile, "", &get_logfile);
$answer = "false\n\n\ntrue\ntrue\nfalse\ntrue\nfalse\ntrue\nfal,se\n";
&compare_output($answer, &get_logfile(1));
1;

View File

@@ -0,0 +1,44 @@
$description = "The following test creates a makefile to test the join "
."function.";
$details = "";
# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
# EXAMPLE: $makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "string := \$(join a b c,foo hacks .pl1) \n"
."all: \n"
."\t\@echo \$(string) \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile,0);
# Create the answer to what should be produced by this Makefile
$answer = "afoo bhacks c.pl1\n";
# COMPARE RESULTS
# In this call to compare output, you should use the call &get_logfile(1)
# to send the name of the last logfile created. You may also use
# the special call &get_logfile(1) which returns the same as &get_logfile(1).
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,44 @@
$description = "The following test creates a makefile to test the notdir "
."function.";
$details = "";
# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
# EXAMPLE: $makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "string := \$(notdir ${pathsep}src${pathsep}foo.c hacks) \n"
."all: \n"
."\t\@echo \$(string) \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile,0);
# Create the answer to what should be produced by this Makefile
$answer = "foo.c hacks\n";
# COMPARE RESULTS
# In this call to compare output, you should use the call &get_logfile(1)
# to send the name of the last logfile created. You may also use
# the special call &get_logfile(1) which returns the same as &get_logfile(1).
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,66 @@
# -*-perl-*-
$description = "Test the origin function.";
$details = "This is a test of the origin function in gnu make.
This function will report on where a variable was
defined per the following list:
'undefined' never defined
'default' default definition
'environment' environment var without -e
'environment override' environment var with -e
'file' defined in makefile
'command line' defined on the command line
'override' defined by override in makefile
'automatic' Automatic variable\n";
# On WIN32 systems, HOME is meaningless. SystemRoot should be defined
# though. With DJGPP, HOME is not guaranteed to be defined. Use DJDIR
# instead.
#
$homevar = (($port_type eq 'Windows') ? "SystemRoot"
: (($port_type eq 'DOS') ? "DJDIR"
: "HOME"));
open(MAKEFILE,"> $makefile");
print MAKEFILE <<EOF;
foo := bletch garf
auto_var = udef CC $homevar MAKE foo CFLAGS WHITE \@
av = \$(foreach var, \$(auto_var), \$(origin \$(var)) )
override WHITE := BLACK
all: auto
\t\@echo \$(origin undefined)
\t\@echo \$(origin CC)
\t\@echo \$(origin $homevar)
\t\@echo \$(origin MAKE)
\t\@echo \$(origin foo)
\t\@echo \$(origin CFLAGS)
\t\@echo \$(origin WHITE)
\t\@echo \$(origin \@)
auto :
\t\@echo \$(av)
EOF
close(MAKEFILE);
&run_make_with_options($makefile,
"-e WHITE=WHITE CFLAGS=",
&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "undefined default environment default file command line override automatic
undefined
default
environment
default
file
command line
override
automatic\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,55 @@
$description = "The following test creates a makefile to verify\n"
."the ability of make to sort lists of object. Sort\n"
."will also remove any duplicate entries. This will also\n"
."be tested.";
$details = "The make file is built with a list of object in a random order\n"
."and includes some duplicates. Make should sort all of the elements\n"
."remove all duplicates\n";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "foo := moon_light days \n"
."foo1:= jazz\n"
."bar := captured \n"
."bar2 = boy end, has rise A midnight \n"
."bar3:= \$(foo)\n"
."s1 := _by\n"
."s2 := _and_a\n"
."t1 := \$(addsuffix \$(s1), \$(bar) )\n"
."t2 := \$(addsuffix \$(s2), \$(foo1) )\n"
."t3 := \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \$(t2) \n"
."t4 := \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \$(t3) \n"
."t5 := \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \$(t4) \n"
."t6 := \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \$(t5) \n"
."t7 := \$(t6) \$(t6) \$(t6) \n"
."p1 := \$(addprefix \$(foo1), \$(s2) )\n"
."blank:= \n"
."all:\n"
."\t\@echo \$(sort \$(bar2) \$(foo) \$(addsuffix \$(s1), \$(bar) ) \$(t2) \$(bar2) \$(bar3))\n"
."\t\@echo \$(sort \$(blank) \$(foo) \$(bar2) \$(t1) \$(p1) )\n"
."\t\@echo \$(sort \$(foo) \$(bar2) \$(t1) \$(t4) \$(t5) \$(t7) \$(t6) )\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "A boy captured_by days end, has jazz_and_a midnight moon_light rise\n"
."A boy captured_by days end, has jazz_and_a midnight moon_light rise\n"
."A boy captured_by days end, has jazz_and_a midnight moon_light rise\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,53 @@
# -*-perl-*-
$description = "The following test creates a makefile to verify
the ability of make to strip white space from lists of object.\n";
$details = "The make file is built with a list of objects that contain white space
These are then run through the strip command to remove it. This is then
verified by echoing the result.\n";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<'EOMAKE';
TEST1 := "Is this TERMINAL fun? What makes you believe is this terminal fun? JAPAN is a WONDERFUL planet -- I wonder if we will ever reach their level of COMPARATIVE SHOPPING..."
E :=
TEST2 := $E try this and this $E
define TEST3
and these test out
some
blank lines
endef
.PHONY: all
all:
@echo '$(strip $(TEST1) )'
@echo '$(strip $(TEST2) )'
@echo '$(strip $(TEST3) )'
EOMAKE
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "\"Is this TERMINAL fun? What makes you believe is this terminal fun? JAPAN is a WONDERFUL planet -- I wonder if we will ever reach their level of COMPARATIVE SHOPPING...\"
try this and this
and these test out some blank lines
";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,37 @@
$description = "The following test creates a makefile to ...";
$details = "";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "foo := a.o b.o c.o\n"
."bar := \$(foo:.o=.c)\n"
."bar2:= \$(foo:%.o=%.c)\n"
."bar3:= \$(patsubst %.c,%.o,x.c.c bar.c)\n"
."all:\n"
."\t\@echo \$(bar)\n"
."\t\@echo \$(bar2)\n"
."\t\@echo \$(bar3)\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "a.c b.c c.c\n"
."a.c b.c c.c\n"
."x.c.o bar.o\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,57 @@
$description = "The following test creates a makefile to test the suffix\n"
."function. \n";
$details = "The suffix function will return the string following the last _._\n"
."the list provided. It will provide all of the unique suffixes found\n"
."in the list. The long strings are sorted to remove duplicates.\n";
# IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
# THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
# HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
# EXAMPLE: $makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "string := word.pl general_test2.pl1 FORCE.pl word.pl3 generic_test.perl /tmp.c/bar foo.baz/bar.c MAKEFILES_variable.c\n"
."string2 := \$(string) \$(string) \$(string) \$(string) \$(string) \$(string) \$(string)\n"
."string3 := \$(string2) \$(string2) \$(string2) \$(string2) \$(string2) \$(string2) \$(string2)\n"
."string4 := \$(string3) \$(string3) \$(string3) \$(string3) \$(string3) \$(string3) \$(string3)\n"
."all: \n"
."\t\@echo \$(suffix \$(string)) \n"
."\t\@echo \$(sort \$(suffix \$(string4))) \n"
."\t\@echo \$(suffix \$(string) a.out) \n"
."\t\@echo \$(sort \$(suffix \$(string3))) \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile,0);
# Create the answer to what should be produced by this Makefile
# COMPARE RESULTS
$answer = ".pl .pl1 .pl .pl3 .perl .c .c\n"
.".c .perl .pl .pl1 .pl3\n"
.".pl .pl1 .pl .pl3 .perl .c .c .out\n"
.".c .perl .pl .pl1 .pl3\n";
# In this call to compare output, you should use the call &get_logfile(1)
# to send the name of the last logfile created. You may also use
# the special call &get_logfile(1) which returns the same as &get_logfile(1).
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,63 @@
$description = "\
The following test creates a makefile to test the warning function.";
$details = "";
open(MAKEFILE,"> $makefile");
print MAKEFILE <<'EOF';
ifdef WARNING1
$(warning warning is $(WARNING1))
endif
ifdef WARNING2
$(warning warning is $(WARNING2))
endif
ifdef WARNING3
all: some; @echo hi $(warning warning is $(WARNING3))
endif
ifdef WARNING4
all: some; @echo hi
@echo there $(warning warning is $(WARNING4))
endif
some: ; @echo Some stuff
EOF
close(MAKEFILE);
# Test #1
&run_make_with_options($makefile, "WARNING1=yes", &get_logfile, 0);
$answer = "$makefile:2: warning is yes\nSome stuff\n";
&compare_output($answer,&get_logfile(1));
# Test #2
&run_make_with_options($makefile, "WARNING2=no", &get_logfile, 0);
$answer = "$makefile:6: warning is no\nSome stuff\n";
&compare_output($answer,&get_logfile(1));
# Test #3
&run_make_with_options($makefile, "WARNING3=maybe", &get_logfile, 0);
$answer = "Some stuff\n$makefile:10: warning is maybe\nhi\n";
&compare_output($answer,&get_logfile(1));
# Test #4
&run_make_with_options($makefile, "WARNING4=definitely", &get_logfile, 0);
$answer = "Some stuff\n$makefile:14: warning is definitely\nhi\nthere\n";
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,103 @@
# -*-perl-*-
$description = "The following test creates a makefile to test wildcard\n"
."expansions and the ability to put a command on the same\n"
."line as the target name separated by a semi-colon.";
$details = "This test creates 4 files by the names of 1.example, \n"
."two.example and 3.example. We execute three tests. The first\n"
."executes the print1 target which tests the '*' wildcard by \n"
."echoing all filenames by the name of '*.example'. The second\n"
."test echo's all files which match '?.example' and \n"
."[a-z0-9].example. Lastly we clean up all of the files using\n"
."the '*' wildcard as in the first test";
if ($vos)
{
$delete_command = "delete_file -no_ask";
}
else
{
$delete_command = "rm";
}
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE <<EOM;
print1: ;\@echo \$(wildcard example.*)
print2:
\t\@echo \$(wildcard example.?)
\t\@echo \$(wildcard example.[a-z0-9])
\t\@echo \$(wildcard example.[!A-Za-z_\\!])
clean:
\t$delete_command \$(wildcard example.*)
EOM
# END of Contents of MAKEFILE
close(MAKEFILE);
&touch("example.1");
&touch("example.two");
&touch("example.3");
&touch("example.for");
&touch("example._");
# TEST #1
# -------
$answer = "example.1 example.3 example._ example.for example.two\n";
&run_make_with_options($makefile,"print1",&get_logfile);
&compare_output($answer,&get_logfile(1));
# TEST #2
# -------
$answer = "example.1 example.3 example._\n"
."example.1 example.3\n"
."example.1 example.3\n";
&run_make_with_options($makefile,"print2",&get_logfile);
&compare_output($answer,&get_logfile(1));
# TEST #3
# -------
$answer = "$delete_command example.1 example.3 example._ example.for example.two";
if ($vos)
{
$answer .= " \n";
}
else
{
$answer .= "\n";
}
&run_make_with_options($makefile,"clean",&get_logfile);
&compare_output($answer,&get_logfile(1));
if ((-f "example.1")||(-f "example.two")||(-f "example.3")||(-f "example.for"))
{
$test_passed = 0;
}
1;

View File

@@ -0,0 +1,70 @@
$description = "The following test creates a makefile to test the word, words,\n"
."and wordlist functions.\n";
$details = "The word function will return the number of words in a variable or\n"
."the word specified. The test will produce a variable with a large\n"
."number of words in it, determine the number of word and then read\n"
."each one back.\n";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "string := word.pl general_test2.pl FORCE.pl word.pl generic_test.perl MAKEFILES_variable.pl \n"
."string2 := \$(string) \$(string) \$(string) \$(string) \$(string) \$(string) \$(string)\n"
."string3 := \$(string2) \$(string2) \$(string2) \$(string2) \$(string2) \$(string2) \$(string2)\n"
."string4 := \$(string3) \$(string3) \$(string3) \$(string3) \$(string3) \$(string3) \$(string3)\n"
."all: \n"
."\t\@echo \$(words \$(string)) \n"
."\t\@echo \$(words \$(string4)) \n"
."\t\@echo \$(word 1, \$(string)) \n"
."\t\@echo \$(word 100, \$(string)) \n"
."\t\@echo \$(word 1, \$(string)) \n"
."\t\@echo \$(word 1000, \$(string3)) \n"
."\t\@echo \$(wordlist 3, 4, \$(string)) \n"
."\t\@echo \$(wordlist 4, 3, \$(string)) \n"
."\t\@echo \$(wordlist 1, 6, \$(string)) \n"
."\t\@echo \$(wordlist 7, 5, \$(string)) \n"
."\t\@echo \$(wordlist 100, 110, \$(string)) \n"
."\t\@echo \$(wordlist 7, 10, \$(string2)) \n"
;
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile,0);
# Create the answer to what should be produced by this Makefile
# COMPARE RESULTS
$answer = "6\n"
."2058\n"
."word.pl\n"
."\n"
."word.pl\n"
."\n"
."FORCE.pl word.pl\n"
."FORCE.pl word.pl\n"
."word.pl general_test2.pl FORCE.pl word.pl generic_test.perl MAKEFILES_variable.pl\n"
."generic_test.perl MAKEFILES_variable.pl\n"
."\n"
."word.pl general_test2.pl FORCE.pl word.pl\n"
;
# In this call to compare output, you should use the call &get_logfile(1)
# to send the name of the last logfile created. You may also use
# the special call &get_logfile(1) which returns the same as &get_logfile(1).
&compare_output($answer,&get_logfile(1));
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,51 @@
# -*-perl-*-
$description = "The following test creates a makefile to test the
simple functionality of make. It mimics the
rebuilding of a product with dependencies.
It also tests the simple definition of VPATH.";
open(MAKEFILE,"> $makefile");
print MAKEFILE <<EOF;
VPATH = $workdir
edit: main.o kbd.o commands.o display.o \\
insert.o
\t\@echo cc -o edit main.o kbd.o commands.o display.o \\
insert.o
main.o : main.c defs.h
\t\@echo cc -c main.c
kbd.o : kbd.c defs.h command.h
\t\@echo cc -c kbd.c
commands.o : command.c defs.h command.h
\t\@echo cc -c commands.c
display.o : display.c defs.h buffer.h
\t\@echo cc -c display.c
insert.o : insert.c defs.h buffer.h
\t\@echo cc -c insert.c
EOF
close(MAKEFILE);
@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
"$workdir${pathsep}kbd.c","$workdir${pathsep}command.h",
"$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
"$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c",
"$workdir${pathsep}command.c");
&touch(@files_to_touch);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "cc -c main.c\ncc -c kbd.c\ncc -c commands.c\ncc -c display.c
cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o insert.o\n";
# COMPARE RESULTS
if (&compare_output($answer,&get_logfile(1))) {
unlink @files_to_touch;
}
1;

View File

@@ -0,0 +1,50 @@
# -*-perl-*-
$description = "The following test creates a makefile to test the
simple functionality of make. It is the same as
general_test1 except that this one tests the
definition of a variable to hold the object filenames.";
open(MAKEFILE,"> $makefile");
# The contents of the Makefile ...
print MAKEFILE <<EOF;
VPATH = $workdir
objects = main.o kbd.o commands.o display.o insert.o
edit: \$(objects)
\t\@echo cc -o edit \$(objects)
main.o : main.c defs.h
\t\@echo cc -c main.c
kbd.o : kbd.c defs.h command.h
\t\@echo cc -c kbd.c
commands.o : command.c defs.h command.h
\t\@echo cc -c commands.c
display.o : display.c defs.h buffer.h
\t\@echo cc -c display.c
insert.o : insert.c defs.h buffer.h
\t\@echo cc -c insert.c
EOF
close(MAKEFILE);
@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
"$workdir${pathsep}kbd.c","$workdir${pathsep}command.h",
"$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
"$workdir${pathsep}buffer.h","$workdir${pathsep}insert.c",
"$workdir${pathsep}command.c");
&touch(@files_to_touch);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "cc -c main.c\ncc -c kbd.c\ncc -c commands.c\ncc -c display.c
cc -c insert.c\ncc -o edit main.o kbd.o commands.o display.o insert.o\n";
if (&compare_output($answer,&get_logfile(1))) {
unlink @files_to_touch;
}
1;

View File

@@ -0,0 +1,45 @@
# -*-perl-*-
$description = "\
This tests random features of the parser that need to be supported, and
which have either broken at some point in the past or seem likely to
break.";
open(MAKEFILE,"> $makefile");
# The contents of the Makefile ...
print MAKEFILE <<EOF;
\# We want to allow both empty commands _and_ commands that resolve to empty.
EMPTY =
.PHONY: all a1 a2 a3 a4
all: a1 a2 a3 a4
a1:;
a2:
\t
a3:;\$(EMPTY)
a4:
\t\$(EMPTY)
\# Non-empty lines that expand to nothing should also be ignored.
STR = \# Some spaces
TAB = \t \# A TAB and some spaces
\$(STR)
\$(STR) \$(TAB)
EOF
close(MAKEFILE);
&run_make_with_options($makefile,"",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "$make_name: Nothing to be done for `all'.\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,35 @@
$description = "The following test creates a makefile to ... \n";
$details = "Fill in Later\n";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "all: \n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile,"-v",&get_logfile,0);
# This tells the test driver that the perl test script executed properly.
1;

View File

@@ -0,0 +1,48 @@
$description = "The following test creates a makefile to test the -C dir \n"
."option in make. This option tells make to change to \n"
."directory dir before reading the makefile.";
$details = "This test is similar to the clean test except that this test\n"
."creates the file to delete in the work directory instead of\n"
."the current directory. Make is called from another directory\n"
."using the -C workdir option so that it can both find the \n"
."makefile and the file to delete in the work directory. ";
$example = $workdir . $pathsep . "EXAMPLE_FILE";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "all: \n";
print MAKEFILE "\t\@echo This makefile did not clean the dir ... good\n";
print MAKEFILE "clean: \n";
print MAKEFILE "\t$delete_command EXAMPLE_FILE\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&touch($example);
&run_make_with_options("${testname}.mk",
"-C $workdir clean",
&get_logfile);
chdir $workdir;
$wpath = &get_this_pwd;
chdir $pwd;
# Create the answer to what should be produced by this Makefile
$answer = "$make_name: Entering directory `$wpath'\n"
. "$delete_command EXAMPLE_FILE\n"
. "$make_name: Leaving directory `$wpath'\n";
&compare_output($answer,&get_logfile(1));
if (-f $example)
{
$test_passed = 0;
}
1;

View File

@@ -0,0 +1,57 @@
$description ="The following test creates a makefile to test the -I option.";
$details = "\
This test tests the -I option by including a filename in
another directory and giving make that directory name
under -I in the command line. Without this option, the make
would fail to find the included file. It also checks to make
sure that the -I option gets passed to recursive makes.";
$makefile2 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
$mf2 = substr ($makefile2, index ($makefile2, $pathsep) + 1);
print MAKEFILE <<EOF;
include $mf2
all:
\t\@echo There should be no errors for this makefile.
EOF
# END of Contents of MAKEFILE
close(MAKEFILE);
open(MAKEFILE,"> $makefile2");
print MAKEFILE <<EOF;
ANOTHER:
\t\@echo This is another included makefile
recurse:
\t\$(MAKE) ANOTHER -f $makefile
EOF
close(MAKEFILE);
&run_make_with_options($makefile,"-I $workdir all",&get_logfile);
# Create the answer to what should be produced by this Makefile
$answer = "There should be no errors for this makefile.\n";
&compare_output($answer,&get_logfile(1));
$answer = "This is another included makefile\n";
&run_make_with_options($makefile,"-I $workdir ANOTHER",&get_logfile);
&compare_output($answer,&get_logfile(1));
$answer = "$mkpath ANOTHER -f $makefile
${make_name}[1]: Entering directory `$pwd'
This is another included makefile
${make_name}[1]: Leaving directory `$pwd'\n";
&run_make_with_options($makefile,"-I $workdir recurse",&get_logfile);
&compare_output($answer,&get_logfile(1));

View File

@@ -0,0 +1,24 @@
# -*-perl-*-
$description = "The following test creates a makefile to ...";
$details = "";
$ENV{GOOGLE} = 'boggle';
open(MAKEFILE,"> $makefile");
print MAKEFILE <<'EOF';
GOOGLE = bazzle
all:; @echo "$(GOOGLE)"
EOF
close(MAKEFILE);
&run_make_with_options($makefile, '-e' ,&get_logfile);
$answer = "boggle\n";
&compare_output($answer,&get_logfile(1));
1;

View File

@@ -0,0 +1,85 @@
$description = "The following test tests that if you specify greater \n"
."than one '-f makefilename' on the command line, \n"
."that make concatenates them. This test creates three \n"
."makefiles and specifies all of them with the -f option \n"
."on the command line. To make sure they were concatenated, \n"
."we then call make with the rules from the concatenated \n"
."makefiles one at a time. Finally, it calls all three \n"
."rules in one call to make and checks that the output\n"
."is in the correct order.";
$makefile2 = &get_tmpfile;
$makefile3 = &get_tmpfile;
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "all: \n";
print MAKEFILE "\t\@echo This is the output from the original makefile\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
# Create a second makefile
open(MAKEFILE,"> $makefile2");
print MAKEFILE "TWO: \n";
print MAKEFILE "\t\@echo This is the output from makefile 2\n";
close(MAKEFILE);
# Create a third makefile
open(MAKEFILE,"> $makefile3");
print MAKEFILE "THREE: \n";
print MAKEFILE "\t\@echo This is the output from makefile 3\n";
close(MAKEFILE);
# Create the answer to what should be produced by this Makefile
$answer = "This is the output from the original makefile\n";
# Run make to catch the default rule
&run_make_with_options($makefile,"-f $makefile2 -f $makefile3",&get_logfile,0);
&compare_output($answer,&get_logfile(1));
# Run Make again with the rule from the second makefile: TWO
$answer = "This is the output from makefile 2\n";
&run_make_with_options($makefile,"-f $makefile2 -f $makefile3 TWO",&get_logfile,0);
&compare_output($answer,&get_logfile(1));
# Run Make again with the rule from the third makefile: THREE
$answer = "This is the output from makefile 3\n";
&run_make_with_options($makefile,
"-f $makefile2 -f $makefile3 THREE",
&get_logfile,
0);
&compare_output($answer,&get_logfile(1));
# Run Make again with ALL three rules in the order 2 1 3 to make sure
# that all rules are executed in the proper order
$answer = "This is the output from makefile 2\n";
$answer .= "This is the output from the original makefile\n";
$answer .= "This is the output from makefile 3\n";
&run_make_with_options($makefile,
"-f $makefile2 -f $makefile3 TWO all THREE",
&get_logfile,
0);
&compare_output($answer,&get_logfile(1));

View File

@@ -0,0 +1,73 @@
$description = "The following test creates a makefile to test the -k option.\n"
."Normally, make gives up immediately if an error happens \n"
."that make has not been told to ignore. However, if the -k\n"
."option is specified, make continues to consider the other\n"
."dependencies of the pending targets.";
$details = "The makefile created in this test is a simulation of building \n"
."a small product. However, the trick to this one is that one \n"
."of the dependencies of the main target does not exist. \n"
."Without the -k option, make would fail immediately and not \n"
."build any part of the target. What we are looking for here, \n"
."is that make builds the rest of the dependencies even though \n"
."it knows that at the end it will fail to rebuild the main target.";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "VPATH = $workdir\n";
print MAKEFILE "edit: main.o kbd.o commands.o display.o \n";
print MAKEFILE "\t\@echo cc -o edit main.o kbd.o commands.o display.o \n";
print MAKEFILE "main.o : main.c defs.h\n";
print MAKEFILE "\t\@echo cc -c main.c\n";
print MAKEFILE "kbd.o : kbd.c defs.h command.h\n";
print MAKEFILE "\t\@echo cc -c kbd.c\n";
print MAKEFILE "commands.o : command.c defs.h command.h\n";
print MAKEFILE "\t\@echo cc -c commands.c\n";
print MAKEFILE "display.o : display.c defs.h buffer.h\n";
print MAKEFILE "\t\@echo cc -c display.c\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
@files_to_touch = ("$workdir${pathsep}main.c","$workdir${pathsep}defs.h",
"$workdir${pathsep}command.h",
"$workdir${pathsep}commands.c","$workdir${pathsep}display.c",
"$workdir${pathsep}buffer.h",
"$workdir${pathsep}command.c");
&touch(@files_to_touch);
if ($vos)
{
$error_code = 3307;
}
else
{
$error_code = 512;
}
&run_make_with_options($makefile,"-k",&get_logfile,$error_code);
# Create the answer to what should be produced by this Makefile
$answer = "cc -c main.c\n"
."$make_name: *** No rule to make target `kbd.c', needed by `kbd.o'.\n"
."cc -c commands.c\n"
."cc -c display.c\n"
."$make_name: Target `edit' not remade because of errors.\n";
# COMPARE RESULTS
if (&compare_output($answer,&get_logfile(1)))
{
unlink @files_to_touch;
}
1;

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