diff options
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/config/config.h | 2 | ||||
-rw-r--r-- | usr.sbin/config/main.c | 15 | ||||
-rw-r--r-- | usr.sbin/config/mkmakefile.c | 35 | ||||
-rw-r--r-- | usr.sbin/config/mkoptions.c | 4 |
4 files changed, 39 insertions, 17 deletions
diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index d1ba1ed..31d3375 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -144,6 +144,8 @@ int yyparse(void); int yylex(void); void options(void); void makefile(void); +void makeenv(void); +void makehints(void); void headers(void); extern STAILQ_HEAD(device_head, device) dtab; diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c index e7f270e..d485e91 100644 --- a/usr.sbin/config/main.c +++ b/usr.sbin/config/main.c @@ -162,10 +162,23 @@ main(int argc, char **argv) STAILQ_INIT(&ftab); if (yyparse()) exit(3); + + /* + * Ensure that required elements (machine, cpu, ident) are present. + */ if (machinename == NULL) { printf("Specify machine type, e.g. ``machine i386''\n"); exit(1); } + if (ident == NULL) { + printf("no ident line specified\n"); + exit(1); + } + if (SLIST_EMPTY(&cputype)) { + printf("cpu type must be specified\n"); + exit(1); + } + /* * make symbolic links in compilation directory * for "sys" (to make genassym.c work along with #include <sys/xxx>) @@ -194,6 +207,8 @@ main(int argc, char **argv) } options(); /* make options .h files */ makefile(); /* build Makefile */ + makeenv(); /* build env.c */ + makehints(); /* build hints.c */ headers(); /* make a lot of .h files */ configfile(); /* put config file into kernel*/ cleanheaders(p); diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 9ef2adf..157cff6 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -113,7 +113,6 @@ makefile(void) char line[BUFSIZ]; struct opt *op; int versreq; - char *s; read_files(); snprintf(line, sizeof(line), "../../conf/Makefile.%s", machinename); @@ -125,12 +124,6 @@ makefile(void) if (ifp == 0) err(1, "%s", line); - /* XXX this check seems to be misplaced. */ - if (SLIST_EMPTY(&cputype)) { - printf("cpu type must be specified\n"); - exit(1); - } - ofp = fopen(path("Makefile.new"), "w"); if (ofp == 0) err(1, "%s", path("Makefile.new")); @@ -181,8 +174,18 @@ makefile(void) (void) fclose(ifp); (void) fclose(ofp); moveifchanged(path("Makefile.new"), path("Makefile")); +} + +/* + * Build hints.c from the skeleton + */ +void +makehints(void) +{ + FILE *ifp, *ofp; + char line[BUFSIZ]; + char *s; - /* XXX makefile() should make the Makefile, not hints.c. */ if (hints) { ifp = fopen(hints, "r"); if (ifp == NULL) @@ -234,8 +237,18 @@ makefile(void) fclose(ifp); fclose(ofp); moveifchanged(path("hints.c.new"), path("hints.c")); +} + +/* + * Build env.c from the skeleton + */ +void +makeenv(void) +{ + FILE *ifp, *ofp; + char line[BUFSIZ]; + char *s; - /* XXX makefile() should make the Makefile, not env.c. */ if (env) { ifp = fopen(env, "r"); if (ifp == NULL) @@ -518,10 +531,6 @@ read_files(void) char fname[MAXPATHLEN]; struct files_name *nl, *tnl; - if (ident == NULL) { - printf("no ident line specified\n"); - exit(1); - } (void) snprintf(fname, sizeof(fname), "../../conf/files"); read_file(fname); (void) snprintf(fname, sizeof(fname), diff --git a/usr.sbin/config/mkoptions.c b/usr.sbin/config/mkoptions.c index 3e2dcf7..d757815 100644 --- a/usr.sbin/config/mkoptions.c +++ b/usr.sbin/config/mkoptions.c @@ -290,10 +290,6 @@ read_options(void) char genopt[MAXPATHLEN]; SLIST_INIT(&otab); - if (ident == NULL) { - printf("no ident line specified\n"); - exit(1); - } (void) snprintf(fname, sizeof(fname), "../../conf/options"); openit: fp = fopen(fname, "r"); |