diff --git a/usr.sbin/config/mkmakefile.cc b/usr.sbin/config/mkmakefile.cc --- a/usr.sbin/config/mkmakefile.cc +++ b/usr.sbin/config/mkmakefile.cc @@ -384,13 +384,25 @@ struct file_list *tp; struct device *dp; struct opt *op; + struct includepath *ipath; configword wd; - char *rfile, *compilewith, *depends, *clean, *warning; + char *rfile, *compilewith, *depends, *clean, *fnamebuf, *warning; const char *objprefix; int compile, match, nreqs, std, filetype, negate, imp_rule, no_ctfconvert, no_obj, before_depend, nowerror; fp = fopen(fname, "r"); + if (fp == NULL) { + SLIST_FOREACH(ipath, &includepath, path_next) { + asprintf(&fnamebuf, "%s/%s", ipath->path, fname); + if (fnamebuf != NULL) { + fp = fopen(fnamebuf, "r"); + if (fp != NULL) + break; + free(fnamebuf); + } + } + } if (fp == NULL) err(1, "%s", fname); next: