aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/config
diff options
context:
space:
mode:
authorJustin T. Gibbs <gibbs@FreeBSD.org>1994-11-17 20:30:01 +0000
committerJustin T. Gibbs <gibbs@FreeBSD.org>1994-11-17 20:30:01 +0000
commit80785c507bdf018b11911ab68ca1e8611d2411ad (patch)
tree373bc925211666d905d56d30f3306f04f3b413ad /usr.sbin/config
parent09faa0cc642b3537863144f50a0e5b092fbba638 (diff)
downloadsrc-80785c507bdf018b11911ab68ca1e8611d2411ad.tar.gz
src-80785c507bdf018b11911ab68ca1e8611d2411ad.zip
Add new keywords to config. The options availible in file.i386 are now:
/* * filename [ standard | optional ] [ config-dependent ] * [ dev* | profiling-routine ] [ device-driver] [ no-obj ] * [ compile-with "compile rule" [no-implicit-rule] ] * [ dependancy "dependancy-list"] */ I added no-obj - This entry does not create anything linkable to the kernel. dependancy - Add additional dependancy rules to a target. no-implicit-rule - Don't assume .c -> .o type rules. Config is really dumb in this area and assumes that everything is a .c file irregarless of extention. This was the best choice really since there may even be .c file that you don't want to follow the standard rules. This was all done so that the building to the aic7770 assembler and using the aic7770 assembler in the building of the aic7770 driver could be config dependant. I can now have an entry like this for the driver: aic7770 optional ahc device-driver \ compile-with "${CC} $> -o $@" \ dependancy "$S/gnu/misc/aic7770/aic7770.c" \ no-obj no-implicit-rule aic7770_seq.h optional ahc device-driver \ compile-with "${.CURDIR}/aic7770 -o $@ $S/gnu/misc/aic7770/aic7770.seq"\ dependancy "$S/gnu/misc/aic7770/aic7770.seq aic7770" \ no-obj no-implicit-rule i386/isa/aic7770.c optional ahc device-driver \ dependancy "aic7770_seq.h" I also added '\' escaping to newlines so that this doesn't look as gross as it could have. Reviewed by: jkh
Notes
Notes: svn path=/head/; revision=4571
Diffstat (limited to 'usr.sbin/config')
-rw-r--r--usr.sbin/config/config.h3
-rw-r--r--usr.sbin/config/main.c26
-rw-r--r--usr.sbin/config/mkmakefile.c67
3 files changed, 84 insertions, 12 deletions
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h
index 012a2496b063..ec8907233cdc 100644
--- a/usr.sbin/config/config.h
+++ b/usr.sbin/config/config.h
@@ -48,6 +48,7 @@ struct file_list {
u_char f_type; /* see below */
u_char f_flags; /* see below */
char *f_special; /* special make rule if present */
+ char *f_depends; /* additional dependancies */
char *f_needs;
/*
* Random values:
@@ -94,6 +95,8 @@ struct file_list {
* Attributes (flags).
*/
#define CONFIGDEP 1
+#define NO_IMPLCT_RULE 2
+#define NO_OBJ 4
struct idlst {
char *id;
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index 76c2200b7271..804a3b877bff 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -198,14 +198,25 @@ get_word(fp)
static char line[80];
register int ch;
register char *cp;
+ int escaped_nl = 0;
+begin:
while ((ch = getc(fp)) != EOF)
if (ch != ' ' && ch != '\t')
break;
if (ch == EOF)
return ((char *)EOF);
+ if (ch == '\\'){
+ escaped_nl = 1;
+ goto begin;
+ }
if (ch == '\n')
- return (NULL);
+ if (escaped_nl){
+ escaped_nl = 0;
+ goto begin;
+ }
+ else
+ return (NULL);
cp = line;
*cp++ = ch;
while ((ch = getc(fp)) != EOF) {
@@ -232,14 +243,25 @@ get_quoted_word(fp)
static char line[256];
register int ch;
register char *cp;
+ int escaped_nl = 0;
+begin:
while ((ch = getc(fp)) != EOF)
if (ch != ' ' && ch != '\t')
break;
if (ch == EOF)
return ((char *)EOF);
+ if (ch == '\\'){
+ escaped_nl = 1;
+ goto begin;
+ }
if (ch == '\n')
- return (NULL);
+ if (escaped_nl){
+ escaped_nl = 0;
+ goto begin;
+ }
+ else
+ return (NULL);
cp = line;
if (ch == '"' || ch == '\'') {
register int quote = ch;
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index e76a32c20936..89a94866aeaf 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -228,9 +228,9 @@ read_files()
register struct device *dp;
struct device *save_dp;
register struct opt *op;
- char *wd, *this, *needs, *special;
+ char *wd, *this, *needs, *special, *depends;
char fname[32];
- int nreqs, first = 1, configdep, isdup, std, filetype;
+ int nreqs, first = 1, configdep, isdup, std, filetype, imp_rule, no_obj;
ftab = 0;
(void) strcpy(fname, "../../conf/files");
@@ -247,8 +247,9 @@ openit:
next:
/*
* filename [ standard | optional ] [ config-dependent ]
- * [ dev* | profiling-routine ] [ device-driver]
- * [ compile-with "compile rule" ]
+ * [ dev* | profiling-routine ] [ device-driver] [ no-obj ]
+ * [ compile-with "compile rule" [no-implicit-rule] ]
+ * [ dependancy "dependancy-list"]
*/
wd = get_word(fp);
if (wd == (char *)EOF) {
@@ -295,9 +296,12 @@ next:
fname, this, tp->f_fn);
nreqs = 0;
special = 0;
+ depends = 0;
configdep = 0;
needs = 0;
std = 0;
+ imp_rule = 0;
+ no_obj = 0;
filetype = NORMAL;
if (eq(wd, "standard"))
std = 1;
@@ -313,6 +317,29 @@ nextparam:
configdep++;
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")) {
+ next_quoted_word(fp, wd);
+ if (wd == 0) {
+ printf("%s: %s missing compile command string.\n",
+ fname);
+ exit(1);
+ }
+ depends = ns(wd);
+ goto nextparam;
+ }
if (eq(wd, "compile-with")) {
next_quoted_word(fp, wd);
if (wd == 0) {
@@ -370,6 +397,7 @@ invis:
tp->f_needs = needs;
tp->f_flags = isdup;
tp->f_special = special;
+ tp->f_depends = depends;
goto next;
doneparam:
@@ -394,8 +422,13 @@ save:
tp->f_flags = 0;
if (configdep)
tp->f_flags |= CONFIGDEP;
+ if (imp_rule)
+ tp->f_flags |= NO_IMPLCT_RULE;
+ if (no_obj)
+ tp->f_flags |= NO_OBJ;
tp->f_needs = needs;
tp->f_special = special;
+ tp->f_depends = depends;
if (pf && pf->f_type == INVISIBLE)
pf->f_flags = 1; /* mark as duplicate */
goto next;
@@ -429,7 +462,7 @@ do_objs(fp)
fprintf(fp, "OBJS=");
lpos = 6;
for (tp = ftab; tp != 0; tp = tp->f_next) {
- if (tp->f_type == INVISIBLE)
+ if (tp->f_type == INVISIBLE || tp->f_flags & NO_OBJ)
continue;
sp = tail(tp->f_fn);
for (fl = conf_list; fl; fl = fl->f_next) {
@@ -526,12 +559,26 @@ do_rules(f)
continue;
cp = (np = ftp->f_fn) + strlen(ftp->f_fn) - 1;
och = *cp;
- *cp = '\0';
- if (och == 'o') {
- fprintf(f, "%so:\n\t-cp $S/%so .\n\n", tail(np), np);
- continue;
+ if (ftp->f_flags & NO_IMPLCT_RULE) {
+ if (ftp->f_depends)
+ fprintf(f, "%s: %s\n", np, ftp->f_depends );
+ else
+ fprintf(f, "%s: \n", np );
+ }
+ else {
+ *cp = '\0';
+ if (och == 'o') {
+ fprintf(f, "%so:\n\t-cp $S/%so .\n\n",
+ tail(np), np);
+ continue;
+ }
+ if (ftp->f_depends)
+ fprintf(f, "%so: $S/%s%c %s\n", tail(np),
+ np, och, ftp->f_depends);
+ else
+ fprintf(f, "%so: $S/%s%c\n", tail(np),
+ np, och);
}
- fprintf(f, "%so: $S/%s%c\n", tail(np), np, och);
tp = tail(np);
special = ftp->f_special;
if (special == 0) {