summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkent <kent@NetBSD.org>2008-07-16 11:45:56 +0000
committerkent <kent@NetBSD.org>2008-07-16 11:45:56 +0000
commitecafa994fb8ae44b6fa06a08d36bd5817edea81f (patch)
treee2bbb289936820e99239a095188c8c2fef797fce
parent72572e11a6279edf1810bf283d82e3584e3b9e97 (diff)
* emitrules()
- code cleanup - support for extensions of which length is not 1
-rw-r--r--usr.bin/config/mkmakefile.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/usr.bin/config/mkmakefile.c b/usr.bin/config/mkmakefile.c
index cb7dcdf12a0..38bce4ca2f9 100644
--- a/usr.bin/config/mkmakefile.c
+++ b/usr.bin/config/mkmakefile.c
@@ -1,4 +1,4 @@
-/* $NetBSD: mkmakefile.c,v 1.6 2007/01/13 23:47:36 christos Exp $ */
+/* $NetBSD: mkmakefile.c,v 1.7 2008/07/16 11:45:56 kent Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -407,7 +407,6 @@ emitrules(FILE *fp)
struct files *fi;
const char *cp, *fpath;
int ch;
- char buf[200];
TAILQ_FOREACH(fi, &allfiles, fi_next) {
if ((fi->fi_flags & FI_SEL) == 0)
@@ -425,17 +424,19 @@ emitrules(FILE *fp)
fi->fi_base,
filetype_prologue(&fi->fi_fit),
fpath);
- }
+ }
}
- if ((cp = fi->fi_mkrule) == NULL) {
- cp = "NORMAL";
- ch = fpath[strlen(fpath) - 1];
- if (islower(ch))
- ch = toupper(ch);
- (void)snprintf(buf, sizeof(buf), "${%s_%c}", cp, ch);
- cp = buf;
+ if (fi->fi_mkrule != NULL) {
+ fprintf(fp, "\t%s\n\n", fi->fi_mkrule);
+ } else {
+ fputs("\t${NORMAL_", fp);
+ cp = strrchr(fpath, '.');
+ cp = cp == NULL ? fpath : cp + 1;
+ while ((ch = *cp++) != '\0') {
+ fputc(toupper(ch), fp);
+ }
+ fputs("}\n\n", fp);
}
- fprintf(fp, "\t%s\n\n", cp);
}
}