used so there is no need to stuff the value of .MAKE into it,
which btw isn't set for quite a while already.
Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.239)
into job.c. Move retrieving of environment nearer to the place where it
is actually used and invert the preprocessor conditionals to use
positive logic.
Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.236)
been two maxJobs variables: one static in job.c and one global used in
main.c and parse.c. Makeing one global out of these was the wrong way
to fix the problem. Instead rename the global one to jobLimit and keep
maxJobs static in job.c.
Suggested by: rwatson
PR: bin/72510
takes place in the child process in a function ProcExec(). Make sure,
that the child does not call malloc() or other potential dangerous
functions (there are still calls to Punt() in the error case that
should go away). Allocate the argv string via malloc to overcome
the non-constness bug of the execvp prototype. Change the handling of
shell meta-characters and move the builtin list near the list of shell
builtins. Both of these lists should actuall be configurable by the .SHELL
target since they depend on the shell used.
Patch: 7.21[2-9], 7.22[0-46]
Submitted by: Max Okumoto <okumoto@ucsd.edu>
where they actually belong to. Move the definitions of the strings
for special macros like "$*" from make.h to parse.h - they're used
only in the parser.
Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.211)
context (and only in one place to substitute the .for variable). Therefor
there is no need to pass the context as a parameter.
Patch: 7.197
Submitted by: Max Okumoto <okumoto@ucsd.edu>
take everything after -- as either a macro assignment or a target.
Note that make still reorders arguments before --: anything starting
with a dash is considered an option, anything which contains an equal
sign is considered a macro assignment and everything else a target.
This still is not POSIX with regard to the options, but it will probably
not change because it has been make's behaviour for ages.
Add a new function Var_Match() that correctly skips a macro call by just
doing the same as Var_Subst() but without producing output. This will help
making the parser more robust.
Patches: 7.190,7.191
Submitted by: Max Okumoto <okumoto@ucsd.edu>
only one variable and Var_Subst() which substitutes all. Split out the
test whether a variable should not be expanded into match_var().
Make access to the input string consistently using str[]. Remove two
unused functions: Var_GetTail() and Var_GetHead().
Patches: 7.184-7.189
Submitted by: Max Okumoto <okumoto@ucsd.edu>
make macro into the environment of programs executed by make. This
has approximately the same function as gmake's export directive.
The form of a pseudo target was deliberately choosen to minimize work
for POSIX compatibility (Makefiles are not allowed to use any targets
starting with a dot and consisting only of uppercase letters except those
specified in the standard when they want POSIX compatible behaviour, so
such a Makefile can never contain .EXPORTVAR.)
Change the handling of macros coming from the environment: instead
of asking the environment for each variable we could not find otherwise
put all the environment variables in a special variable environment just
at start up.
This has been tested on the ports cluster by kris.
Submitted by: Max Okumoto <okumoto@ucsd.edu>
that there are more than one hash table in them. There is no
history to preserve here, so go without a repo-copy.
Asked for by: Max Okumoto <okumoto@ucsd.edu>
a Makefile target to re-created this file. Note, that there is no
explicite dependency to automatically re-create the file, because this
is needed only when the directive table changes and it requires the
(yet to come) devel/mph port.
Submitted by: Max Okumoto <okumoto@ucsd.edu> (first version)
of flags originally passed to VarFind(). This eliminates the code by
removing a bunch of tests.
Patch: 7.173
Submitted by: Max Okumoto <okumoto@ucsd.edu>
getopt() may be called several times - make sure to set optreset
to reset it. Cleanup handling of non-option arguments.
Remove some misleading comments.
Patch: 7.171
Submitted by: Max Okumoto <okumoto@ucsd.edu>
on every line that starts with a dot use a minimal perfect hash
function and a single strcmp() on the first word after the dot
to find out whether it is really a directive call and, if yes, which
one. Then directly dispatch to a handler function for that directive
(or fall through to the dependency handling code). This makes the
directive parse a little bit more strict about the syntax: the directive
word must be followed by a character that is not alphanumerical and not
an underline (making .undefFOO illegal); .endif and .else can only be
followed by comments.
have no CURFILE anymore so we cannot print a file name or line number.
When ParseSkipLine() returns NULL (it does this when it has detected an
EOF in an .if block) try to pop the input stack and process the next line
Parse_File(). Remove a comment and a piece of code comming from
ancient times when the if-directive read like #if and not .if.
Correctly analyze the first character of a line.
structure - it is just the strlen() of noPrint. Inline JobCondPassSig()
in the only function JobPassSig() using it. Fix the argument types
of JobPrintCommand(). Better parsing for the .SHELL target keywords.
part). Archive handling was broken at least since the move from BSD ar/ranlib
to GNU binutils because of the different archive format. This rewrite fixes
this by making make to carry around the defines for all formats (it supports)
so it can support all of them independent of the actually used one. The
supported formats are: traditional BSD (this seems to come from V7 at least,
short names only and __.SYMDEF), BSD4.4 (long names with #1/ and __.SYMDEF)
and SysV (extra name table and //). The only format not supported are broken
traditional archives where the member names are truncated to 15 characters.
Errors in the archive are not ignored anymore, but cause make to stop with
an error message. The command line option -A causes these errors to become
non-fatal. This is almost compatible with previous usage except for the
error message printed in any case.
Use a type-safe intrusive list for the archive cache.
Reviewed by: Max Okumoto <okumoto@ucsd.edu> (without new error handling)
module. The only module accessing it (the current line number) was the
condition module, so pass the current line number as a function argument.
Centralize the pushing of new input sources into one function
ParsePushInput() and rename the function handling the popping from ParseEOF()
to ParsePopInput(). Make the entire thing a little bit clearer, by holding
the current input source in the top element of the stack instead of
using extra variables for this. Use a type-safe intrusive list for the
input stack.
characters so it is not safe to move around code from
before it to after it. This should fix problems with building the
documentation.
Patch: 7.170
Submitted by: Max Okumoto <okumoto@ucsd.edu>
A Path is now a TAILQ of PathElements each of which just points to
a reference counted directory. Rename all functions dealing with Paths
from the Dir_ prefix to a Path_ prefix.
the closing brace so it is unwise to keep a pointer to it. Make
the variable static to fix this.
Patch: 7.152
Submitted by: Max Okumoto <okumoto@ucsd.edu>
Remove unreachable code for VAR_NOSUBST - it was never set.
Replace redundant code with calls to VarGetPattern().
Patch: 7.143-7.145
Submitted by: Max Okumoto <okumoto@ucsd.edu>
Change the parsing of the C modifier flags so that specifying both
'1' and 'g' gives an error.
Patch: 7.141,7.142
Submitted by: Max Okumoto <okumoto@ucsd.edu>
is always a '$'. This is not always correct, for example for
conditionals: .if defined(foobar).
Clean up some comments.
Move common code out of if-statements.
Patch: 7.140
Submitted by: Max Okumoto <okumoto@ucsd.edu>
by the caller. Don't pass 'endc' - it can be computed from 'startc'.
Remove unneccessary temporary variables. Remove constant if-expressions
and remove code before call Fatal() - there is no point to cleanup before
aborting.
Patch: 7.134,7.135
Submitted by: Max Okumoto <okumoto@ucsd.edu>
occurence which actually holds always the same constant value.
Shorten the name pattern to patt.
Patch: 7.133
Submitted by: Max Okumoto <okumoto@ucsd.edu>
by putting them into struct VarParser or computing them (consumed).
Change the loop termination condition in VarParseLong from endc to \0.
Patch: 7.128-7.132
Submitted by: Max Okumoto <okumoto@ucsd.edu>
Reduce the number of arguments passed between these functions by
creating a special-purpose struct.
Patch: 7.120,7.121
Submitted by: Max Okumoto <okumoto@ucsd.edu>
would access memory before the beginning of the string to match (the
suffix match starts at the end of both the string and the suffix and
proceedes to the begin until either the start of the suffix is hit
or the character does not match). This could lead to a memcpy copying
into random memory. Fix this by checking the length of the string to
match too and replacing the Lst_Find calls with LST_FOREACH loops
(last part by me).
Submitted by: Matt Dillon <dillon@apollo.backplane.com> (in principle)
Rename result variable so common code becomes more visible.
Rename freePtr to freeResult to make clear what pointer must be freed.
Patch: 7.116, 7.116a
Submitted by: Max Okumoto <okumoto@ucsd.edu>
the loop. Add a comment why the 'consumed' variable is updated.
Rename lengthPtr to consumed.
Patch: 7.115
Submitted by: Max Okumoto <okumoto@ucsd.edu>
It turns out that some ports use the obscure feature of spreading
a dependency block across multiple include files. While this seems
bad style, allow it for now and call said function only at end of
all input to process the really last line of everything.
ParseRestModifier() and ParseRestEnd(): move advancement of ptr to remove
a confusing calculation.
VarParseLong(): cleanup calculation of consumed.
Patch: 7.114
Submitted by: Max Okumoto <okumoto@ucsd.edu>
actual variable lookup. Consistently rename lengthPtr to consumed.
Update a number of comments to match the code.
Patch: 7.111-113
Submitted by: Max Okumoto <okumoto@ucsd.edu>
patch differs from the previous one in that it calls the function
only when a real file hits EOF. The bodies of .for loops are also
handled as files, but for these we don't want to end a dependency block
on the 'EOF' as in:
foo:
do-this
.for ...
do-something
.endfor
do-more
variables and expands archive specifications, one that expands
wild cards and a driver that loops over the children list and
expands each child if necessary replacing it with it's expansions.
that is now used for both the 'M'/'N' branch and the 'S' branch of
the switch statement into a common scope.
Patch: 7.102-105
Submitted by: Max Okumoto <okumoto@ucsd.edu>
is terminated with a slash. Although we are not System V, ar has
been configured to put that slash in. This format allows filenames
with trailing spaces.
paranthesis or brace) into the loop and don't leak the buffer in this
case. Remove the check for Var_Parse returning NULL - it can't.
Patch: 7.92
Submitted by: Max Okumoto <okumoto@ucsd.edu>
Return always malloc()-ed strings from VarParseShort() to get
rid of warnings when returning string constants from a non-const char *
function.
Patch: 7.90
Submitted by: Max Okumoto <okumoto@ucsd.edu>
to VarExpand down into the branches of the if as well as cleanup code.
Eliminate code that is now obviously dead.
Patch: 7.83
Submitted by: Max Okumoto <okumoto@ucsd.edu>
an else clause. Move the assignment to the lengthPtr down to
just before the return statements.
Patch: 7.81
Submitted by: Max Okumoto <okumoto@ucsd.edu>
functions: one for the single letter variables, one for the others
and one that does the recursive expansion.
Patches: 7.68-7.79
Submitted by: Max Okumoto <okumoto@ucsd.edu>
after a return. Move assignments to {freePtr, dynamic, start} closer to the
return statements to clarify which variables are actually used for
communication between the losely coupled blocks of the code. Clear up
an if-expression to make common structures of the conditions clearer.
Use strchr instead of switch statements to check for a character beeing
a member of a set.
Patches: 7-62.2, 7-62.3, 7-64, 7-65.1, 7-65.2
Submitted by: Max Okumoto <okumoto@ucsd.edu>
to the Lst_ForEach function this macro reduces the number of function
calls per invocation by N + 1 (where N is the number of list elements)
and increases code locality thereby increasing readability and
(maybe) performance.
when looking into an already hashed archive, the code tried to use
the name shortened to the maximum length allowed for the archive.
Unfortunately it passed a buffer of junk to the hashing routine when
the name actually wasn't too long. Theoretically this could lead to
a false positive.
it is actually needed. This makes clear in which subblocks the variables
are not needed and which can easier be split out.
Submitted by: Max Okumoto <okumoto@ucsd.edu>