Implement "clean" entries for device config entries.

Submitted by: Pointed out by Bruce Evans <bde@zeta.org.au>
This commit is contained in:
Justin T. Gibbs 1995-03-01 10:09:03 +00:00
parent 0bf316f5ac
commit ce584e16e7
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=6803
2 changed files with 36 additions and 20 deletions

View File

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

View File

@ -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 @@ read_files()
* 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 @@ read_files()
nreqs = 0;
special = 0;
depends = 0;
clean = 0;
configdep = 0;
needs = 0;
std = 0;
@ -338,7 +342,7 @@ read_files()
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 @@ read_files()
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 @@ read_files()
tp->f_flags = isdup;
tp->f_special = special;
tp->f_depends = depends;
tp->f_clean = clean;
goto next;
doneparam:
@ -466,6 +458,7 @@ read_files()
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;