looked for in the system make file directory or in the specified
-m paths instead of always looking in the other -I and .PATH
specified paths. (Commit log shamelessly stolen from NetBSD.)
Reviewed by: yar
commands for this target are appended to the .END target instead
of beeing executed now. They are executed when the graph is finished.
There was a bug with executing the .END target which came in when
doing conversion to LST_FOREACH() which caused make to dump core.
PR: bin/83698
Submitted by: Max Okumoto <okumoto@ucsd.edu>
MFC after: 3 days
the string. Until now this caused no harm, because the buffer code used
to tack two NULs onto buffers. With the new, soon to come, parsing code
this isn't the case anymore in all cases, so fix this.
rename the function to be consistent with the naming scheme in the rest
of make. No functional changes.
Obtained from: DragonFlyBSD (idea and most of shell.h)
before executing the shell. Until now this was done when the default
shell was the ksh. This failed if the default shell was sh or csh and
the user switched to ksh.
set the current shell to DEFSHELL. Put all these specifications into
a list. Add user specified new shells to this list. If the user
just selects one of the already know shells just pick the right one
off the list. This let's one do something like:
# Full specification of the user's shell. This also selects the shell.
.SHELL: name=myshell path=/somewhere/foo echo=loud ...
FOO != bar # use myshell here
.SHELL: name=sh
BAR != baz # use /bin/sh here
.SHELL: name=myshell # no need for full spec here.
# continue to use the user's special shell.
the list of shell builtins. Both of these are needed for the compat
mode where make directly executes commands if the command line contains
neither a shell meta character nor a shell builtin. The list of builtins
is not changed, but csh has '@' added as a meta-character.
Initialize the default shell by parsing a string as one would specify
to the .SHELL target. So we get rid of the CShell clone of struct Shell which
just contained const char * where struct Shell had char *.
Add a debugging function for dumping a parsed shell description to
stdout.
introduce a struct that holds all the information about an argument
vector and pass that around.
Author: Max Okumoto <okumoto@ucsd.edu>
Obtained from: DragonFlyBSD
Make sure we don't end up with shellPath beeing non-zero, but shellName
beeing zero in the error case - back out cleanly from the error.
When executing a command for macro assignment in Cmd_Exec() stuff the
path of the shell into argv[0], not the name. This makes no difference
from the functionality point of view, but allows the regression tests to
determine whether make executes the correct shell.
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>