Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Nov 2017 18:34:14 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r325955 - head/usr.sbin/config
Message-ID:  <201711171834.vAHIYEXV053999@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Fri Nov 17 18:34:14 2017
New Revision: 325955
URL: https://svnweb.freebsd.org/changeset/base/325955

Log:
  Fix 'local' to not look in the source tree for the file.
  
  Usually 'local' is used along with other rules such as 'no-implicit-rule' or
  'dependency' which avoids this problem.  It's possible to need to use 'local'
  while relying on the default rules though for a file which is not in the source
  tree nor generated in the kernel.
  
  Sponsored by:	Dell
  Differential Revision:	https://reviews.freebsd.org/D13125

Modified:
  head/usr.sbin/config/config.h
  head/usr.sbin/config/configvers.h
  head/usr.sbin/config/mkmakefile.c

Modified: head/usr.sbin/config/config.h
==============================================================================
--- head/usr.sbin/config/config.h	Fri Nov 17 18:16:46 2017	(r325954)
+++ head/usr.sbin/config/config.h	Fri Nov 17 18:34:14 2017	(r325955)
@@ -54,6 +54,7 @@ struct file_list {
 	char	*f_clean;		/* File list to add to clean rule */
 	char	*f_warn;		/* warning message */
 	const char *f_objprefix;	/* prefix string for object name */
+	const char *f_srcprefix;	/* source prefix such as $S/ */
 };
 
 struct files_name {

Modified: head/usr.sbin/config/configvers.h
==============================================================================
--- head/usr.sbin/config/configvers.h	Fri Nov 17 18:16:46 2017	(r325954)
+++ head/usr.sbin/config/configvers.h	Fri Nov 17 18:34:14 2017	(r325955)
@@ -49,5 +49,5 @@
  *
  * $FreeBSD$
  */
-#define	CONFIGVERS	600014
+#define	CONFIGVERS	600015
 #define	MAJOR_VERS(x)	((x) / 100000)

Modified: head/usr.sbin/config/mkmakefile.c
==============================================================================
--- head/usr.sbin/config/mkmakefile.c	Fri Nov 17 18:16:46 2017	(r325954)
+++ head/usr.sbin/config/mkmakefile.c	Fri Nov 17 18:34:14 2017	(r325955)
@@ -496,6 +496,10 @@ nextparam:;
 		tp = new_fent();
 		tp->f_fn = this;
 		tp->f_type = filetype;
+		if (filetype == LOCAL)
+			tp->f_srcprefix = "";
+		else
+			tp->f_srcprefix = "$S/";
 		if (imp_rule)
 			tp->f_flags |= NO_IMPLCT_RULE;
 		if (no_obj)
@@ -571,7 +575,8 @@ do_before_depend(FILE *fp)
 			if (tp->f_flags & NO_IMPLCT_RULE)
 				fprintf(fp, "%s ", tp->f_fn);
 			else
-				fprintf(fp, "$S/%s ", tp->f_fn);
+				fprintf(fp, "%s%s ", tp->f_srcprefix,
+				    tp->f_fn);
 			lpos += len + 1;
 		}
 	if (lpos != 8)
@@ -636,10 +641,7 @@ do_xxfiles(char *tag, FILE *fp)
 				lpos = 8;
 				fputs("\\\n\t", fp);
 			}
-			if (tp->f_type != LOCAL)
-				fprintf(fp, "$S/%s ", tp->f_fn);
-			else
-				fprintf(fp, "%s ", tp->f_fn);
+			fprintf(fp, "%s%s ", tp->f_srcprefix, tp->f_fn);
 			lpos += len + 1;
 		}
 	free(suff);
@@ -685,18 +687,21 @@ do_rules(FILE *f)
 		else {
 			*cp = '\0';
 			if (och == 'o') {
-				fprintf(f, "%s%so:\n\t-cp $S/%so .\n\n",
-					ftp->f_objprefix, tail(np), np);
+				fprintf(f, "%s%so:\n\t-cp %s%so .\n\n",
+					ftp->f_objprefix, tail(np),
+					ftp->f_srcprefix, np);
 				continue;
 			}
 			if (ftp->f_depends) {
-				fprintf(f, "%s%so: $S/%s%c %s\n",
-					ftp->f_objprefix, tail(np), np, och,
+				fprintf(f, "%s%so: %s%s%c %s\n",
+					ftp->f_objprefix, tail(np),
+					ftp->f_srcprefix, np, och,
 					ftp->f_depends);
 			}
 			else {
-				fprintf(f, "%s%so: $S/%s%c\n",
-					ftp->f_objprefix, tail(np), np, och);
+				fprintf(f, "%s%so: %s%s%c\n",
+					ftp->f_objprefix, tail(np),
+					ftp->f_srcprefix, np, och);
 			}
 		}
 		compilewith = ftp->f_compilewith;
@@ -725,7 +730,8 @@ do_rules(FILE *f)
 		}
 		*cp = och;
 		if (strlen(ftp->f_objprefix))
-			fprintf(f, "\t%s $S/%s\n", compilewith, np);
+			fprintf(f, "\t%s %s%s\n", compilewith,
+			    ftp->f_srcprefix, np);
 		else
 			fprintf(f, "\t%s\n", compilewith);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711171834.vAHIYEXV053999>