summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/parse.c
Commit message (Collapse)AuthorAgeFilesLines
* Factor out all the .SHELL parsing related stuff into its own file andharti2005-05-241-1/+2
| | | | | | | 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)
* Get rid of global variables for argument vectors produced by brk_string()harti2005-05-181-6/+5
| | | | | | | | 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
* Get rid of the ReturnStatus obscuration that was anyway used onlyharti2005-05-181-7/+6
| | | | | | | in two places. While here don't bother returning anything from Lst_Replace - nobody ever checks the return code. Suggested by: jmallet
* Fix the fix for bin/72510 applied in job.c:1.70. Actually there haveharti2005-05-121-1/+1
| | | | | | | | | | 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
* Move some comments around to where they belong and remove some unneccessaryharti2005-05-121-9/+0
| | | | | | gcc magic. Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.229)
* Move the remaining two prototypes from nonints.h to make.h andharti2005-05-101-1/+0
| | | | | | | remove nonints.h. Patch: 7.204 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Split Var_Subst() into two functions: Var_SubstOnly() which substitutesharti2005-05-091-7/+7
| | | | | | | | | | 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>
* Introduce a new pseudo-target .EXPORTVAR which allows to put aharti2005-05-061-1/+5
| | | | | | | | | | | | | | | | | | 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>
* Rename the directive_hash.[ch] files to hash_tables.[ch] nowharti2005-04-291-1/+1
| | | | | | | 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>
* Implement a pseudo-target .WARN that allows toggeling the warning flagsharti2005-04-291-0/+23
| | | | | for the current make. This does not override flags specified on the command line and these settings are not passed to sub-makes.
* Use a minimal perfect hash for the special sources/targets too. Addharti2005-04-281-43/+25
| | | | the corresponding magic to create the hash function to the Makefile.
* Move the hash function for directives into its own file and addharti2005-04-281-65/+3
| | | | | | | | | 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)
* Parse_Init() is gone so remove comments that mention it.harti2005-04-111-11/+0
|
* Rework the directive parsing code. Instead of using a lot of strcmp()sharti2005-04-111-324/+387
| | | | | | | | | | | | 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.
* Move the code for parsing .for and .if statements to the place where theharti2005-04-081-56/+42
| | | | other directives are handled.
* When Parse_Error is called after the top-level Makefile is closed weharti2005-04-071-3/+7
| | | | | | | 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
* Handle popping of the input stack in ParseReadLine() instead ofharti2005-04-071-341/+329
| | | | | | 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.
* Make the structure for handling the input stack local to the parseharti2005-03-301-143/+124
| | | | | | | | | | | 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.
* Style: de-lispify by removing extra parantheses in conditional expressions.harti2005-03-231-19/+18
|
* Style: make indentation 8 characters.harti2005-03-231-1600/+1679
|
* Make paths an explicite datatype instead of using the generic Lst.harti2005-03-231-17/+17
| | | | | | 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.
* Simplify buffer access by using Buf_Data() and Buf_Peel() whereharti2005-03-221-26/+11
| | | | | | | | appropriate. Patch: 7.147-7.151 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Get rid of another bunch of Lst_ForEach in favour of LST_FOREACH andharti2005-03-161-204/+109
| | | | simplify code accordingly.
* Yet another version of passing the last line to ParseFinishLine().harti2005-03-151-2/+2
| | | | | | | 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.
* Call ParseFinishLine() also for the last line in a file. Thisharti2005-03-111-0/+3
| | | | | | | | | | | | | | 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
* Back out the last commit. It turns out that this breaks more thanharti2005-03-111-3/+0
| | | | it fixes. This should fix the buildworld breakage.
* Call ParseFinishLine() for the last line of a file too.harti2005-03-101-0/+3
|
* Reorganize Suff_EndTransform to be called only for nodes forharti2005-03-101-5/+9
| | | | which it is needed (transforms).
* Fix parsing of archive specifications on the target side ofharti2005-03-031-0/+1
| | | | | dependency lines. It seems that nobody is actually is using the archive-feature of make.
* Update the description comment of the function to reflect theharti2005-03-031-5/+2
| | | | previous change.
* Convert a function call to Lst_ForEach with a macro call to LST_FOREACH.harti2005-03-021-16/+17
|
* Make sure the length variable is initialized to 0 before passingharti2005-03-011-1/+1
| | | | | | | | it to Var_Parse(). Patch: 7.85 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Change the return value of Var_Subst to return a Buffer insteadharti2005-02-251-8/+39
| | | | | | | | of a char *. Patch: 7.49 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Introduce Buf_StripNewLines() and use it where appropriate.harti2005-02-071-4/+4
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Where the returned line length from Buf_GetAll is not used just passharti2005-02-041-4/+2
| | | | | | a NULL to the function. Delete the now unused local variables. Submitted by: Max Okumoto <okumoto@ucsd.edu>
* None of the users of Buf_Discard used it to get rid of only a part ofharti2005-02-041-1/+1
| | | | | | | the buffer. So replace Buf_Discard by Buf_Clear which just gets rid of the entire contents. Submitted by: Max Okumoto <okumoto@ucsd.edu>
* General whitespace cleanup: remove mixes of tabs and spaces, removeharti2005-02-041-8/+8
| | | | | | space after function names, remove spaces on emtpy lines. Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Some more easy constification.harti2005-02-041-5/+6
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Convert several typedefs from beeing pointers to structs to be the structsharti2005-02-021-2/+2
| | | | | | | itself. This will ease constification (think of what 'const Ptr foo' means if Ptr is a pointer to a struct). Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Clean up include files and file including. Split nonints.h into piecesharti2005-02-011-6/+20
| | | | | | | | | | | | | that get included just where they are needed. All headers include the headers that they need to compile (just with an empty .c file). Sort includes alphabetically where apropriate and fix some duplicate commenting for struct Job, struct GNode and struct Shell by removing one version and inlining the comments into the structure declaration (the comments have been somewhat outdated). This patch does not contain functional changes (checked with md5). Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Fix quoting of the MAKEFLAGS environment variable by only quoting spacesharti2005-01-261-1/+1
| | | | | | | | | | and tabs. This is still not correct for command line variable values ending in a backslash because this would require a larger effort. Document this limitation in the BUGS section of the man page. The quoting is mostly compatible with that of gmake and smake. Tested by: Max Okumoto and Joerg Sonnenberger from DragonFly BSD Reviewed by: ru (man page, partly)
* Remove all the cleanup functions. There is no reason to free memoryharti2004-12-171-13/+0
| | | | | just before exiting (especially given the number of memory leaks) - it just costs time.
* Instead of dynamically allocating list heads allocated them staticallyharti2004-12-161-116/+90
| | | | | | | | now that their size is only two pointers. This eliminates a lot of calls to Lst_Init and from there to malloc together with many calls to Lst_Destroy (in places where the list is obviously empty). This also reduces the chance to leave a list uninitilized so we can remove more NULL pointer checks and probably eliminates a couple of memory leaks.
* Remove a useless list where just all command lines are stuffed onto, neverharti2004-12-101-4/+0
| | | | | used and just freed at the end. The idea might have been to be able to free all the strings, but what's the point to free just before exiting?
* Typedefs of pointers to structs are evil. Make Lst and LstNode typedef ofharti2004-12-071-19/+19
| | | | | | the structs itself not of pointers to them. This will simplify constification. Checked by: diff on the object files
* Make needs no circular lists so remove them from the list code.harti2004-12-071-12/+12
|
* Fix breakage introduced on 64-bit platforms with my last commit. Needharti2004-12-031-3/+4
| | | | to change to size_t in a couple of other places too.
* Style: remove a lot of unnecessary casts, add some and spell the nullharti2004-12-011-83/+82
| | | | | | pointer constant as NULL. Checked by: diff -r on the object files before and after
* Stylification: missing spaces, extra space after function names, castsharti2004-11-301-197/+211
| | | | | | | | and the sizeof operator, missing empty lines, void casts, extra empty lines. Checked by: diff on make *.o lst.lib/*.o Submitted by: Max Okumoto <okumoto@soe.ucsd.edu> (partly)
* Use typedefs for the types of the functions that are passed as argumentsharti2004-11-291-1/+1
| | | | | | to the list functions for better readability. Submitted by: Max Okumoto <okumoto@ucsd.edu>
OpenPOWER on IntegriCloud