Commit Graph

576 Commits

Author SHA1 Message Date
Hartmut Brandt
352a63dee8 Introduce a new pseudo-target .EXPORTVAR which allows to put a
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>
2005-05-06 18:30:06 +00:00
Hartmut Brandt
be7a5506e8 Rename the directive_hash.[ch] files to hash_tables.[ch] now
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>
2005-04-29 15:15:28 +00:00
Hartmut Brandt
3dece030a5 Implement a pseudo-target .WARN that allows toggeling the warning flags
for the current make. This does not override flags specified on the
command line and these settings are not passed to sub-makes.
2005-04-29 14:37:44 +00:00
Hartmut Brandt
48c49ace00 Introduce a flag to enable extended warnings (-x) and make them off
by default. This should fix the problem of getting lots of errors
when building with an up-to-date make and old *.mk files.
2005-04-28 15:37:25 +00:00
Hartmut Brandt
b1880272f1 Use a minimal perfect hash for the special sources/targets too. Add
the corresponding magic to create the hash function to the Makefile.
2005-04-28 12:05:43 +00:00
Hartmut Brandt
47cc56ab55 Fix the $$FreeBSD$$ that should be written verbatim to directive_hash.c
so that it doesn't get replaced with the Makefile's revision.
2005-04-28 08:04:46 +00:00
Hartmut Brandt
2274441da6 Move the hash function for directives into its own file and add
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)
2005-04-28 07:55:55 +00:00
Hartmut Brandt
beed8bb5f6 Split VarFind() into a series of functions tailored for the different sets
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>
2005-04-13 11:40:44 +00:00
Hartmut Brandt
797bb929c6 Parse_Init() is gone so remove comments that mention it. 2005-04-11 07:40:54 +00:00
Hartmut Brandt
9e1e6570f3 Remove an unneccesary forward declaration for MainParseArgs().
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>
2005-04-11 07:32:49 +00:00
Hartmut Brandt
8f5850c6f4 Remove the call to Parse_Init() - there is no need to initialize
a static variable to NULL. Forgot this in the previous commit to
parse.[ch].
2005-04-11 07:26:21 +00:00
Hartmut Brandt
f520690c2c Rework the directive parsing code. Instead of using a lot of strcmp()s
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.
2005-04-11 07:20:10 +00:00
Hartmut Brandt
2a30c95875 Move the code for parsing .for and .if statements to the place where the
other directives are handled.
2005-04-08 09:03:40 +00:00
Hartmut Brandt
a45b448277 When Parse_Error is called after the top-level Makefile is closed we
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
2005-04-07 14:39:38 +00:00
Hartmut Brandt
a9c22e4739 Handle popping of the input stack in ParseReadLine() instead of
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.
2005-04-07 11:29:39 +00:00
Hartmut Brandt
192ee26c2f Mostly stylistic changes: remove the noPLen field from the Shell
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.
2005-04-07 11:26:15 +00:00
Hartmut Brandt
506e445a6c There is not much sense in having an else after Punt() and _exit() which
never return. Also use pid_t for variables holding PIDs.
2005-04-05 12:33:54 +00:00
Hartmut Brandt
683f92e306 Put parantheses into 'if (foo && bar & flag)'. While they are not strictly
needed, they are useful for the human reader.
2005-04-05 08:14:40 +00:00
Hartmut Brandt
d265c4e11a Remove lots if irritating parantheses and fix two comments.
Checked by:	md5
2005-04-05 08:09:48 +00:00
Hartmut Brandt
e7e49de4e5 Remove the definition for STATIC and just use static. 2005-04-05 07:44:11 +00:00
Hartmut Brandt
2a2532d215 Remove unneccessary local prototypes. 2005-04-05 07:43:02 +00:00
Hartmut Brandt
d9e678f13f The static tfile is used only in one single function so move it into that
function.
2005-04-05 07:40:40 +00:00
Hartmut Brandt
29c6a883cd The tfile field of struct Job isn't used anymore since revision 1.22 so
remove it now.
2005-04-05 07:32:12 +00:00
Hartmut Brandt
49ecabba2d Use a type-safe intrusive list to put jobs on the jobs or stoppedJobs list
instead of the generic Lst.
2005-04-01 16:24:25 +00:00
Hartmut Brandt
4d52cd1820 Remove a forward declaration that isn't needed anymore. 2005-04-01 16:23:48 +00:00
Hartmut Brandt
4bc60ea3fb Both struct Job and struct Shell are only used inside job.c so there is
no need to have them in a header file that is included by other modules.
Move them both into the c-file.
2005-04-01 13:35:35 +00:00
Hartmut Brandt
f54201efce Style: fix indentation. 2005-04-01 13:25:45 +00:00
Hartmut Brandt
a2e1fc0052 Style: fix indentation. 2005-04-01 13:06:05 +00:00
Hartmut Brandt
bfcf27787a Style: indentation. 2005-04-01 13:02:17 +00:00
Hartmut Brandt
ab9267be40 Style: Indentation. 2005-04-01 12:42:03 +00:00
Hartmut Brandt
c0489a0689 Style: fix indentation. 2005-04-01 12:31:15 +00:00
Hartmut Brandt
54348124ed Style: fix indentation. 2005-04-01 11:20:17 +00:00
Hartmut Brandt
5682c1009c Style: fix indentation. 2005-04-01 11:12:29 +00:00
Hartmut Brandt
901275d3b7 Style: fix indentation. 2005-04-01 10:53:43 +00:00
Hartmut Brandt
c06ac233d7 Document the new -A flag for ignoring archive errors. 2005-03-31 11:40:53 +00:00
Hartmut Brandt
5e0a7a4450 Almost complete rewrite of the archive code (except for the Makefile parsing
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)
2005-03-31 11:35:56 +00:00
Hartmut Brandt
ae6bff540a Move the MAX macro to a util.h so it becomes usable in other modules.
Suggested by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-31 11:12:45 +00:00
Hartmut Brandt
ba467ce430 Make the structure for handling the input stack local to the parse
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.
2005-03-30 15:18:58 +00:00
Hartmut Brandt
f43eb6f83b Fix a bug introduced in a previous commit: ParseModifier() consumes
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>
2005-03-30 15:14:22 +00:00
Hartmut Brandt
fe504834f3 Style: de-lispify by removing extra parantheses in conditional expressions. 2005-03-23 16:28:57 +00:00
Hartmut Brandt
1b0d28102e Style: make indentation 8 characters. 2005-03-23 16:14:41 +00:00
Hartmut Brandt
fb1dac11b4 Make paths an explicite datatype instead of using the generic Lst.
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.
2005-03-23 12:56:15 +00:00
Hartmut Brandt
76a6d2363f Style: <space><tab> -> <tab> 2005-03-22 12:59:02 +00:00
Hartmut Brandt
cbb7c3931c Rename struct Path to struct Dir and move it into the C-file. It
is not used outside.
2005-03-22 12:54:46 +00:00
Hartmut Brandt
35167ece76 Remove debugging code that crept in in the last commit. 2005-03-22 12:52:00 +00:00
Hartmut Brandt
ad6ba6872a Remove Lst_Find() and Lst_FindFrom() now that they aren't needed anymore. 2005-03-22 12:40:24 +00:00
Hartmut Brandt
e4a90d00b4 Remove the last two instances of Lst_Find() calls. 2005-03-22 12:38:55 +00:00
Hartmut Brandt
144b68a7ef Use VarParse() inside var.c instead of Var_Parse().
Patch:		7.163

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:20:08 +00:00
Hartmut Brandt
6fd71d7a66 Unify callers to Var_Parse() with regard to variable names.
Patch:		7.162

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:18:15 +00:00
Hartmut Brandt
a4c193bbe2 Make some callers of VarFind using the same code structure.
Patch:		7.161

Submitted by:	Max Okumoto <okumoto@ucsd.edu>
2005-03-22 08:16:09 +00:00