Index: usr.sbin/config/config.h =================================================================== --- usr.sbin/config/config.h +++ usr.sbin/config/config.h @@ -58,6 +58,7 @@ char *f_warn; /* warning message */ const char *f_objprefix; /* prefix string for object name */ const char *f_srcprefix; /* source prefix such as $S/ */ + char *f_requires; /* which other options does this require */ }; struct files_name { Index: usr.sbin/config/configvers.h =================================================================== --- usr.sbin/config/configvers.h +++ usr.sbin/config/configvers.h @@ -49,7 +49,7 @@ * * $FreeBSD$ */ -#define CONFIGVERS 600018 +#define CONFIGVERS 600019 #define MAJOR_VERS(x) ((x) / 100000) /* Last config(8) version to require envmode/hintmode */ Index: usr.sbin/config/mkmakefile.c =================================================================== --- usr.sbin/config/mkmakefile.c +++ usr.sbin/config/mkmakefile.c @@ -129,6 +129,36 @@ return (ifp); } +/* + * Make sure that we have all the required options. + */ +static void +check_required_devices(void) +{ + struct file_list *tp; + struct device *dp; + bool found; + const char *name; + + STAILQ_FOREACH(tp, &ftab, f_next) { + if (tp->f_requires == NULL) + continue; + name = tp->f_requires; + found = false; + STAILQ_FOREACH(dp, &dtab, d_next) { + if (eq(dp->d_name, name)) { + found = true; + break; + } + } + if (!found) { + printf("File %s requires device %s, which is not present\n", + tp->f_fn, tp->f_requires); + exit(1); + } + } +} + /* * Build the makefile from the skeleton */ @@ -140,6 +170,7 @@ struct opt *op, *t; read_files(); + check_required_devices(); ifp = open_makefile_template(); ofp = fopen(path("Makefile.new"), "w"); if (ofp == NULL) @@ -392,7 +423,7 @@ struct file_list *tp; struct device *dp; struct opt *op; - char *wd, *this, *compilewith, *depends, *clean, *warning; + char *wd, *this, *compilewith, *depends, *clean, *warning, *requires; const char *objprefix; int compile, match, nreqs, std, filetype, not, imp_rule, no_ctfconvert, no_obj, before_depend, nowerror; @@ -409,6 +440,7 @@ * [ dependency "dependency-list"] [ before-depend ] * [ clean "file-list"] [ warning "text warning" ] * [ obj-prefix "file prefix"] + * [ requires "requires-list" ] * [ nowerror ] [ local ] */ wd = get_word(fp); @@ -448,6 +480,7 @@ depends = NULL; clean = NULL; warning = NULL; + requires = NULL; std = 0; imp_rule = 0; no_ctfconvert = 0; @@ -507,6 +540,14 @@ depends = ns(wd); continue; } + if (eq(wd, "requires")) { + wd = get_quoted_word(fp); + if (wd == (char *)EOF || wd == NULL) + errout("%s: %s missing dependency string.\n", + fname, this); + requires = ns(wd); + continue; + } if (eq(wd, "clean")) { wd = get_quoted_word(fp); if (wd == (char *)EOF || wd == NULL) @@ -597,6 +638,7 @@ if (nowerror) tp->f_flags |= NOWERROR; tp->f_compilewith = compilewith; + tp->f_requires = requires; tp->f_depends = depends; tp->f_clean = clean; tp->f_warn = warning;