summaryrefslogtreecommitdiff
path: root/usr.bin/make/extern.h
AgeCommit message (Collapse)Author
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...
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-11-24Take advantage of VarModifiers_Apply, which can parse a variable specMarc Espie
and expand it directly, without needing a variable context. Use it in Var_SubstVar, so that .for loops values don't need to be entered into any context nor looked up. This speeds up .for loops some, and avoids nasty variable capture side-effects. Ok'd millert@, miod@, naddy@ (naddy spotted a problem with the first version of that change).
2000-10-13Fix Arch_MemMTime (previous change I did was bogus)Marc Espie
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-14Use the new hash scheme to store the target nodes.Marc Espie
Scrap the list of all targets: it only slows make down. The only visible difference is that the list of all targets is not shown in order when debugging.
2000-09-14Two new functions:Marc Espie
iterate_words: light-weight equivalent to brk_string, which does not need to copy the string, and does not do \ interpretation which are only needed for the string. escape_dup: handles escape sequence in a systematic way. This speeds up variable modifiers. This also makes .for loops more consistent, as they use the same definition of `a word' as the rest of make.
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-07-18Handle MAKEFLAGS variation mandated by POSIX.Marc Espie
Code to pass variable definitions to submakes through make flags. Not activated yet, need to fix src/ first.
2000-07-17Constify a few functions, propagated from VarModify.Marc Espie
Replace a few int -> size_t Reviewed by miod@
2000-06-23This patch replaces str_concat with a slightly unobfuscated version.Marc Espie
In particular, Dir_MakeFlags is abusing str_concat, and works much better with buffers.
2000-06-23This patch separates local contexts from global contexts for good.Marc Espie
Apart from a few casts, VAR_GLOBAL and friends are separate data structures, so we use a small array for local variables. We also junk allVars, since TargFreeGN can release local nodes, and var.c has explicit lists for its variables already. Reviewed millert@ and miod@.
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-17A few assorted changes, to remove more dynamic lists.Marc Espie
- in Dir_Expand, path is a misnomer. Use a temp variable instead... Reformat code for readability. - Change Parse_MainName/Targ_FindList so that they fill arguments instead of allocating new lists. - nuke Targ_FindList(TG_NOCREATE), as this is never used. - close a small memory hole (forgot to free sysMkPath if CLEANUP). Reviewed by millert@
2000-06-10Clean-up patch: use `void *' instead of old-fashioned ClientData/Address.Marc Espie
2000-06-10Thus, Lst_ForEach no longer needs returning a status.Marc Espie
In fact, it can become a macro based on Lst_ForEachFrom. This also introduces Lst_Every, as a shortcut for the very common case where Lst_ForEach does not need any user data. Finally, make consistent use of a few function typedefs, instead of having explicit void (*)(Lst) arguments all over the place.
2000-04-17Don't free Makefile filenames when the file is finished reading, butMarc Espie
keep them for error reporting.
2000-02-02Bug-fix: make should behave sensibly when presented with negative times...Marc Espie
- let *_MTime return booleans, as that's what they're used for, the time_t is set as a side effect. - use OUT_OF_DATE for a date starting point, set it at the origin of time.
2000-01-08Finish changing all Var_Parse arguments to size_t. Thanks to millert@Marc Espie
for reminding me.
1999-12-16Var_Subst is actually two distinct functions folded into one:Marc Espie
split the function specific to for.c out, and give them more sensible arguments at the same time. This makes .for loop handling more efficient, as we have some heuristic to evaluate the size of the buffer needed...
1999-12-16for.c becomes sane.Marc Espie
- split For_Eval into For_Eval (first line of loop) / For_Accumulate (remaining lines). - encapsulate state into a For structure, instead of brain damaged static variables that need copy. Very minor performance hit, specifically, For structure is allocated with malloc/free, instead of playing tricks with static/auto variables.
1999-12-09Split some allocation/error handling functions out of main.cMarc Espie
1999-12-06main prototype properly in main.c, remove dup.Marc Espie
1999-12-06Extra parameter no longer needed, ditch.Marc Espie
1999-12-06- introduce interval_dup in str.cMarc Espie
- use it to replace .for parsing with something approaching sanity. (this removes one of the few most blatant misuses of Bufs in make. More changes to come... patch reviewed by ho@
1999-11-11extern.h is a better name than nonints.hMarc Espie
(cvs file was copied from nonints.h to give a better sense of history).
1999-11-11Communicate line numbers between parse.c and for.c.Marc Espie
Parse_String starts in the current line, but at a given line number. .for loops yield correct line numbers, much easier to debug !
1999-11-11Kill Str_FindSubString, it's strstr.Marc Espie
1999-11-11Move all prototypes to nonints.h. Comment no longer reflects reality.Marc Espie
1998-12-05Modifications from netbsd:Marc Espie
- don't interfere with MACHINE/MACHINE_ARCH defines for bootstrap - type clean-up, time_t, and printing `unknown' ints - fix TARGET/MEMBER bug in archive rules - memmove... - cleaner Error handler. - reentrant brk_string - .MAKE env variable - preliminary scaffolding for .NOPATH Other improvements: - efree - shellneed streamlined - display Stop in .CURDIR after an error. - document most features and misfeatures. - add a few OpenBSD notes to the tutorial.
1996-11-30Sync with NetBSD:Todd C. Miller
- Merge in FreeBSD and Lite2 changes. - Fix bug where a non-archive target with a .a suffix would always be considered to be out of date, since it does not have a TOC. - Fix NetBSD PR #2930: declare missing variable.
1996-09-02Sync up with NetBSD:briggs
(christos) Fix bug reported by Greg Hudson where leaf (source only) nodes were referenced only by their basename and not by their full pathname. This breaks when .PATH or MAKEOBJDIR are used. There might be Makefiles around that try to work around this bug by prepending ${.CURDIR} to the sources, and they should be found and fixed. Also a lot of the gunk in suff.c that was attempting to work around the same problem could be removed. (christos) - Move -D flags from Makefile to config.h and explain what they do. Add -Wall -Wno-unused to CFLAGS. Add new define SYSVVARSUB to enable SysV style variable substitutions and enable them. - Add SunOS style command substitutions via SUNSHCMD - Fix core dump with '{variable = value' (christos) Fix bug where make will always exit with 0, even when one or more parallel jobs failed. (Only affects parallel make code) (christos) Protect __P from being multiply defined (for systems that already define it) (christos) Add strdup() since ultrix is missing it. From Larry Schwimmer <rosebud@cyclone.Stanford.EDU> (christos) Add estrdup(), a checked version of strdup and use it. (christos) Recognize SVR4 style long filename entries in archives. (thorpej) Tidy up some RCS ids a bit.
1996-06-26rcsidTheo de Raadt
1996-04-21sync to netbsd 960418Theo de Raadt
1995-12-14from christos@netbsd:Theo de Raadt
Minor: - ${.PREFIX} should never contain a full pathname - Fixed gcc -Wall warnings Major: - compatMake is now FALSE. This means that we are now running in full pmake mode: * rules on dependency lines can be executed in parallel and or out of sequence: foo: bar baz can fire the rule for baz before the rule for bar is fired. To enforce bar to be fired before baz, another rule needs to be added. [bar: baz] * adjacent shell commands in a target are now executed by a single invocation of the shell, not one invocation of the shell per line (compatMake can be turned off using the -B flag) - The -j flag now works... I.e. make -j 4 will fork up to four jobs in parallel when it can. The target name is printed before each burst of output caused by the target execution as '--- target ---', when j > 1 - I have changed all the Makefiles so that they work with make -j N, and I have tested the whole netbsd by: 'make -j 4 cleandir; make -j 4 depend; make -j 4; make -j 4 install' - I have not compiled or tested this version of make with -DREMOTE. - Turn compat mode on by default. It gets turned off when the -j without the -B flag is specified. [Thus you can use -j 1 to turn it off]. - Fix malloc -> emalloc as Gordon noted. Updates for POSIX/SVR4 compiling: arch.c: Don't require ranlib stuff. Not everybody has it. dir.c: SunOS-4 != Solaris; change #ifdef sun to #if sun && !__svr4__ job.c, compat.c: Don't use 'union wait', use int and the W*() macros. main.c: Check for uname() == -1; some unames return > 0... util.c, job.c: Add signal() with BSD semantics for svr4, don't use bsd sigmask and friends. from cgd@netbsd: pull in make.h. (PAlloc() now uses emalloc(), which is prototyped in make.h. If the prototype is not in scope on the Alpha, I see lots of "cast to pointer from integer of different size" warnings.)
1995-10-18initial import of NetBSD treeTheo de Raadt