summaryrefslogtreecommitdiffstats
path: root/usr.bin/make/main.c
Commit message (Collapse)AuthorAgeFilesLines
* Get rid of global variables for argument vectors produced by brk_string()harti2005-05-181-7/+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
* Make sure machine is initialize before use. Also make two pointers constharti2005-05-121-4/+5
| | | | to get rid of the last two const warnings.
* Cleanup. Move initialisation of file and program global variablesharti2005-05-121-56/+56
| | | | | | | to top of main() and sort them. Make chdir_verify_path() static - it is used only here. Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.238)
* Replace a lot of Var_Set(..., VAR_GLOBAL) by Var_SetGlobal().harti2005-05-121-18/+18
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.237)
* Cleanup main(). Move catching SIGCHLD into job.c. Move unsetenv("ENV")harti2005-05-121-53/+29
| | | | | | | | 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)
* Reshuffle functions to get rid of prototypes.harti2005-05-121-108/+102
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.235)
* Move variable printing from main.c to var.charti2005-05-121-28/+1
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.233)
* Fix the fix for bin/72510 applied in job.c:1.70. Actually there haveharti2005-05-121-4/+5
| | | | | | | | | | 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 global variables to the correct files.harti2005-05-121-3/+0
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.232)
* Path_Expand() expects its first argument to be writeable so put theharti2005-05-101-1/+2
| | | | | | | default system directory into a writeable character array before passing it to Path_Expand(). Submitted by: Max Okumoto <okumoto@ucsd.edu> (7.210)
* 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>
* Merge compat.c into job.c. There is a lot in common between theseharti2005-05-101-1/+0
| | | | | | | files and we are going to factor this out. Patch: 7.199 (slightly changed) Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Move Cmd_Exec() from main.c to job.c and fix its prototype. Thisharti2005-05-101-109/+0
| | | | | | | results in a warning that will go away soon. Patch: 7.198 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Make make a little bit more POSIXish with regard to option parsing:harti2005-05-101-4/+18
| | | | | | | | | | | | | | | 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>
* Split Var_Subst() into two functions: Var_SubstOnly() which substitutesharti2005-05-091-2/+2
| | | | | | | | | | 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/+4
| | | | | | | | | | | | | | | | | | 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>
* Implement a pseudo-target .WARN that allows toggeling the warning flagsharti2005-04-291-4/+56
| | | | | for the current make. This does not override flags specified on the command line and these settings are not passed to sub-makes.
* Introduce a flag to enable extended warnings (-x) and make them offharti2005-04-281-4/+13
| | | | | by default. This should fix the problem of getting lots of errors when building with an up-to-date make and old *.mk files.
* Remove an unneccesary forward declaration for MainParseArgs().harti2005-04-111-20/+34
| | | | | | | | | | 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>
* Remove the call to Parse_Init() - there is no need to initializeharti2005-04-111-2/+0
| | | | | a static variable to NULL. Forgot this in the previous commit to parse.[ch].
* Style: Indentation.harti2005-04-011-133/+133
|
* Almost complete rewrite of the archive code (except for the Makefile parsingharti2005-03-311-3/+7
| | | | | | | | | | | | | | | | | | | | 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)
* Make paths an explicite datatype instead of using the generic Lst.harti2005-03-231-9/+10
| | | | | | 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.
* An automatic variable in a local scope is (conceptionally) destroyed withharti2005-03-221-1/+1
| | | | | | | | | 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>
* Simplify buffer access by using Buf_Data() and Buf_Peel() whereharti2005-03-221-1/+1
| | | | | | | | appropriate. Patch: 7.147-7.151 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Replace a bogus use of Lst_Find with explicite LST_FOREACH callsharti2005-03-181-8/+14
| | | | and remove the unneeded second argument to ReadMakefile.
* Remove leading underscores from the pathname defines. All identifiersharti2005-03-111-8/+8
| | | | | with leading underscore followed by an uppercase letter are in the implementation namespace.
* Use Buf_Peel to get rid of a local variable.harti2005-03-081-4/+3
|
* Buf_GetAll wants a pointer as its second argument, not a boolean -harti2005-02-281-1/+1
| | | | | | replace FALSE by NULL. Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Change the return value of Var_Subst to return a Buffer insteadharti2005-02-251-22/+29
| | | | | | | | of a char *. Patch: 7.49 Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Fix two typos in comments.harti2005-02-171-2/+2
| | | | Submitted by: ru & Max Okumoto <okumoto@ucsd.edu>
* Mostly stylistic issues: move a variable into local scope, makeharti2005-02-161-36/+48
| | | | | | condition positive and fix long lines. Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Better version of the patch in 1.117: bring a variable into local scopeharti2005-02-161-10/+15
| | | | | | | to prepare for function splitting and slightly reorganise the code in anticipation of Var_Subst returning a Buffer. Submitted by: Max Okumoto <okumoto@ucsd.edu> (with slight changes)
* Back out the previous commit. There is an obvious bug in it.harti2005-02-131-12/+10
| | | | Pointy hat to: harti
* Stylistic fixes: push variable into a local context (this part is goingharti2005-02-111-10/+12
| | | | | | | | to be split out into a function soon). Also there is no need to write back the colon that we have NUL-ed - the string is going to be freed anyway. Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Introduce Buf_StripNewLines() and use it where appropriate.harti2005-02-071-51/+25
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Some more easy constification.harti2005-02-041-11/+16
| | | | Submitted by: Max Okumoto <okumoto@ucsd.edu>
* Convert several typedefs from beeing pointers to structs to be the structsharti2005-02-021-1/+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>
* Remove debugging stuff that crept in in the previous commit.harti2005-02-011-5/+0
|
* Clean up include files and file including. Split nonints.h into piecesharti2005-02-011-13/+23
| | | | | | | | | | | | | 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-8/+19
| | | | | | | | | | 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-8/+0
| | | | | just before exiting (especially given the number of memory leaks) - it just costs time.
* Fix a long-standing bug when make(1) is passed the -V andru2004-12-161-8/+5
| | | | | | | | -f options in MAKEFLAGS environment variable, and some of these options are also specified on the command line. Thanks to: marcel Reviewed by: harti
* Instead of dynamically allocating list heads allocated them staticallyharti2004-12-161-41/+50
| | | | | | | | 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.
* Constify the arguments to the list compare function. This temporarilyharti2004-12-081-3/+4
| | | | | | | | requires to make a copy of the filename in ReadMakefile and to duplicate two small functions in suff.c. This hopefully will go away when everything is constified. Submitted by: Max Okumoto <okumoto@ucsd.edu> (partly)
* Typedefs of pointers to structs are evil. Make Lst and LstNode typedef ofharti2004-12-071-10/+10
| | | | | | 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-5/+5
|
* Fix breakage introduced on 64-bit platforms with my last commit. Needharti2004-12-031-11/+10
| | | | 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-11/+9
| | | | | | 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-38/+39
| | | | | | | | 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)
OpenPOWER on IntegriCloud