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
This commit is contained in:
Bryan Drewery 2017-11-17 18:34:14 +00:00
parent 1cbb58886a
commit 1bf59a71c7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=325955
3 changed files with 20 additions and 13 deletions

View File

@ -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 {

View File

@ -49,5 +49,5 @@
*
* $FreeBSD$
*/
#define CONFIGVERS 600014
#define CONFIGVERS 600015
#define MAJOR_VERS(x) ((x) / 100000)

View File

@ -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);