summaryrefslogtreecommitdiffstats
path: root/usr.sbin/config/mkmakefile.c
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2006-10-01 17:17:29 +0000
committerru <ru@FreeBSD.org>2006-10-01 17:17:29 +0000
commita8ad84893be3f8949d0d3ba220bd78a93db88d3b (patch)
tree5c720c33434229e47a6f0e310cfbd46ad8f8aec6 /usr.sbin/config/mkmakefile.c
parent4ed2930c61e06d9eefc5dbb917d52b872b555cbe (diff)
downloadFreeBSD-src-a8ad84893be3f8949d0d3ba220bd78a93db88d3b.zip
FreeBSD-src-a8ad84893be3f8949d0d3ba220bd78a93db88d3b.tar.gz
Added rudimentary support for the "include" directive (inside "files").
This will be used to split sys/conf/files into multiple files similar to how this is done in NetBSD.
Diffstat (limited to 'usr.sbin/config/mkmakefile.c')
-rw-r--r--usr.sbin/config/mkmakefile.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c
index 0bf5620..47a1db0 100644
--- a/usr.sbin/config/mkmakefile.c
+++ b/usr.sbin/config/mkmakefile.c
@@ -305,6 +305,7 @@ makeenv(void)
static void
read_file(char *fname)
{
+ char ifname[MAXPATHLEN];
FILE *fp;
struct file_list *tp;
struct device *dp;
@@ -318,6 +319,7 @@ read_file(char *fname)
err(1, "%s", fname);
next:
/*
+ * include "filename"
* filename [ standard | mandatory | optional ]
* [ dev* [ | dev* ... ] | profiling-routine ] [ no-obj ]
* [ compile-with "compile rule" [no-implicit-rule] ]
@@ -337,6 +339,18 @@ next:
;
goto next;
}
+ if (eq(wd, "include")) {
+ next_quoted_word(fp, wd);
+ if (wd == 0) {
+ printf("%s: missing include filename.\n", fname);
+ exit(1);
+ }
+ (void) snprintf(ifname, sizeof(ifname), "../../%s", wd);
+ read_file(ifname);
+ while (((wd = get_word(fp)) != (char *)EOF) && wd)
+ ;
+ goto next;
+ }
this = ns(wd);
next_word(fp, wd);
if (wd == 0) {
OpenPOWER on IntegriCloud