diff options
author | Marc Espie <espie@cvs.openbsd.org> | 2001-05-23 12:34:58 +0000 |
---|---|---|
committer | Marc Espie <espie@cvs.openbsd.org> | 2001-05-23 12:34:58 +0000 |
commit | db8e89b77998123612f763908cdd1c46cc7ea24f (patch) | |
tree | af42f9f2b44b6bae3a6ca23660ff612c49709e27 /usr.bin/make/extern.h | |
parent | d0640eab6718b3ff0eeb66e78aa4d5d8a8ed3c24 (diff) |
Mostly clean-up:
- 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).
Diffstat (limited to 'usr.bin/make/extern.h')
-rw-r--r-- | usr.bin/make/extern.h | 170 |
1 files changed, 23 insertions, 147 deletions
diff --git a/usr.bin/make/extern.h b/usr.bin/make/extern.h index fa147953930..9c94bccd45e 100644 --- a/usr.bin/make/extern.h +++ b/usr.bin/make/extern.h @@ -1,5 +1,8 @@ +#ifndef EXTERN_H +#define EXTERN_H + /* $OpenPackages$ */ -/* $OpenBSD: extern.h,v 1.37 2001/05/03 13:41:05 espie Exp $ */ +/* $OpenBSD: extern.h,v 1.38 2001/05/23 12:34:42 espie Exp $ */ /* $NetBSD: nonints.h,v 1.12 1996/11/06 17:59:19 christos Exp $ */ /*- @@ -42,149 +45,22 @@ * from: @(#)nonints.h 8.3 (Berkeley) 3/19/94 */ -/* arch.c */ -extern ReturnStatus Arch_ParseArchive(char **, Lst, SymTable *); -extern void Arch_Touch(GNode *); -extern void Arch_TouchLib(GNode *); -extern TIMESTAMP Arch_MTime(GNode *); -extern TIMESTAMP Arch_MemMTime(GNode *); -extern void Arch_FindLib(GNode *, Lst); -extern Boolean Arch_LibOODate(GNode *); -extern void Arch_Init(void); -extern void Arch_End(void); -extern Boolean Arch_IsLib(GNode *); - -/* compat.c */ -extern void Compat_Run(Lst); - -/* cond.c */ -extern int Cond_Eval(char *); -extern void Cond_End(void); - -#include "error.h" - -/* for.c */ -typedef struct For_ For; -extern For *For_Eval(const char *); -extern Boolean For_Accumulate(For *, const char *); -extern void For_Run (For *); - -/* main.c */ -extern void Main_ParseArgLine(char *); -extern char *Cmd_Exec(const char *, char **); -extern void Error(char *, ...); -extern void Fatal(char *, ...); -extern void Punt(char *, ...); -extern void DieHorribly(void); -extern void PrintAddr(void *); -extern void Finish(int); - -/* make.c */ -extern void Make_TimeStamp(GNode *, GNode *); -extern Boolean Make_OODate(GNode *); -extern void Make_HandleUse(GNode *, GNode *); -extern void Make_Update(GNode *); -extern void Make_DoAllVar(GNode *); -extern Boolean Make_Run(Lst); - -/* parse.c */ -extern void Parse_Error(int, char *, ...); -extern Boolean Parse_AnyExport(void); -extern Boolean Parse_IsVar(char *); -extern void Parse_DoVar(const char *, GSymT *); -extern void Parse_AddIncludeDir(const char *); -extern void Parse_File(char *, FILE *); -extern void Parse_Init(void); -extern void Parse_End(void); -extern void Parse_FromString(char *, unsigned long); -extern unsigned long Parse_Getlineno(void); -extern const char *Parse_Getfilename(void); -extern void Parse_MainName(Lst); - -/* stats.h */ -extern void Init_Stats(void); - -/* str.c */ -extern void str_init(void); -extern void str_end(void); -extern char *lastchar(const char *, const char *, int); -extern char *str_concati(const char *, const char *, const char *, int); -#define str_concat(s1, s2, sep) str_concati(s1, s2, strchr(s2, '\0'), sep) -extern char **brk_string(const char *, int *, char **); -extern const char *iterate_words(const char **); -extern Boolean Str_Matchi(const char *, const char *, const char *); -#define Str_Match(string, pattern) \ - Str_Matchi(string, pattern, strchr(pattern, '\0')) -extern const char *Str_SYSVMatch(const char *, const char *, size_t *); -extern void Str_SYSVSubst(Buffer, const char *, const char *, size_t); -extern char *interval_dup(const char *, const char *); -extern char *escape_dup(const char *, const char *, const char *); - -/* suff.c */ -extern void Suff_ClearSuffixes(void); -extern Boolean Suff_IsTransform(const char *); -extern GNode *Suff_AddTransform(const char *); -extern void Suff_EndTransform(void *); -extern void Suff_AddSuffix(char *); -extern Lst Suff_GetPath(char *); -extern void Suff_DoPaths(void); -extern void Suff_AddInclude(char *); -extern void Suff_AddLib(char *); -extern void Suff_FindDeps(GNode *); -extern void Suff_SetNull(char *); -extern void Suff_Init(void); -extern void Suff_End(void); -extern void Suff_PrintAll(void); - -/* targ.c */ -extern void Targ_Init(void); -extern void Targ_End(void); -extern GNode *Targ_NewGN(const char *, const char *); -extern GNode *Targ_FindNode(const char *, const char *, int); -extern void Targ_FindList(Lst, Lst); -extern Boolean Targ_Ignore(GNode *); -extern Boolean Targ_Silent(GNode *); -extern Boolean Targ_Precious(GNode *); -extern void Targ_SetMain(GNode *); -extern void Targ_PrintCmd(void *); -extern char *Targ_FmtTime(TIMESTAMP); -extern void Targ_PrintType(int); -extern void Targ_PrintGraph(int); - -/* var.c */ -extern void Var_Delete(const char *); -extern void Var_Set_interval(const char *, const char *, const char *, - GSymT *); -extern void Varq_Set(int, const char *, GNode *); -extern void Var_Append_interval(const char *, const char *, - const char *, GSymT *); -extern void Varq_Append(int, const char *, GNode *); -extern char *Var_Value_interval(const char *, const char *); -extern char *Varq_Value(int, GNode *); -extern char *Var_Parse(const char *, SymTable *, Boolean, size_t *, - Boolean *); -extern size_t Var_ParseSkip(const char *, SymTable *, ReturnStatus *); -extern ReturnStatus Var_ParseBuffer(Buffer, const char *, SymTable *, - Boolean, size_t *); -extern char *Var_Subst(const char *, SymTable *, Boolean); -extern void Var_SubstVar(Buffer, const char *, const char *, const char *); -extern void Var_Init(void); -extern void Var_End(void); -extern void Var_Dump(void); -extern void SymTable_Init(SymTable *); -extern void SymTable_Destroy(SymTable *); -#define Var_Set(n, v, ctxt) Var_Set_interval(n, NULL, v, ctxt) -#define Var_Append(n, v, ctxt) Var_Append_interval(n, NULL, v, ctxt) -#define Var_Value(n) Var_Value_interval(n, NULL) -extern void Var_AddCmdline(const char *); - -/* Used to store temporary names, after $ expansion */ -struct Name { - const char *s; - const char *e; - Boolean tofree; -}; - -extern const char *Var_Name_Get(const char *, struct Name *, SymTable *, - Boolean, const char *(*)(const char *)); -extern void Var_Name_Free(struct Name *); +extern bool compatMake; /* True if we are make compatible */ +extern bool ignoreErrors; /* True if should ignore all errors */ +extern bool beSilent; /* True if should print no commands */ +extern bool noExecute; /* True if should execute nothing */ +extern bool allPrecious; /* True if every target is precious */ +extern bool keepgoing; /* True if should continue on unaffected + * portions of the graph when have an error + * in one portion */ +extern bool touchFlag; /* true if targets should just be 'touched' + * if out of date. Set by the -t flag */ +extern bool usePipes; /* true if should capture the output of + * subshells by means of pipes. Otherwise it + * is routed to temporary files from which it + * is retrieved when the shell exits */ +extern bool queryFlag; /* true if we aren't supposed to really make + * anything, just see if the targets are out- + * of-date */ + +#endif |