int main(int argc, char *argv[]) { char *p; const char *last_component; char *outfile = NULL; int pflag, ch, eflag, uflag, fflag; pflag = eflag = uflag = fflag = 0; while ((ch = getopt(argc, argv, "egpfb:s:o:u")) != -1) { switch (ch) { case 'o': outfile = optarg; break; case 'u': uflag = 1; break; case 'f': fflag = 1; break; case 'e': eflag = 1; if (!isatty(STDIN_FILENO)) verbose = 1; break; case 'g': /* * In addition to DEBUG, you probably wanted to * set "options KGDB" and maybe others. We could * do that for you, but you really should just * put them in the config file. */ (void)fputs( "-g is obsolete (use makeoptions DEBUG=\"-g\")\n", stderr); usage(); case 'p': /* * Essentially the same as makeoptions PROF="-pg", * but also changes the path from ../../compile/FOO * to ../../compile/FOO.PROF; i.e., compile a * profiling kernel based on a typical "regular" * kernel. * * Note that if you always want profiling, you * can (and should) use a "makeoptions" line. */ pflag = 1; break; case 'b': builddir = optarg; break; case 's': srcdir = optarg; break; default: usage(); } } argc -= optind; argv += optind; if (argc > 1 || (eflag && argv[0] == NULL)) usage(); if (eflag) { #ifdef MAKE_BOOTSTRAP fprintf(stderr, "config: UKC not available in this binary\n"); exit(1); #else return (ukc(argv[0], outfile, uflag, fflag)); #endif } conffile = (argc == 1) ? argv[0] : "CONFIG"; if (firstfile(conffile)) { (void)fprintf(stderr, "config: cannot read %s: %s\n", conffile, strerror(errno)); exit(2); } /* * Init variables. */ minmaxusers = 1; maxmaxusers = 10000; initintern(); initfiles(); initsem(); devbasetab = ht_new(); devatab = ht_new(); selecttab = ht_new(); needcnttab = ht_new(); opttab = ht_new(); mkopttab = ht_new(); defopttab = ht_new(); nextopt = &options; nextmkopt = &mkoptions; nextdefopt = &defoptions; /* * Handle profiling (must do this before we try to create any * files). */ last_component = strrchr(conffile, '/'); last_component = (last_component) ? last_component + 1 : conffile; if (pflag) { int len = strlen(last_component) + 17; p = emalloc(len); (void)snprintf(p, len, "../compile/%s.PROF", last_component); (void)addmkoption(intern("PROF"), "-pg"); (void)addoption(intern("GPROF"), NULL); } else { int len = strlen(last_component) + 12; p = emalloc(len); (void)snprintf(p, len, "../compile/%s", last_component); } defbuilddir = (argc == 0) ? "." : p; /* * Parse config file (including machine definitions). */ if (yyparse()) stop(); /* * Fix (as in `set firmly in place') files. */ if (fixfiles()) stop(); /* * Fix objects and libraries. */ if (fixobjects()) stop(); /* * Perform cross-checking. */ if (maxusers == 0) { if (defmaxusers) { (void)printf("maxusers not specified; %d assumed\n", defmaxusers); maxusers = defmaxusers; } else { (void)fprintf(stderr, "config: need \"maxusers\" line\n"); errors++; } } if (crosscheck() || errors) stop(); /* * Squeeze things down and finish cross-checks (STAR checks must * run after packing). */ pack(); if (badstar()) stop(); /* * Ready to go. Build all the various files. */ if (mksymlinks() || mkmakefile() || mkheaders() || mkswap() || mkioconf()) stop(); optiondelta(); exit(0); }
void initsym(void) { initintern(); symtab = ht_new(); }