Module Name: src Committed By: tls Date: Sun Aug 10 06:58:27 UTC 2014
Modified Files: src/usr.bin/make [tls-earlyentropy]: Makefile job.c main.c make.h parse.c var.c src/usr.bin/make/PSD.doc [tls-earlyentropy]: Makefile Log Message: Rebase. To generate a diff of this commit: cvs rdiff -u -r1.56 -r1.56.8.1 src/usr.bin/make/Makefile cvs rdiff -u -r1.176 -r1.176.2.1 src/usr.bin/make/job.c cvs rdiff -u -r1.226 -r1.226.2.1 src/usr.bin/make/main.c cvs rdiff -u -r1.92 -r1.92.2.1 src/usr.bin/make/make.h cvs rdiff -u -r1.194 -r1.194.2.1 src/usr.bin/make/parse.c cvs rdiff -u -r1.184 -r1.184.2.1 src/usr.bin/make/var.c cvs rdiff -u -r1.2 -r1.2.92.1 src/usr.bin/make/PSD.doc/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/Makefile diff -u src/usr.bin/make/Makefile:1.56 src/usr.bin/make/Makefile:1.56.8.1 --- src/usr.bin/make/Makefile:1.56 Wed May 30 21:54:23 2012 +++ src/usr.bin/make/Makefile Sun Aug 10 06:58:27 2014 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.56 2012/05/30 21:54:23 sjg Exp $ +# $NetBSD: Makefile,v 1.56.8.1 2014/08/10 06:58:27 tls Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make @@ -25,9 +25,7 @@ COPTS.meta.c += -DHAVE_FILEMON_H -I${FIL .endif .PATH: ${.CURDIR}/lst.lib -.if make(install) SUBDIR= PSD.doc -.endif .if make(obj) || make(clean) SUBDIR+= unit-tests .endif Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.176 src/usr.bin/make/job.c:1.176.2.1 --- src/usr.bin/make/job.c:1.176 Sun Aug 4 16:48:15 2013 +++ src/usr.bin/make/job.c Sun Aug 10 06:58:27 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.176 2013/08/04 16:48:15 sjg Exp $ */ +/* $NetBSD: job.c,v 1.176.2.1 2014/08/10 06:58:27 tls Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -70,14 +70,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: job.c,v 1.176 2013/08/04 16:48:15 sjg Exp $"; +static char rcsid[] = "$NetBSD: job.c,v 1.176.2.1 2014/08/10 06:58:27 tls Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: job.c,v 1.176 2013/08/04 16:48:15 sjg Exp $"); +__RCSID("$NetBSD: job.c,v 1.176.2.1 2014/08/10 06:58:27 tls Exp $"); #endif #endif /* not lint */ #endif @@ -1346,7 +1346,7 @@ JobExec(Job *job, char **argv) (void)fcntl(0, F_SETFD, 0); (void)lseek(0, (off_t)0, SEEK_SET); - if (job->node->type & OP_MAKE) { + if (job->node->type & (OP_MAKE | OP_SUBMAKE)) { /* * Pass job token pipe to submakes. */ Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.226 src/usr.bin/make/main.c:1.226.2.1 --- src/usr.bin/make/main.c:1.226 Fri Feb 7 17:23:35 2014 +++ src/usr.bin/make/main.c Sun Aug 10 06:58:27 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.226 2014/02/07 17:23:35 pooka Exp $ */ +/* $NetBSD: main.c,v 1.226.2.1 2014/08/10 06:58:27 tls Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,7 +69,7 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: main.c,v 1.226 2014/02/07 17:23:35 pooka Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.226.2.1 2014/08/10 06:58:27 tls Exp $"; #else #include <sys/cdefs.h> #ifndef lint @@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19 #if 0 static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: main.c,v 1.226 2014/02/07 17:23:35 pooka Exp $"); +__RCSID("$NetBSD: main.c,v 1.226.2.1 2014/08/10 06:58:27 tls Exp $"); #endif #endif /* not lint */ #endif @@ -99,14 +99,14 @@ __RCSID("$NetBSD: main.c,v 1.226 2014/02 * * Error Print a tagged error message. The global * MAKE variable must have been defined. This - * takes a format string and two optional - * arguments for it. + * takes a format string and optional arguments + * for it. * * Fatal Print an error message and exit. Also takes - * a format string and two arguments. + * a format string and arguments for it. * * Punt Aborts all jobs and exits with a message. Also - * takes a format string and two arguments. + * takes a format string and arguments for it. * * Finish Finish things up by printing the number of * errors which occurred, as passed to it, and Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.92 src/usr.bin/make/make.h:1.92.2.1 --- src/usr.bin/make/make.h:1.92 Wed Sep 4 15:38:26 2013 +++ src/usr.bin/make/make.h Sun Aug 10 06:58:27 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.92 2013/09/04 15:38:26 sjg Exp $ */ +/* $NetBSD: make.h,v 1.92.2.1 2014/08/10 06:58:27 tls Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -273,6 +273,7 @@ typedef struct GNode { #define OP_NOMETA 0x00080000 /* .NOMETA do not create a .meta file */ #define OP_META 0x00100000 /* .META we _do_ want a .meta file */ #define OP_NOMETA_CMP 0x00200000 /* Do not compare commands in .meta file */ +#define OP_SUBMAKE 0x00400000 /* Possibly a submake node */ /* Attributes applied by PMake */ #define OP_TRANSFORM 0x80000000 /* The node is a transformation rule */ #define OP_MEMBER 0x40000000 /* Target is a member of an archive */ Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.194 src/usr.bin/make/parse.c:1.194.2.1 --- src/usr.bin/make/parse.c:1.194 Sat Feb 15 00:17:17 2014 +++ src/usr.bin/make/parse.c Sun Aug 10 06:58:27 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.194 2014/02/15 00:17:17 christos Exp $ */ +/* $NetBSD: parse.c,v 1.194.2.1 2014/08/10 06:58:27 tls Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: parse.c,v 1.194 2014/02/15 00:17:17 christos Exp $"; +static char rcsid[] = "$NetBSD: parse.c,v 1.194.2.1 2014/08/10 06:58:27 tls Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)parse.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: parse.c,v 1.194 2014/02/15 00:17:17 christos Exp $"); +__RCSID("$NetBSD: parse.c,v 1.194.2.1 2014/08/10 06:58:27 tls Exp $"); #endif #endif /* not lint */ #endif @@ -1952,6 +1952,40 @@ Parse_DoVar(char *line, GNode *ctxt) } +/* + * ParseMaybeSubMake -- + * Scan the command string to see if it a possible submake node + * Input: + * cmd the command to scan + * Results: + * TRUE if the command is possibly a submake, FALSE if not. + */ +static Boolean +ParseMaybeSubMake(const char *cmd) +{ + size_t i; + static struct { + const char *name; + size_t len; + } vals[] = { +#define MKV(A) { A, sizeof(A) - 1 } + MKV("${MAKE}"), + MKV("${.MAKE}"), + MKV("$(MAKE)"), + MKV("$(.MAKE)"), + MKV("make"), + }; + for (i = 0; i < sizeof(vals)/sizeof(vals[0]); i++) { + char *ptr; + if ((ptr = strstr(cmd, vals[i].name)) == NULL) + continue; + if ((ptr == cmd || !isalnum((unsigned char)ptr[-1])) + && !isalnum((unsigned char)ptr[vals[i].len])) + return TRUE; + } + return FALSE; +} + /*- * ParseAddCmd -- * Lst_ForEach function to add a command line to all targets @@ -1964,7 +1998,9 @@ Parse_DoVar(char *line, GNode *ctxt) * Always 0 * * Side Effects: - * A new element is added to the commands list of the node. + * A new element is added to the commands list of the node, + * and the node can be marked as a submake node if the command is + * determined to be that. */ static int ParseAddCmd(void *gnp, void *cmd) @@ -1978,6 +2014,8 @@ ParseAddCmd(void *gnp, void *cmd) /* if target already supplied, ignore commands */ if (!(gn->type & OP_HAS_COMMANDS)) { (void)Lst_AtEnd(gn->commands, cmd); + if (ParseMaybeSubMake(cmd)) + gn->type |= OP_SUBMAKE; ParseMark(gn); } else { #ifdef notyet Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.184 src/usr.bin/make/var.c:1.184.2.1 --- src/usr.bin/make/var.c:1.184 Wed Sep 4 15:38:26 2013 +++ src/usr.bin/make/var.c Sun Aug 10 06:58:27 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $ */ +/* $NetBSD: var.c,v 1.184.2.1 2014/08/10 06:58:27 tls Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -69,14 +69,14 @@ */ #ifndef MAKE_NATIVE -static char rcsid[] = "$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $"; +static char rcsid[] = "$NetBSD: var.c,v 1.184.2.1 2014/08/10 06:58:27 tls Exp $"; #else #include <sys/cdefs.h> #ifndef lint #if 0 static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94"; #else -__RCSID("$NetBSD: var.c,v 1.184 2013/09/04 15:38:26 sjg Exp $"); +__RCSID("$NetBSD: var.c,v 1.184.2.1 2014/08/10 06:58:27 tls Exp $"); #endif #endif /* not lint */ #endif @@ -2636,7 +2636,7 @@ ApplyModifiers(char *nstr, const char *t break; } free(UNCONST(pattern.rhs)); - newStr = var_Error; + newStr = varNoError; break; } goto default_case; /* "::<unrecognised>" */ @@ -3660,6 +3660,7 @@ Var_Parse(const char *str, GNode *ctxt, } } else { Buffer buf; /* Holds the variable name */ + int depth = 1; endc = startc == PROPEN ? PRCLOSE : BRCLOSE; Buf_Init(&buf, 0); @@ -3667,11 +3668,22 @@ Var_Parse(const char *str, GNode *ctxt, /* * Skip to the end character or a colon, whichever comes first. */ - for (tstr = str + 2; - *tstr != '\0' && *tstr != endc && *tstr != ':'; - tstr++) + for (tstr = str + 2; *tstr != '\0'; tstr++) { /* + * Track depth so we can spot parse errors. + */ + if (*tstr == startc) { + depth++; + } + if (*tstr == endc) { + if (--depth == 0) + break; + } + if (depth == 1 && *tstr == ':') { + break; + } + /* * A variable inside a variable, expand */ if (*tstr == '$') { @@ -3690,7 +3702,7 @@ Var_Parse(const char *str, GNode *ctxt, } if (*tstr == ':') { haveModifier = TRUE; - } else if (*tstr != '\0') { + } else if (*tstr == endc) { haveModifier = FALSE; } else { /* @@ -4040,7 +4052,7 @@ Var_Subst(const char *var, const char *s */ if (oldVars) { str += length; - } else if (undefErr) { + } else if (undefErr || val == var_Error) { /* * If variable is undefined, complain and skip the * variable. The complaint will stop us from doing anything Index: src/usr.bin/make/PSD.doc/Makefile diff -u src/usr.bin/make/PSD.doc/Makefile:1.2 src/usr.bin/make/PSD.doc/Makefile:1.2.92.1 --- src/usr.bin/make/PSD.doc/Makefile:1.2 Wed Jun 14 15:20:23 1995 +++ src/usr.bin/make/PSD.doc/Makefile Sun Aug 10 06:58:27 2014 @@ -1,8 +1,10 @@ -# $NetBSD: Makefile,v 1.2 1995/06/14 15:20:23 christos Exp $ +# $NetBSD: Makefile,v 1.2.92.1 2014/08/10 06:58:27 tls Exp $ # @(#)Makefile 8.1 (Berkeley) 8/14/93 -DIR= psd/12.make +SECTION=reference/ref1 +ARTICLE=make SRCS= tutorial.ms MACROS= -ms +EXTRAHTMLFILES=make1.png make2.png .include <bsd.doc.mk>