summaryrefslogtreecommitdiff
path: root/usr.bin/make/parse.c
AgeCommit message (Collapse)Author
2015-06-16Remove old fmake. It wasn't built by default for some time. Users thatWarner Losh
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
2010-01-04Report lines that ought to contain a ':' operator but start with a '.'David E. O'Brien
as "Unknown directive" sinze they are more likely to be .elseif (etc). (NetBSD PR 37222). Obtained from: NetBSD Notes: svn path=/head/; revision=201456
2010-01-04Add check for subversion "original" marker.David E. O'Brien
Notes: svn path=/head/; revision=201455
2008-12-291. Add the ability to tweak the token output before targets in job mode.David E. O'Brien
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
2008-12-29Consistently use Var_SetGlobal().David E. O'Brien
Notes: svn path=/head/; revision=186558
2008-03-12If the special target .MAKEFILEDEPS exists, then enable theDavid E. O'Brien
"remaking makefiles" feature. Otherwise, follow traditional Pmake behavior. (hash table will be regenerated and committed follow this commit) Notes: svn path=/head/; revision=177101
2007-04-12In .error and .warning, prefer command-line variablesRuslan Ermilov
to globals, as per documentation. Nudged by: Jeremie Le Hen Notes: svn path=/head/; revision=168671
2007-03-08Implement "Remaking Makefiles" feature:Max Khon
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
2006-07-22Tell when a .include is processed with '-dd'.David E. O'Brien
Notes: svn path=/head/; revision=160574
2005-10-17Make sure that files included using ".include <foo>" are reallyRuslan Ermilov
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
2005-09-26Add a .sinclude directive which does the exact same as .include, exceptPoul-Henning Kamp
whine when the file cannot be found and opened. Notes: svn path=/head/; revision=150595
2005-05-24Factor out all the .SHELL parsing related stuff into its own file andHartmut Brandt
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
2005-05-18Get rid of global variables for argument vectors produced by brk_string()Hartmut Brandt
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
2005-05-18Get rid of the ReturnStatus obscuration that was anyway used onlyHartmut Brandt
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
2005-05-12Fix the fix for bin/72510 applied in job.c:1.70. Actually there haveHartmut Brandt
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
2005-05-12Move some comments around to where they belong and remove some unneccessaryHartmut Brandt
gcc magic. Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.229) Notes: svn path=/head/; revision=146132
2005-05-10Move the remaining two prototypes from nonints.h to make.h andHartmut Brandt
remove nonints.h. Patch: 7.204 Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=146060
2005-05-09Split Var_Subst() into two functions: Var_SubstOnly() which substitutesHartmut Brandt
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
2005-05-06Introduce a new pseudo-target .EXPORTVAR which allows to put aHartmut Brandt
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
2005-04-29Rename the directive_hash.[ch] files to hash_tables.[ch] nowHartmut Brandt
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
2005-04-29Implement a pseudo-target .WARN that allows toggeling the warning flagsHartmut Brandt
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
2005-04-28Use a minimal perfect hash for the special sources/targets too. AddHartmut Brandt
the corresponding magic to create the hash function to the Makefile. Notes: svn path=/head/; revision=145616
2005-04-28Move the hash function for directives into its own file and addHartmut Brandt
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
2005-04-11Parse_Init() is gone so remove comments that mention it.Hartmut Brandt
Notes: svn path=/head/; revision=144897
2005-04-11Rework the directive parsing code. Instead of using a lot of strcmp()sHartmut Brandt
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
2005-04-08Move the code for parsing .for and .if statements to the place where theHartmut Brandt
other directives are handled. Notes: svn path=/head/; revision=144787
2005-04-07When Parse_Error is called after the top-level Makefile is closed weHartmut Brandt
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
2005-04-07Handle popping of the input stack in ParseReadLine() instead ofHartmut Brandt
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
2005-03-30Make the structure for handling the input stack local to the parseHartmut Brandt
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
2005-03-23Style: de-lispify by removing extra parantheses in conditional expressions.Hartmut Brandt
Notes: svn path=/head/; revision=144029
2005-03-23Style: make indentation 8 characters.Hartmut Brandt
Notes: svn path=/head/; revision=144026
2005-03-23Make paths an explicite datatype instead of using the generic Lst.Hartmut Brandt
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
2005-03-22Simplify buffer access by using Buf_Data() and Buf_Peel() whereHartmut Brandt
appropriate. Patch: 7.147-7.151 Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=143959
2005-03-16Get rid of another bunch of Lst_ForEach in favour of LST_FOREACH andHartmut Brandt
simplify code accordingly. Notes: svn path=/head/; revision=143684
2005-03-15Yet another version of passing the last line to ParseFinishLine().Hartmut Brandt
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
2005-03-11Call ParseFinishLine() also for the last line in a file. ThisHartmut Brandt
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
2005-03-11Back out the last commit. It turns out that this breaks more thanHartmut Brandt
it fixes. This should fix the buildworld breakage. Notes: svn path=/head/; revision=143401
2005-03-10Call ParseFinishLine() for the last line of a file too.Hartmut Brandt
Notes: svn path=/head/; revision=143375
2005-03-10Reorganize Suff_EndTransform to be called only for nodes forHartmut Brandt
which it is needed (transforms). Notes: svn path=/head/; revision=143372
2005-03-03Fix parsing of archive specifications on the target side ofHartmut Brandt
dependency lines. It seems that nobody is actually is using the archive-feature of make. Notes: svn path=/head/; revision=143101
2005-03-03Update the description comment of the function to reflect theHartmut Brandt
previous change. Notes: svn path=/head/; revision=143100
2005-03-02Convert a function call to Lst_ForEach with a macro call to LST_FOREACH.Hartmut Brandt
Notes: svn path=/head/; revision=143027
2005-03-01Make sure the length variable is initialized to 0 before passingHartmut Brandt
it to Var_Parse(). Patch: 7.85 Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=142937
2005-02-25Change the return value of Var_Subst to return a Buffer insteadHartmut Brandt
of a char *. Patch: 7.49 Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=142457
2005-02-07Introduce Buf_StripNewLines() and use it where appropriate.Hartmut Brandt
Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141454
2005-02-04Where the returned line length from Buf_GetAll is not used just passHartmut Brandt
a NULL to the function. Delete the now unused local variables. Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141291
2005-02-04None of the users of Buf_Discard used it to get rid of only a part ofHartmut Brandt
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
2005-02-04General whitespace cleanup: remove mixes of tabs and spaces, removeHartmut Brandt
space after function names, remove spaces on emtpy lines. Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141270
2005-02-04Some more easy constification.Hartmut Brandt
Submitted by: Max Okumoto <okumoto@ucsd.edu> Notes: svn path=/head/; revision=141252
2005-02-02Convert several typedefs from beeing pointers to structs to be the structsHartmut Brandt
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