Index: hash_tables.c =================================================================== RCS file: /home/ncvs/src/usr.bin/make/hash_tables.c,v retrieving revision 1.4 diff -u -r1.4 hash_tables.c --- hash_tables.c 12 Mar 2008 14:51:47 -0000 1.4 +++ hash_tables.c 27 May 2008 11:27:17 -0000 @@ -1,6 +1,6 @@ /* * DO NOT EDIT - * $FreeBSD: src/usr.bin/make/hash_tables.c,v 1.4 2008/03/12 14:51:47 obrien Exp $ + * $FreeBSD$ * auto-generated from FreeBSD: src/usr.bin/make/parse.c,v 1.114 2008/03/12 14:50:58 obrien Exp * DO NOT EDIT */ @@ -10,36 +10,37 @@ /* * d=2 - * n=40 - * m=19 + * n=44 + * m=21 * c=2.09 * maxlen=1 * minklen=2 - * maxklen=9 - * minchar=97 + * maxklen=13 + * minchar=95 * maxchar=119 * loop=0 - * numiter=1 + * numiter=2 * seed= */ static const signed char directive_g[] = { - 8, 0, 0, 5, 6, -1, 17, 15, 10, 6, - -1, -1, 10, 0, 0, -1, 18, 2, 3, 0, - 7, -1, -1, -1, 0, 14, -1, -1, 11, 16, - -1, -1, 0, -1, 0, 0, 17, 0, -1, 1, + 13, -1, 15, 11, 15, 16, 5, 3, 5, 7, + -1, 19, 14, -1, -1, -1, 0, -1, -1, 19, + -1, 19, -1, 0, 9, -1, -1, 13, 11, 13, + 0, 6, 17, -1, 0, -1, 3, 0, -1, -1, + -1, -1, 0, 0, }; static const u_char directive_T0[] = { - 26, 14, 19, 35, 10, 34, 18, 27, 1, 17, - 22, 37, 12, 12, 36, 21, 0, 6, 1, 25, - 9, 4, 19, + 30, 5, 3, 11, 2, 18, 42, 40, 39, 5, + 11, 33, 17, 38, 7, 23, 43, 15, 1, 33, + 40, 6, 2, 10, 9, }; static const u_char directive_T1[] = { - 25, 22, 19, 0, 2, 18, 33, 18, 30, 4, - 30, 9, 21, 19, 16, 12, 35, 34, 4, 19, - 9, 33, 16, + 11, 33, 29, 6, 41, 29, 35, 0, 9, 18, + 9, 11, 23, 16, 41, 0, 38, 16, 15, 17, + 8, 18, 1, 26, 7, }; @@ -49,20 +50,20 @@ unsigned f0, f1; const u_char *kp = key; - if (len < 2 || len > 9) + if (len < 2 || len > 13) return -1; for (f0=f1=0; kp < key + len; ++kp) { - if (*kp < 97 || *kp > 119) + if (*kp < 95 || *kp > 119) return -1; - f0 += directive_T0[-97 + *kp]; - f1 += directive_T1[-97 + *kp]; + f0 += directive_T0[-95 + *kp]; + f1 += directive_T1[-95 + *kp]; } - f0 %= 40; - f1 %= 40; + f0 %= 44; + f1 %= 44; - return (directive_g[f0] + directive_g[f1]) % 19; + return (directive_g[f0] + directive_g[f1]) % 21; } /* * d=2 Index: main.c =================================================================== RCS file: /home/ncvs/src/usr.bin/make/main.c,v retrieving revision 1.168 diff -u -r1.168 main.c --- main.c 12 Mar 2008 14:50:58 -0000 1.168 +++ main.c 27 May 2008 11:26:53 -0000 @@ -678,11 +678,21 @@ * Main_AddSourceMakefile * Add a file to the list of source makefiles */ -void -Main_AddSourceMakefile(const char *name) +int +Main_AddSourceMakefile(const char *name, int once) { + LstNode *lNode; + + if (once) { + LST_FOREACH(lNode, &source_makefiles) { + if (!strcmp((char *)Lst_Datum(lNode), name)) { + return (1); + } + } + } Lst_AtEnd(&source_makefiles, estrdup(name)); + return (0); } /** Index: make.1 =================================================================== RCS file: /home/ncvs/src/usr.bin/make/make.1,v retrieving revision 1.110 diff -u -r1.110 make.1 --- make.1 24 Mar 2008 09:47:44 -0000 1.110 +++ make.1 27 May 2008 11:32:00 -0000 @@ -955,11 +955,21 @@ .Fl I option are searched before the system makefile directory. +.It Ic .include-once Ar +.It Ic .include-once Ar \*qfile\*q +Like +.Ic .include , +but silently skip if the file has already been included. .It Ic .sinclude Ar .It Ic .sinclude Ar \*qfile\*q Like .Ic .include , but silently ignored if the file cannot be found and opened. +.It Ic .sinclude-once Ar +.It Ic .sinclude-once Ar \*qfile\*q +Like +.Ic .sinclude , +but silently skip if the file has already been included. .It Ic .undef Ar variable Un-define the specified global variable. Only global variables may be un-defined. Index: make.h =================================================================== RCS file: /home/ncvs/src/usr.bin/make/make.h,v retrieving revision 1.35 diff -u -r1.35 make.h --- make.h 8 Mar 2007 09:16:10 -0000 1.35 +++ make.h 27 May 2008 11:26:53 -0000 @@ -68,6 +68,6 @@ Boolean Make_Run(struct Lst *); void Main_ParseArgLine(char *, int); int Main_ParseWarn(const char *, int); -void Main_AddSourceMakefile(const char *); +int Main_AddSourceMakefile(const char *, int); #endif /* make_h_a91074b9 */ Index: parse.c =================================================================== RCS file: /home/ncvs/src/usr.bin/make/parse.c,v retrieving revision 1.114 diff -u -r1.114 parse.c --- parse.c 12 Mar 2008 14:50:58 -0000 1.114 +++ parse.c 27 May 2008 11:26:53 -0000 @@ -242,6 +242,8 @@ static void parse_include(char *, int, int); static void parse_sinclude(char *, int, int); +static void parse_include_once(char *, int, int); +static void parse_sinclude_once(char *, int, int); static void parse_message(char *, int, int); static void parse_undef(char *, int, int); static void parse_for(char *, int, int); @@ -271,6 +273,8 @@ { "ifnmake", COND_IFNMAKE, TRUE, Cond_If }, { "include", 0, FALSE, parse_include }, { "sinclude", 0, FALSE, parse_sinclude }, + { "include_once", 0, FALSE, parse_include_once }, + { "sinclude_once", 0, FALSE, parse_sinclude_once }, { "undef", 0, FALSE, parse_undef }, { "warning", 0, FALSE, parse_message }, /* DIRECTIVES-END-TAG */ @@ -2073,7 +2077,7 @@ * options */ static void -xparse_include(char *file, int sinclude) +xparse_include(char *file, int sinclude, int once) { char *fullname; /* full pathname of file */ char endc; /* the character which ends the file spec */ @@ -2081,6 +2085,7 @@ Boolean isSystem; /* TRUE if makefile is a system makefile */ char *prefEnd, *Fname; char *newName; + int skip_parse; /* * Skip to delimiter character so we know where to look @@ -2191,11 +2196,11 @@ if (!sinclude) Parse_Error(PARSE_FATAL, "Could not find %s", file); else - Main_AddSourceMakefile(file); + Main_AddSourceMakefile(file, once); free(file); return; } - Main_AddSourceMakefile(fullname); + skip_parse = Main_AddSourceMakefile(fullname, once); free(file); /* @@ -2203,20 +2208,34 @@ * name of the include file so error messages refer to the right * place. */ - ParsePushInput(fullname, NULL, NULL, 0); - DEBUGF(DIR, (".include %s\n", fullname)); + if (!skip_parse) { + ParsePushInput(fullname, NULL, NULL, 0); + DEBUGF(DIR, (".include %s\n", fullname)); + } } static void parse_include(char *file, int code __unused, int lineno __unused) { - xparse_include(file, 0); + xparse_include(file, 0, 0); } static void parse_sinclude(char *file, int code __unused, int lineno __unused) { - xparse_include(file, 1); + xparse_include(file, 1, 0); +} + +static void +parse_include_once(char *file, int code __unused, int lineno __unused) +{ + xparse_include(file, 0, 1); +} + +static void +parse_sinclude_once(char *file, int code __unused, int lineno __unused) +{ + xparse_include(file, 1, 1); } /**