Commit graph

236 commits

Author SHA1 Message Date
Paul Smith
4e51b6d9a4 New command line option: --eval=STRING will cause STRING to be
evaluated as a makefile statement before the first makefile is
read.
2009-10-25 00:46:52 +00:00
Boris Kolpackov
4254e88cfa Implement the new undefine directive. 2009-10-06 06:56:57 +00:00
Boris Kolpackov
f5891a26d8 Implement the shortest stem first search order for pattern-specific variables and pattern rules. 2009-09-28 12:31:55 +00:00
Paul Smith
0afbbf8595 - Rework secondary expansion so we only defer it if there's a possibility
it might be needed: for most situations we parse prereqs immediately as
  we used to.  Reduces memory usage.
- Fixes Savannah bug #18622.
2009-09-24 02:41:44 +00:00
Paul Smith
8f30b68871 - Add xcalloc() and call it
- Fix memory errors found by valgrind
- Remove multi_glob() and empower parse_file_seq() to do its job:
  the goal here is to remove the confusing reverse/re-reverse we do on
  the file lists: needed for future fixes.
- Add a prefix arg to parse_file_seq()
- Make concat() variadic so it can take arbitrary #'s of strings
2009-09-16 17:07:01 +00:00
Paul Smith
bf9822658f - Fix Savannah bug 17825
- Fix Savannah bug 21231
2009-06-13 21:21:48 +00:00
Paul Smith
d4ee001292 - Fix Savannah bug #18124
- Fix Savannah bug #17521
- Fix Savannah bug #16401
- Fix Savannah bug #16469
- Fix Savannah bug #16473
2009-06-09 15:35:38 +00:00
Paul Smith
0b30c8d9ce - Add a new test suite for LIBPATTERNS
- Fix Savannah bug #21198
- Fix Savannah bug #21823
- Fix Savannah bug #22010
2009-06-07 17:40:06 +00:00
Paul Smith
81f3e4babd - Modify access of config and gnulib Savannah modules to use GIT
- Fix Savannah bug #24655.
- Fix Savannah bug #24588.
- Fix Savannah bug #24277.
- Fix Savannah bug #25697.
- Fix Savannah bug #25694.
- Fix Savannah bug #25460.
- Fix Savannah bug #26207.
- Fix Savannah bug #25712.
- Fix Savannah bug #26593.
- Fix various doc issues.
2009-06-04 06:30:27 +00:00
Paul Smith
43d81ff866 New special variable: .RECIPEPREFIX
Allows the user to reset the prefix character for introducing recipe lines
from the default (tab) to any other single character, and back again.
Also, reworked the manual to consistently use the word "recipe" to describe
the set of commands we use to update a target, instead of the various
phrases used in the past: "commands", "command lines", "command scripts",
etc.
2007-11-04 21:54:00 +00:00
Paul Smith
891ebd4d97 * Update to GPLv3
* Update copyright to 2007
* Fix download URL for translation files (thanks to Thiemo Seufer)
2007-07-04 19:35:15 +00:00
Paul Smith
52ebc531ce Fix Savannah bug #19656: rationalize our use of case-insensitive string
comparison functions to always use POSIX strcasecmp().  For non-POSIX
systems that use other functions (strcmpi or stricmp) use a macro to alias
strcasecmp to those.  If we can't find any of them (VMS, plus whatever
UNIX doesn't have them) then define our own version in misc.c.
2007-05-09 02:01:53 +00:00
Paul Smith
6ccf33cdbd This is a major update, which switches virtually every allocated-but-not-freed
string into the strcache.  As a side-effect, many more structure members and
function arguments can/should be declared const.

As mentioned in the changelog, unfortunately measurement shows that this
change does not yet reduce memory.  The problem is with secondary expansion:
because of this we store all the prerequisites in the string cache twice.
First we store the prerequisite string after initial expansion but before
secondary expansion, then we store each individual file after secondary
expansion and expand_deps().  I plan to change expand_deps() to be callable
in either context (eval or snap_deps) then have non-second-expansion
targets call expand_deps() during eval, so that we only need to store that
dependency list once.
2007-03-20 03:02:26 +00:00
Paul Smith
e4da308580 Fix from Eli for incorrect value of $(MAKE) on Cygwin.
A few changes from char* to void* where appropriate, and removing of
unnecessary casts.

Much more work on const-ifying the codebase.  This round involves some code
changes to make it correct.  NOTE!!  There will almost certainly be problems
on the non-POSIX ports that will need to be addressed after the const changes
are finished: they will need to be const-ified properly and there may need to
be some changes to allocate memory, etc. as well.

The next (last?) big push for this, still to come, is const-ifying the
filenames in struct file, struct dep, etc.  This will allow us to store file
names in the string cache and finally resolve Savannah bug #15182 (make uses
too much memory), among other advantages.
2006-11-18 20:53:44 +00:00
Paul Smith
c25294ad3b Another round of cleanups:
- Add more warnings.
- Rename variables that mask out-scope vars with the same name.
- Remove all casts of return values from xmalloc, xrealloc, and alloca.
- Remove casts of the first argument to xrealloc.
- Convert all bcopy/bzero/bcmp invocations to use memcp/memmove/memset/memcmp.
2006-04-09 22:09:24 +00:00
Paul Smith
f222b19158 Code cleanup: Remove all references to PARAMS() & ansi2knr. 2006-04-07 01:43:44 +00:00
Paul Smith
24aac7f8f6 Add some alloca(0) calls for systems without "normal" alloca support.
Fix a file descriptor leak with make re-exec while using the jobserver.
Update some release information.
2006-03-20 02:36:36 +00:00
Boris Kolpackov
22886f8a74 Fixed Savannah bug #16053. 2006-03-17 14:24:20 +00:00
Paul Smith
86af3872a9 Some memory leak cleanups (found with valgrind). 2006-02-14 15:42:17 +00:00
Paul Smith
a6bdc58385 Last of the copyright updates. 2006-02-11 22:16:04 +00:00
Paul Smith
586daef9bc Update copyright and license notices on all files.
Added new file strcache.c to various non-UNIX makefiles and build scripts.
2006-02-11 19:02:21 +00:00
Paul Smith
5a7a42cfce - New code capability: a read-only string cache. Start of solution for
Savannah bug #15182, but not much uses it yet.  Coming shortly.
- Added short-circuiting $(and ..) and $(or ...) functions.
2006-02-10 05:29:00 +00:00
Paul Smith
4cd3539024 Various updates, mainly to the Windows port, from Eli Zaretskii and
Markus Maurhart.
2006-02-01 07:54:22 +00:00
Paul Smith
64e16d6c00 Various changes getting ready for the release of 3.81.
- Updates to make.texi and make.1 and other documentation
- Some VMS patches
- Fix minor bugs reported on the mailing list and from Debian.
2006-01-04 14:45:16 +00:00
Paul Smith
11095a90f1 Make second expansion optional (partial implementation).
I decided this feature was too impacting to make the permanent default
behavior.  This set of changes makes the default behavior of make the
old behavior (no second expansion).  If you want second expansion, you
must define the .SECONDEXPANSION: special target before the first target
that needs it.

This set of changes ONLY fixes explicit and static pattern rules to work
like this.  Implicit rules still have second expansion enabled all the
time: I'll work on that next.

Note that there is still a backward-incompatibility: now to get the old
SysV behavior using $$@ etc. in the prerequisites list you need to set
.SECONDEXPANSION: as well.
2005-10-24 13:01:39 +00:00
Paul Smith
b237dff775 - Fixed a bug reported by Michael Matz regarding handling of parallel
jobs after a failed job.
- Enhancements to WINDOWS32 code from Eli Zaretskii.
- Add Microsoft Project files from J. Grant.
2005-08-08 05:08:00 +00:00
Paul Smith
1e9dc3ce45 Various minor updates and code cleanups. 2005-07-12 04:35:13 +00:00
Paul Smith
0e30f46a62 Various fixes and updates from testers of the beta3 release (mostly Windows
and OS/2 changes).
2005-07-04 03:50:59 +00:00
Paul Smith
da1b137e38 Fix strerror() handling for systems which set ANSI_STRING.
Don't print errors if "include" is specified with no arguments.
New test suite for the $(shell ...) function.
2005-06-27 01:01:07 +00:00
Paul Smith
1dd9ed1c05 Fix -W foo yielding infinite recursion in some cases of re-exec.
Added a -W test suite.
2005-06-25 20:00:24 +00:00
Paul Smith
978819e1d6 Add a new variable: MAKE_RESTARTS, to count how many times make has re-exec'd.
When rebuilding makefiles, unset -B if MAKE_RESTARTS is >0.
2005-06-25 18:57:28 +00:00
Paul Smith
467115baae Fix Savannah bug # 1328: if stdout is redirected to a full filesystem, we
check for this and exit with an error.
The closeout.c version from gnulib pulls in too much other stuff, and
gnulib requires an ANSI C 89 compliant compiler, while GNU make (so far)
still wants to work on K&R.
2005-06-12 22:22:07 +00:00
Paul Smith
e4c14a675c Document the secondary expansion method. Also, some other documentation
cleanups.

If we find a make error (invalid makefile syntax or something like that)
write back any tokens we have before we exit.

If we have waiting jobs (using -j + -l) set an alarm before we sleep on
the read() system call, so we can wake up to check the load and start
waiting jobs, if there are long-running jobs we would otherwise be
waiting for.  Suggested by Grant Taylor.
2005-05-08 16:50:58 +00:00
Paul Smith
9d5b5bd2f5 Fix problems with losing tokens in the jobserver, reported by Grant
Taylor.  There are two forms of this: first, it was possible to lose
tokens when using -j and -l at the same time, because waiting jobs were
not checked when determining whether any jobs were outstanding.  Second,
if you had an exported recursive variable that contained a $(shell ...)
function there is a possibility to lose tokens, since a token was taken
but the child list was not updated until after the shell function was
complete.

To resolve this I introduced a new variable that counted the number of
tokens we have obtained, rather than checking whether there were any
children on the list.  I also added some sanity checks to make sure we
weren't writing back too many or not enough tokens.  And, the master
make will drain the token pipe before exiting and compare the count of
tokens at the end to what was written there at the beginning.

Also:
  * Ensure a bug in the environment (missing "=") doesn't cause make to core.
  * Rename the .DEFAULT_TARGET variable to .DEFAULT_GOAL, to match the
    terminology in the documentation and other variables like MAKECMDGOALS.
  * Add documentation of the .DEFAULT_GOAL special variable.

Still need to document the secondary expansion stuff...
2005-05-03 13:57:20 +00:00
Paul Smith
49ee105c68 Fix performance degradation introduced by the second expansion feature.
I did this by adding intelligence into the algorithm such that the
second expansion was only actually performed when the prerequisite list
contained at least one "$", so we knew it is actually needed.

Without this we were using up a LOT more memory, since every single
target (even ones never used by make) had their file variables
initialized.  This also used a lot more CPU, since we needed to create
and populate a new variable hash table for every target.

There is one issue remaining with this feature: it leaks memory.  In
pattern_search() we now initialize the file variables for every pattern
target, which allocates a hash table, etc.  However, sometimes we
recursively invoke pattern_search() (for intermediate files) with an
automatic variable (alloca() I believe) as the file.  When that function
returns, obviously, the file variable hash memory is lost.
2005-04-13 03:16:33 +00:00
Paul Smith
3daf8df6ee Fix some Savannah bugs.
Updates to docs (still need more work here) and NEWS file.
New language.
2005-04-08 12:51:20 +00:00
Boris Kolpackov
18251c4633 Fixed Savannah bug #12266. 2005-03-09 19:21:34 +00:00
Paul Smith
d2516343bc * New feature: -L option
* New function: $(info ...)
* Disallow $(eval ...) to create prereq relationships inside command scripts
  (caused core dumps)
* Try to allow more tests to succeed in Windows/DOS by sanitizing CRLF and \
* Various bug fixes and code cleanups (see the ChangeLog entry)
2005-02-28 07:48:22 +00:00
Boris Kolpackov
93bd1bd93c Implementation of the .DEFAULT_TARGET special variable. 2005-02-27 22:24:30 +00:00
Paul Smith
9d153cc1b1 Add configure operations to support MINGW on Windows. 2005-02-26 01:41:48 +00:00
Paul Smith
e8ca9b8eb1 Add a patch from Paul Eggert that's been lying around in my directory for
a long time, disabling stack size limits where possible.

Update version to beta2.
2005-02-16 05:03:42 +00:00
Paul Smith
c90f47e832 Flush stdout after printing directory info.
Fix references to MINGW #define constants.
Remove WINDOWS32 ifdef from sub_proc.h.
Only add variables to the command line for recursion once.
New features in run_make_test: #PWD# and #MAKEPATH# replacements.
Test the multi-variable fix in the recursion regression test.
2005-02-10 00:10:57 +00:00
Paul Smith
6c21790595 Fix bug with SHELL handling: make sure the variable struct is initialized. 2004-12-05 18:09:31 +00:00
Paul Smith
6c9e53d648 Fix problems with README and build.sh
Apply an old patch from Paul Eggert.
2004-11-30 20:58:52 +00:00
Paul Smith
be6a8bc869 Fix bug #10252: Remove any trailing slashes from -C arguments (WINDOWS32).
Add a regression test for "@" before a define/enddef vs. one inside.
2004-11-29 01:35:13 +00:00
Paul Smith
539f513773 Fix for bug #1276: Handle SHELL according to POSIX requirements.
POSIX requires that the value of SHELL in the makefile NOT be exported
to sub-commands.  Instead, the value in the environment when make was
invoked should be passed to the environment of sub-commands.  Note that
make still uses SHELL to _run_ sub-commands; it just doesn't change the
value of the SHELL variable in the environment of sub-commands.

As an extension to POSIX, if the makefile explicitly exports SHELL then
GNU make _will_ use it in the environment of sub-commands.
2004-11-28 23:11:23 +00:00
Paul Smith
d27cac1598 Fix WINDOWS32 bug #11155 with patch from Alessandro Vesely. 2004-11-28 16:58:51 +00:00
Paul Smith
704c60cec0 Remove sindex() and replace with strstr().
Windows: allow users to set SHELL to cmd.exe and have it behave as if no
UNIX shell were found.
2004-09-21 12:07:12 +00:00
Paul Smith
08c8105c54 Various enhancements
- OS/2 Patches
  - OpenVMS updates
  - Sanitize the handling of -include/sinclude with and without -k
  - Fix the setting of $< for order-only rules.
2004-05-16 19:16:52 +00:00
Paul Smith
e334942e57 Numerous updates and bug fixes.
A number of W32 cleanups from J.Grant.
A number of OS/2 cleanups from Andreas Buening.
Various random bug fixes.
2004-03-22 15:11:48 +00:00