summaryrefslogtreecommitdiff
path: root/usr.bin/make/parse.c
Commit message (Collapse)AuthorAgeFilesLines
* Remove old fmake. It wasn't built by default for some time. Users thatWarner Losh2015-06-161-2545/+0
| | | | | | | | | | really need it can find it in the devel/fmake port or pkg install fmake. Note: This commit is orthogonal to the question 'can we fmake buildworld'. Differential Revision: https://reviews.freebsd.org/D2840 Notes: svn path=/head/; revision=284464
* Report lines that ought to contain a ':' operator but start with a '.'David E. O'Brien2010-01-041-2/+5
| | | | | | | | | | as "Unknown directive" sinze they are more likely to be .elseif (etc). (NetBSD PR 37222). Obtained from: NetBSD Notes: svn path=/head/; revision=201456
* Add check for subversion "original" marker.David E. O'Brien2010-01-041-0/+1
| | | | Notes: svn path=/head/; revision=201455
* 1. Add the ability to tweak the token output before targets in job mode.David E. O'Brien2008-12-291-0/+2
| | | | | | | | | | | | | | | E.g., .MAKE.JOB.PREFIX=${.newline}---[${.MAKE.PID}] would produce ---[1234] target --- 2. Added ${.newline} as a simple means of being able to include '\n' in the assignment of .MAKE.JOB.PREFIX Obtained from: NetBSD Notes: svn path=/head/; revision=186559
* Consistently use Var_SetGlobal().David E. O'Brien2008-12-291-1/+1
| | | | Notes: svn path=/head/; revision=186558
* If the special target .MAKEFILEDEPS exists, then enable theDavid E. O'Brien2008-03-121-0/+5
| | | | | | | | "remaking makefiles" feature. Otherwise, follow traditional Pmake behavior. (hash table will be regenerated and committed follow this commit) Notes: svn path=/head/; revision=177101
* In .error and .warning, prefer command-line variablesRuslan Ermilov2007-04-121-1/+1
| | | | | | | | | to globals, as per documentation. Nudged by: Jeremie Le Hen Notes: svn path=/head/; revision=168671
* Implement "Remaking Makefiles" feature:Max Khon2007-03-081-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | After reading Makefile and all the files that are included using .include or .sinclude directives (source Makefiles) make considers each source Makefile as a target and tries to rebuild it. Both explicit and implicit rules are checked and all source Makefiles are updated if necessary. If any of the source Makefiles were rebuilt, make restarts from clean state. To prevent infinite loops the following source Makefile targets are ignored: - :: targets that have no prerequisites but have commands - ! targets - targets that have .PHONY or .EXEC attributes - targets without prerequisites and without commands When remaking a source Makefile options -t (touch target), -q (query mode), and -n (no exec) do not take effect, unless source Makefile is specified explicitly as a target in make command line. Additionally, system makefiles and .depend are not considered as a Makefiles that can be rebuilt. Reviewed by: harti Notes: svn path=/head/; revision=167330
* Tell when a .include is processed with '-dd'.David E. O'Brien2006-07-221-0/+1
| | | | Notes: svn path=/head/; revision=160574
* Make sure that files included using ".include <foo>" are reallyRuslan Ermilov2005-10-171-17/+16
| | | | | | | | | | | 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 Notes: svn path=/head/; revision=151419
* Add a .sinclude directive which does the exact same as .include, exceptPoul-Henning Kamp2005-09-261-2/+17
| | | | | | | whine when the file cannot be found and opened. Notes: svn path=/head/; revision=150595
* Factor out all the .SHELL parsing related stuff into its own file andHartmut Brandt2005-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) Notes: svn path=/head/; revision=146572
* Get rid of global variables for argument vectors produced by brk_string()Hartmut Brandt2005-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 Notes: svn path=/head/; revision=146345
* Get rid of the ReturnStatus obscuration that was anyway used onlyHartmut Brandt2005-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 Notes: svn path=/head/; revision=146338
* Fix the fix for bin/72510 applied in job.c:1.70. Actually there haveHartmut Brandt2005-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 Notes: svn path=/head/; revision=146140
* Move some comments around to where they belong and remove some unneccessaryHartmut Brandt2005-05-121-9/+0
| | | | | | | | | gcc magic. Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.229) Notes: svn path=/head/; revision=146132
* Move the remaining two prototypes from nonints.h to make.h andHartmut Brandt2005-05-101-1/+0
| | | | | | | | | | remove nonints.h. Patch: 7.204 Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=146060
* Split Var_Subst() into two functions: Var_SubstOnly() which substitutesHartmut Brandt2005-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> Notes: svn path=/head/; revision=146027
* Introduce a new pseudo-target .EXPORTVAR which allows to put aHartmut Brandt2005-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> Notes: svn path=/head/; revision=145971
* Rename the directive_hash.[ch] files to hash_tables.[ch] nowHartmut Brandt2005-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> Notes: svn path=/head/; revision=145683
* Implement a pseudo-target .WARN that allows toggeling the warning flagsHartmut Brandt2005-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. Notes: svn path=/head/; revision=145679
* Use a minimal perfect hash for the special sources/targets too. AddHartmut Brandt2005-04-281-43/+25
| | | | | | | the corresponding magic to create the hash function to the Makefile. Notes: svn path=/head/; revision=145616
* Move the hash function for directives into its own file and addHartmut Brandt2005-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) Notes: svn path=/head/; revision=145612
* Parse_Init() is gone so remove comments that mention it.Hartmut Brandt2005-04-111-11/+0
| | | | Notes: svn path=/head/; revision=144897
* Rework the directive parsing code. Instead of using a lot of strcmp()sHartmut Brandt2005-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. Notes: svn path=/head/; revision=144894
* Move the code for parsing .for and .if statements to the place where theHartmut Brandt2005-04-081-56/+42
| | | | | | | other directives are handled. Notes: svn path=/head/; revision=144787
* When Parse_Error is called after the top-level Makefile is closed weHartmut Brandt2005-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 Notes: svn path=/head/; revision=144745
* Handle popping of the input stack in ParseReadLine() instead ofHartmut Brandt2005-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. Notes: svn path=/head/; revision=144742
* Make the structure for handling the input stack local to the parseHartmut Brandt2005-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. Notes: svn path=/head/; revision=144341
* Style: de-lispify by removing extra parantheses in conditional expressions.Hartmut Brandt2005-03-231-19/+18
| | | | Notes: svn path=/head/; revision=144029
* Style: make indentation 8 characters.Hartmut Brandt2005-03-231-1600/+1679
| | | | Notes: svn path=/head/; revision=144026
* Make paths an explicite datatype instead of using the generic Lst.Hartmut Brandt2005-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. Notes: svn path=/head/; revision=144020
* Simplify buffer access by using Buf_Data() and Buf_Peel() whereHartmut Brandt2005-03-221-26/+11
| | | | | | | | | | | appropriate. Patch: 7.147-7.151 Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=143959
* Get rid of another bunch of Lst_ForEach in favour of LST_FOREACH andHartmut Brandt2005-03-161-204/+109
| | | | | | | simplify code accordingly. Notes: svn path=/head/; revision=143684
* Yet another version of passing the last line to ParseFinishLine().Hartmut Brandt2005-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. Notes: svn path=/head/; revision=143647
* Call ParseFinishLine() also for the last line in a file. ThisHartmut Brandt2005-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 Notes: svn path=/head/; revision=143405
* Back out the last commit. It turns out that this breaks more thanHartmut Brandt2005-03-111-3/+0
| | | | | | | it fixes. This should fix the buildworld breakage. Notes: svn path=/head/; revision=143401
* Call ParseFinishLine() for the last line of a file too.Hartmut Brandt2005-03-101-0/+3
| | | | Notes: svn path=/head/; revision=143375
* Reorganize Suff_EndTransform to be called only for nodes forHartmut Brandt2005-03-101-5/+9
| | | | | | | which it is needed (transforms). Notes: svn path=/head/; revision=143372
* Fix parsing of archive specifications on the target side ofHartmut Brandt2005-03-031-0/+1
| | | | | | | | dependency lines. It seems that nobody is actually is using the archive-feature of make. Notes: svn path=/head/; revision=143101
* Update the description comment of the function to reflect theHartmut Brandt2005-03-031-5/+2
| | | | | | | previous change. Notes: svn path=/head/; revision=143100
* Convert a function call to Lst_ForEach with a macro call to LST_FOREACH.Hartmut Brandt2005-03-021-16/+17
| | | | Notes: svn path=/head/; revision=143027
* Make sure the length variable is initialized to 0 before passingHartmut Brandt2005-03-011-1/+1
| | | | | | | | | | | it to Var_Parse(). Patch: 7.85 Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=142937
* Change the return value of Var_Subst to return a Buffer insteadHartmut Brandt2005-02-251-8/+39
| | | | | | | | | | | of a char *. Patch: 7.49 Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=142457
* Introduce Buf_StripNewLines() and use it where appropriate.Hartmut Brandt2005-02-071-4/+4
| | | | | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141454
* Where the returned line length from Buf_GetAll is not used just passHartmut Brandt2005-02-041-4/+2
| | | | | | | | | a NULL to the function. Delete the now unused local variables. Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141291
* None of the users of Buf_Discard used it to get rid of only a part ofHartmut Brandt2005-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> Notes: svn path=/head/; revision=141275
* General whitespace cleanup: remove mixes of tabs and spaces, removeHartmut Brandt2005-02-041-8/+8
| | | | | | | | | space after function names, remove spaces on emtpy lines. Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141270
* Some more easy constification.Hartmut Brandt2005-02-041-5/+6
| | | | | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141252
* Convert several typedefs from beeing pointers to structs to be the structsHartmut Brandt2005-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> Notes: svn path=/head/; revision=141133