diff options
-rw-r--r-- | usr.sbin/config/config.h | 1 | ||||
-rw-r--r-- | usr.sbin/config/mkmakefile.c | 55 |
2 files changed, 36 insertions, 20 deletions
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index 726e2a4..80d46bf 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -49,6 +49,7 @@ struct file_list { u_char f_flags; /* see below */ char *f_special; /* special make rule if present */ char *f_depends; /* additional dependancies */ + char *f_clean; /* File list to add to clean rule */ char *f_needs; /* * Random values: diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 3ec0271..b3f7f07 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -210,6 +210,8 @@ makefile() do_rules(ofp); else if (eq(line, "%LOAD\n")) do_load(ofp); + else if (eq(line, "%CLEAN\n")) + do_clean(ofp); else fprintf(stderr, "Unknown %% construct in generic makefile: %s", @@ -230,7 +232,7 @@ read_files() register struct device *dp; struct device *save_dp; register struct opt *op; - char *wd, *this, *needs, *special, *depends; + char *wd, *this, *needs, *special, *depends, *clean; char fname[32]; int nreqs, first = 1, configdep, isdup, std, filetype, imp_rule, no_obj, before_depend; @@ -252,7 +254,8 @@ next: * filename [ standard | optional ] [ config-dependent ] * [ dev* | profiling-routine ] [ device-driver] [ no-obj ] * [ compile-with "compile rule" [no-implicit-rule] ] - * [ dependancy "dependancy-list"] [ before-depend ] + * [ dependency "dependency-list"] [ before-depend ] + * [ clean "file-list"] */ wd = get_word(fp); if (wd == (char *)EOF) { @@ -300,6 +303,7 @@ next: nreqs = 0; special = 0; depends = 0; + clean = 0; configdep = 0; needs = 0; std = 0; @@ -338,7 +342,7 @@ nextparam: before_depend++; goto nextparam; } - if (eq(wd, "dependancy")) { + if (eq(wd, "dependency")) { next_quoted_word(fp, wd); if (wd == 0) { printf("%s: %s missing compile command string.\n", @@ -348,27 +352,14 @@ nextparam: depends = ns(wd); goto nextparam; } - if (eq(wd, "no-obj")) { - no_obj++; - goto nextparam; - } - if (eq(wd, "no-implicit-rule")) { - if (special == 0) { - printf("%s: alternate rule required when " - "\"no-implicit-rule\" is specified.\n", - fname); - } - imp_rule++; - goto nextparam; - } - if (eq(wd, "dependancy")) { + if (eq(wd, "clean")) { next_quoted_word(fp, wd); if (wd == 0) { - printf("%s: %s missing compile command string.\n", + printf("%s: %s missing clean file list.\n", fname); exit(1); } - depends = ns(wd); + clean = ns(wd); goto nextparam; } if (eq(wd, "compile-with")) { @@ -429,6 +420,7 @@ invis: tp->f_flags = isdup; tp->f_special = special; tp->f_depends = depends; + tp->f_clean = clean; goto next; doneparam: @@ -466,6 +458,7 @@ save: tp->f_needs = needs; tp->f_special = special; tp->f_depends = depends; + tp->f_clean = clean; if (pf && pf->f_type == INVISIBLE) pf->f_flags = 1; /* mark as duplicate */ goto next; @@ -488,7 +481,6 @@ opteq(cp, dp) } } - do_before_depend(fp) FILE *fp; { @@ -698,6 +690,29 @@ do_load(f) putc('\n', f); } +do_clean(fp) + FILE *fp; +{ + register struct file_list *tp, *fl; + register int lpos, len; + char swapname[32]; + + fputs("CLEAN=", fp); + lpos = 7; + for (tp = ftab; tp; tp = tp->f_next) + if (tp->f_clean) { + len = strlen(tp->f_clean); + if (len + lpos > 72) { + lpos = 8; + fputs("\\\n\t", fp); + } + fprintf(fp, "%s ", tp->f_clean); + lpos += len + 1; + } + if (lpos != 8) + putc('\n', fp); +} + struct file_list * do_systemspec(f, fl, first) FILE *f; |