Make the xxxFILES= list generation generic. This makes it easier to add

things like MFILES= or CONFFILES= without having to modify config code.
This commit is contained in:
Peter Wemm 2000-11-25 03:25:34 +00:00
parent ed0fe1449c
commit 3f964411b5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=69135
7 changed files with 39 additions and 83 deletions

View File

@ -17,7 +17,7 @@
#
# Which version of config(8) is required.
%VERSREQ= 500004
%VERSREQ= 500005
# Can be overridden by makeoptions or /etc/make.conf
KERNEL_KO?= kernel
@ -100,11 +100,11 @@ SYSTEM_DEP+= $S/conf/ldscript.$M
%OBJS
%CFILES
%FILES.c
%SFILES
%FILES.s
%MFILES
%FILES.m
%CLEAN

View File

@ -17,7 +17,7 @@
#
# Which version of config(8) is required.
%VERSREQ= 500004
%VERSREQ= 500005
# Can be overridden by makeoptions or /etc/make.conf
KERNEL_KO?= kernel
@ -104,11 +104,11 @@ SYSTEM_DEP+= $S/conf/ldscript.$M
%OBJS
%CFILES
%FILES.c
%SFILES
%FILES.s
%MFILES
%FILES.m
%CLEAN

View File

@ -27,7 +27,7 @@ OBJCOPY= ia64-unknown-linux-objcopy
MACHINE_ARCH= ia64
# Which version of config(8) is required.
%VERSREQ= 500004
%VERSREQ= 500005
# Can be overridden by makeoptions or /etc/make.conf
KERNEL_KO?= kernel
@ -110,11 +110,11 @@ SYSTEM_DEP+= $S/conf/ldscript.$M
%OBJS
%CFILES
%FILES.c
%SFILES
%FILES.s
%MFILES
%FILES.m
%CLEAN

View File

@ -19,7 +19,7 @@
#
# Which version of config(8) is required.
%VERSREQ= 500004
%VERSREQ= 500005
# Can be overridden by makeoptions or /etc/make.conf
KERNEL_KO?= kernel
@ -106,11 +106,11 @@ SYSTEM_DEP+= $S/conf/ldscript.$M
%OBJS
%CFILES
%FILES.c
%SFILES
%FILES.s
%MFILES
%FILES.m
%CLEAN

View File

@ -17,7 +17,7 @@
#
# Which version of config(8) is required.
%VERSREQ= 500004
%VERSREQ= 500005
# Can be overridden by makeoptions or /etc/make.conf
KERNEL_KO?= kernel
@ -104,11 +104,11 @@ SYSTEM_DEP+= $S/conf/ldscript.$M
%OBJS
%CFILES
%FILES.c
%SFILES
%FILES.s
%MFILES
%FILES.m
%CLEAN

View File

@ -8,4 +8,4 @@
*
* $FreeBSD$
*/
#define CONFIGVERS 500004
#define CONFIGVERS 500005

View File

@ -74,9 +74,7 @@ static struct file_list *fcur;
static char *tail(char *);
static void do_clean(FILE *);
static void do_rules(FILE *);
static void do_sfiles(FILE *);
static void do_mfiles(FILE *);
static void do_cfiles(FILE *);
static void do_xxfiles(char *, FILE *);
static void do_objs(FILE *);
static void do_before_depend(FILE *);
static int opteq(char *, char *);
@ -183,12 +181,8 @@ makefile(void)
do_before_depend(ofp);
else if (eq(line, "%OBJS\n"))
do_objs(ofp);
else if (eq(line, "%MFILES\n"))
do_mfiles(ofp);
else if (eq(line, "%CFILES\n"))
do_cfiles(ofp);
else if (eq(line, "%SFILES\n"))
do_sfiles(ofp);
else if (strncmp(line, "%FILES.", 7) == 0)
do_xxfiles(line, ofp);
else if (eq(line, "%RULES\n"))
do_rules(ofp);
else if (eq(line, "%CLEAN\n"))
@ -644,17 +638,28 @@ do_objs(FILE *fp)
}
static void
do_cfiles(FILE *fp)
do_xxfiles(char *tag, FILE *fp)
{
struct file_list *tp;
int lpos, len;
int lpos, len, slen;
char *suff, *SUFF;
fputs("CFILES=", fp);
if (tag[strlen(tag) - 1] == '\n')
tag[strlen(tag) - 1] = '\0';
suff = ns(tag + 7);
SUFF = ns(suff);
raisestr(SUFF);
slen = strlen(suff);
fprintf(fp, "%sFILES=", SUFF);
lpos = 8;
for (tp = ftab; tp; tp = tp->f_next)
if (tp->f_type != INVISIBLE && tp->f_type != NODEPEND) {
len = strlen(tp->f_fn);
if (tp->f_fn[len - 1] != 'c')
if (tp->f_fn[len - slen - 1] != '.')
continue;
if (strcasecmp(&tp->f_fn[len - slen], suff) != 0)
continue;
if ((len = 3 + len) + lpos > 72) {
lpos = 8;
@ -664,55 +669,6 @@ do_cfiles(FILE *fp)
fprintf(fp, "$S/%s ", tp->f_fn);
else
fprintf(fp, "%s ", tp->f_fn);
lpos += len + 1;
}
if (lpos != 8)
putc('\n', fp);
}
static void
do_mfiles(FILE *fp)
{
struct file_list *tp;
int lpos, len;
fputs("MFILES=", fp);
lpos = 8;
for (tp = ftab; tp; tp = tp->f_next)
if (tp->f_type != INVISIBLE) {
len = strlen(tp->f_fn);
if (tp->f_fn[len - 1] != 'm' || tp->f_fn[len - 2] != '.')
continue;
if ((len = 3 + len) + lpos > 72) {
lpos = 8;
fputs("\\\n\t", fp);
}
fprintf(fp, "$S/%s ", tp->f_fn);
lpos += len + 1;
}
if (lpos != 8)
putc('\n', fp);
}
static void
do_sfiles(FILE *fp)
{
struct file_list *tp;
int lpos, len;
fputs("SFILES=", fp);
lpos = 8;
for (tp = ftab; tp; tp = tp->f_next)
if (tp->f_type != INVISIBLE) {
len = strlen(tp->f_fn);
if (tp->f_fn[len - 1] != 'S' && tp->f_fn[len - 1] != 's')
continue;
if ((len = 3 + len) + lpos > 72) {
lpos = 8;
fputs("\\\n\t", fp);
}
fprintf(fp, "$S/%s ", tp->f_fn);
lpos += len + 1;
}
if (lpos != 8)