summaryrefslogtreecommitdiff
path: root/usr.bin/make/arch.c
AgeCommit message (Collapse)Author
2007-11-17simplify dynamic variable handling a great deal:Marc Espie
first remove all usage of Varq_Append by building the string directly. then replace `common' handling with specialized handling for dynamic strings (since they no longer need a buffer). Finally, identify the place where the variable value needs to be copied because it's going to be free'd or erased soon, and finally, use simple char* pointers. Shaves about 80 bytes off every gnode structure, and kills quite a few unnecessary malloc()s as well.
2007-11-10rename make -> must_make, made -> built_statusMarc Espie
to make them easier to find in source files.
2007-11-03#ifdef stuff that is only used under #ifdef; ok espieTheo de Raadt
2007-11-02Work done at p2k7.Marc Espie
This is a really big step towards getting parallel make to work. Note that this is not yet complete. There are still a few `details' to fix before this works 100%. Specifically: sequential make (compat) and parallel make don't use the same engine, and the parallel engine still has a few limitations. For instance, some known issues: - parallel make does not deal with .phony targets correctly all the time. - some errors are deadly in parallel make mode. - parallel make NEEDS way more sturdy correspondance of file system paths and target names, since it often needs to match dependencies to targets before the corresponding files exist. - some local variables like $* get set in a bogus way in some cases. - suffix handling has issues, especially related to the NULL suffix. So, if you find stuff that does NOT yet work with parallel make, don't go blindly try to fix the Makefile. It's very likely you might have stumbled into a make bug. (unless you really, really, understand Makefiles, DON'T GO CHANGING THEM YET). Tested by lots of people, thanks go to miod@, and robert@ among other people. Quick summary of what this does: - remove `saving commands' extension (it's not really usable, nor used) - move compat job runner and parallel interrupt handling into engine.c - tweak the code so that both compat and parallel mode use the same job runner and the same interrupt handling. Remove the other one. - optimize job runner so that, in parallel mode, the last command does not fork if we can avoid it (as it's already running in a sub shell). - scrape all the code that dealt with creating shell scripts from commands. - scrape all the code that dealt with recognizing special sequences in command output to print/not print output. - fix the parallel job pipe to not keep around file descriptors that are not needed. - replace the parallel job buffering with a nicer one, that deals with non-blocking descriptors to try to agregate as much output from one job in one go (greed) to unconfuse the users. - create two pipes per job, so that stdout and stderr stay separate. - make job token printing a debug option. - always use the parallel job-runner to `execute' commands, even if we just print them out. - store list of errors encountered during parallel make running, and print them on exit, so that we know what went wrong. - add a dirty hack to targ.c to deal with paths produced by gccmakedep.
2007-09-17always define the svr4namelist. Doesn't hurt, even if we don't use it.Marc Espie
2007-09-17fix the arch code mostly.Marc Espie
- stop using sprintf for code that can use our buffers. - stop modifying parsed line, rely on Var_Substi instead. to do that, we need to go through an intermediate routine that uses one single buffer to build archive names. also introduce an add_archive_node function that makes things way simpler. also rename a few variables.
2007-09-17kill extra spaces at end of lineMarc Espie
2007-09-16rename dirSearchPath -> defaultPath, and openDirectories -> knownDirectoriesMarc Espie
2007-09-16minor reindent issuesMarc Espie
2007-09-16rename Targ_FmtTime into time_to_string and move it, as it's not relatedMarc Espie
to target nodes at all (reduces modules inter-dependencies)
2007-09-16reuse free_hashMarc Espie
2007-09-16reindent arch.cMarc Espie
2007-09-16cut up dir.c into dir.c/direxpand.c as there is very little interface betweenMarc Espie
two modules that do different things.
2007-09-16more dead code: we always define LIBRARIES and INCLUDESMarc Espie
2007-09-16remove dead code: #define RECHECK is always onMarc Espie
2007-07-30everywhere except in Var_Parse, we always add/append variables to theMarc Espie
VAR_GLOBAL context, so make it the common case: rename the basic functions to Var_Set_with_ctxt/Var_Append_with_ctxt, define Var_Set and Var_Append as macros that specify VAR_GLOBAL, and use these. okay miod@
2007-07-24simplify computations in the var module: instead of advancing a char *Marc Espie
and keeping track of a length, we just advance the char *, and ditch the length. We can still get the length at the end of the top-level functions to satisfy existing interfaces. Much simpler code, less error-prone. Okay millert@
2007-07-24move the code that grabs a value in Var_Parse in its own function,Marc Espie
get_expanded_value. Extend the code a bit to be much more thorough in case of a recursive expansion: shows exactly the cycle of variable names involved. okay millert@
2007-07-24change Var_ParseSkip API to increment the position instead of returning aMarc Espie
length, simplifies code. (warns a bit, symptom of some further issues to fix). okay millert@
2007-03-20remove some bogus *p tests from charles longeauTed Unangst
ok deraadt millert
2006-01-20use stdint.h where appropriate. okay millert@Marc Espie
2004-04-07ISO function declarations, trim a few comments, rename a few variables toMarc Espie
more explicit/more consistent names. okay otto@
2003-06-03Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2003-04-06get rid of some strcpy/sprintf.Marc Espie
ok krw@, matthieu@, deraadt@
2002-01-30use defined(__ELF__) instead of a list of ELF architectures from whichMatthieu Herrb
sparc64 was missing. This fixes a bug with ELF static libraries on sparc64
2001-09-19occured->occurredMike Pechkin
idea from deraadt@ via NetBSD millert@ ok p.s. Next commit will fix a typo in the sys/
2001-06-07Better warning fix, in line with the rest of the codeMarc Espie
(__attribute((__unused__)) denotes parameters that MAY be unused in the code, e.g., it's mostly a `shut up warnings' device).
2001-06-05Use Str_concat instead of fixed buffers and snprintf in building paths.Marc Espie
Replace MAXPATHLEN with PATH_MAX (synch with op-make). ok naddy@
2001-05-30-Wall cleanup, mostly useless otherwiseTheo de Raadt
2001-05-29Take includes out of lst.h, re-add what's needed to separate files.Marc Espie
Removes remaining lint stuff from lst.lib.
2001-05-23Mostly clean-up:Marc Espie
- cut up those huge include files into separate interfaces for all modules. Put the interface documentation there, and not with the implementation. - light-weight includes for needed concrete types (lst_t.h, timestamp_t.h). - cut out some more logically separate parts: cmd_exec, varname, parsevar, timestamp. - put all error handling functions together, so that we will be able to clean them up. - more systematic naming: functioni to handle interval, function to handle string. - put the init/end code apart to minimize coupling. - kill weird types like ReturnStatus and Boolean. Use standard bool (with a fallback for non-iso systems) - better interface documentation for lots of subsystems. As a result, make compilation goes somewhat faster (5%, even considering the largish BSD copyrights to read). The corresponding preprocessed source goes down from 1,5M to 1M. A few minor code changes as well: Parse_DoVar is no longer destructive. Parse_IsVar functionality is folded into Parse_DoVar (as it knows what an assignment is), a few more interval handling functions. Avoid calling XXX_End when they do nothing, just #define XXX_End to nothing. Parse_DoVar is slightly more general: it will handle compound assignments as long as they make sense, e.g., VAR +!= cmd will work. As a side effect, VAR++=value now triggers an error (two + in assignment). - this stuff doesn't occur in portable Makefiles. - writing VAR++ = value or VAR+ +=value disambiguates it. - this is a good thing, it uncovered a bug in bsd.port.mk. Tested by naddy@. Okayed millert@. I'll handle the fallback if there is any. This went through a full make build anyways, including isakmpd (without mickey's custom binutils, as he didn't see fit to share it with me).
2001-05-03Synch with my current work.Marc Espie
Numerous changes: - generate can build several tables - style cleanup - statistics code - use variable names throughout (struct Name) - recursive variables everywhere - faster parser (pass buffer along instead of allocating multiple copies) - correct parser. Handles comments everywhere, and ; correctly - more string intervals - simplified dir.c, less recursion. - extended for loops - sinclude() - finished removing extra junk from Lst_* - handles ${@D} and friends in a simpler way - cleaned up and modular VarModifiers handling. - recognizes some gnu Makefile usages and errors out about them. Additionally, some extra functionality is defined by FEATURES. The set of functionalities is currently hardcoded to OpenBSD defaults, but this may include support for some NetBSD extensions, like ODE modifiers. Backed by miod@ and millert@, who finally got sick of my endless patches...
2001-03-02Use the ohash_* that's now in libc.Marc Espie
2000-11-27This patch fixes ArchFindMember so that it handles SVR4 membersMarc Espie
similarly to read_archive. Note we no longer bother seeking back to the start of the header, as only ArchTouch accesses that header, and can do the seek itself. With this, arch handling should be working, more or less. thanks to Todd, Miod, Naddy for reviewing those patches.
2000-11-27This does fix some nasty issues: ar field members are NOT null-terminated.Marc Espie
Hence, read_archive must be very careful to parse stuff correctly: don't use str* when mem* are appropriate, copy numeric fields and ensure they're terminated...
2000-11-27We take of the SVR4 archive handling data structure from our archive,Marc Espie
and put it into a specific structure (it is wasteful to keep lugging SVR4 structures once an archive is parsed). By tweaking read_archive slightly, we can achieve a nicer interface to ArchSVR4Entry. Note a bug in make: ArchFindMember does (currently) not use the SVR4 code, hence some archive members won't be found in non-caching mode...
2000-11-27Factorise duplicated code involved in touching archives.Marc Espie
2000-11-24As it stands now, arch.c does not work.Marc Espie
Its main failing is that ar headers are NOT null terminated. This code is atrocious. This change starts cleaning that up. Replace the list of cached archives with a hash, streamline the logic of ArchMTimeMember, by taking out the actual function that does the reading (read_archive). More fixes to come.
2000-11-24Change the time stamp interface to use an abstract datatype.Marc Espie
Define two possible interfaces: the classic one, and the new one (used where available) that depends on timespec. Better granularity, make is now able to distinguish between files that were built during the same second.
2000-10-13Fix Arch_MemMTime (previous change I did was bogus)Marc Espie
2000-09-14This kills the last old hashing table, in arch.cMarc Espie
Slight optimizations: instead of storing archive members, just keep the modification time, as we don't care for the rest of the archive information. Lazily compute mtime, stash ascii date instead, and convert to mtime when needed (storing an out_of_date value to mark the unconverted values). Archive handling is atrocious and need some clean-up. Thanks to miod@ who took the time to review those patches.
2000-09-14Introduce a few macros to handle timestamps in an abstract way.Marc Espie
Replace the time stamp hash in dir.c with an open hashing structure. In doing so, remove some nasty casts, simplify code a bit: Dir_MTime can return a modification time, since make does not make a distinction between out-of-date and non-existent files.
2000-09-14Replace the old hash used to hold file names within a directory withMarc Espie
open hashing. An interesting optimization is that the open hashing interface is more fine-grained, hence we can compute the correct hash value at the start of Dir_FindFile, and reuse it for each hash structure into which we look (the effect is measurable on large directories along with objdir/VPATH). Remove a few unnecessary Lst_Open/Lst_Close that serve no purpose except obfuscating the code. The interface to dir.h changes slightly, hence tedious includes changes...
2000-09-14Some systematic clean-up.Marc Espie
- UNUSED macro that expands to __attribute__((unused)) for gcc - move rcsid around so that they can be tagged UNUSED. - activate -Wunused. - use UNUSED instead of kludgy junk for function arguments. - add extern to all extern prototypes. - update comments in lst.h. - clean up var.c a little bit, constifying arguments, updating comments...
2000-06-23Once those special variable are taken care of, other Var functions can takeMarc Espie
the GNode's context directly. We rename that special Lst to `SymTable *' in prevision of things to come. Along the line, we lose the special GNodes affected to VAR_CMD, VAR_GLOBAL, VAR_ENV, which become simple Lsts... This is not a problem, except when getting to a context's name for debugging (handled very nicely by offsetof). Again, this is a preparatory patch, which does not gain anything except for cleaning up issues... Reviewed by millert@ and miod@, like the previous patch
2000-06-23Start of variable fixes and speed-ups.Marc Espie
This patch may seem a bit non-sensical at first. It simply introduces some new interface. Specifically, recognizes that some variable names (.TARGET/$@, .OODATE/$?, .ALLSRC/$>, .IMPSRC/$<, .PREFIX/$*, .ARCHIVE/$!, .MEMBER/$%) are `special' (the actual variables which are local to a target, e.g. GNode). Currently, The Varq functions (for Varquick access) are only stubs to the normal functions. This fixes a very important detail before proceeding to turn variable lists into hash tables: if every GNode holds a hash table, initialization times for those will be very costly. But generic GNodes only hold those seven special variables... which can be stored directly into a small array; the only general cases are the environment, the command line and global variables.
2000-06-23Trivial consequences of the previous list changes:Marc Espie
- audit code for Lst_Datum, it's never applied to an empty pointer, so check can be removed -> turn into a macro, - Lst_First, Lst_Last can become macro as well - specialized version of Lst_Succ (Lst_Adv) to use in loops where it cannot fail, - Lst_Open can no longer fail. Trim down corresponding code. Reviewed millert@, miod@
2000-06-17This patch introduces a distinction betweenMarc Espie
Lst_Init (constructor) and Lst_New (allocation + construction) Lst_Destroy (destructor) and Lst_Delete (deallocation + destruction), and uses that to turn most dynamic allocation of lists (Lst pointers) into static structures (LIST). Most of this is mundane, except for allGNs in targ.c, where the code must be checked to verify that Targ_Init is called soon enough. Lst_New is a temporary addition. All lists will soon be static. Reviewed by millert@, like the previous patch.
2000-06-10Clean-up patch: use `void *' instead of old-fashioned ClientData/Address.Marc Espie
2000-03-26Remove idiotic, braindead casts T* -> void*Marc Espie
They serve no purpose, except hiding potential bugs. In particular, remove (ClientData) cast from macro, showing potentially troublesome use of Hashes to store time_t.