Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/config/mkmakefile.c
Show First 20 Lines • Show All 149 Lines • ▼ Show 20 Lines | makefile(void) | ||||
SLIST_FOREACH_SAFE(op, &mkopt, op_next, t) { | SLIST_FOREACH_SAFE(op, &mkopt, op_next, t) { | ||||
fprintf(ofp, "%s=%s", op->op_name, op->op_value); | fprintf(ofp, "%s=%s", op->op_name, op->op_value); | ||||
while ((op = SLIST_NEXT(op, op_append)) != NULL) | while ((op = SLIST_NEXT(op, op_append)) != NULL) | ||||
fprintf(ofp, " %s", op->op_value); | fprintf(ofp, " %s", op->op_value); | ||||
fprintf(ofp, "\n"); | fprintf(ofp, "\n"); | ||||
} | } | ||||
if (debugging) | if (debugging) | ||||
fprintf(ofp, "DEBUG=-g\n"); | fprintf(ofp, "DEBUG=-g\n"); | ||||
if (profiling) | |||||
fprintf(ofp, "PROFLEVEL=%d\n", profiling); | |||||
if (*srcdir != '\0') | if (*srcdir != '\0') | ||||
fprintf(ofp,"S=%s\n", srcdir); | fprintf(ofp,"S=%s\n", srcdir); | ||||
while (fgets(line, BUFSIZ, ifp) != NULL) { | while (fgets(line, BUFSIZ, ifp) != NULL) { | ||||
if (*line != '%') { | if (*line != '%') { | ||||
fprintf(ofp, "%s", line); | fprintf(ofp, "%s", line); | ||||
continue; | continue; | ||||
} | } | ||||
if (eq(line, "%BEFORE_DEPEND\n")) | if (eq(line, "%BEFORE_DEPEND\n")) | ||||
▲ Show 20 Lines • Show All 233 Lines • ▼ Show 20 Lines | read_file(char *fname) | ||||
fp = fopen(fname, "r"); | fp = fopen(fname, "r"); | ||||
if (fp == NULL) | if (fp == NULL) | ||||
err(1, "%s", fname); | err(1, "%s", fname); | ||||
next: | next: | ||||
/* | /* | ||||
* include "filename" | * include "filename" | ||||
* filename [ standard | optional ] | * filename [ standard | optional ] | ||||
* [ dev* [ | dev* ... ] | profiling-routine ] [ no-obj ] | * [ dev* [ | dev* ... ] | [ no-obj ] | ||||
* [ compile-with "compile rule" [no-implicit-rule] ] | * [ compile-with "compile rule" [no-implicit-rule] ] | ||||
* [ dependency "dependency-list"] [ before-depend ] | * [ dependency "dependency-list"] [ before-depend ] | ||||
* [ clean "file-list"] [ warning "text warning" ] | * [ clean "file-list"] [ warning "text warning" ] | ||||
* [ obj-prefix "file prefix"] | * [ obj-prefix "file prefix"] | ||||
* [ nowerror ] [ local ] | * [ nowerror ] [ local ] | ||||
*/ | */ | ||||
wd = get_word(fp); | wd = get_word(fp); | ||||
if (wd == (char *)EOF) { | if (wd == (char *)EOF) { | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | if (eq(wd, "local")) { | ||||
filetype = LOCAL; | filetype = LOCAL; | ||||
continue; | continue; | ||||
} | } | ||||
if (eq(wd, "no-depend")) { | if (eq(wd, "no-depend")) { | ||||
filetype = NODEPEND; | filetype = NODEPEND; | ||||
continue; | continue; | ||||
} | } | ||||
nreqs++; | nreqs++; | ||||
if (eq(wd, "profiling-routine")) { | |||||
filetype = PROFILING; | |||||
continue; | |||||
} | |||||
if (std) | if (std) | ||||
errout("standard entry %s has optional inclusion specifier %s!\n", | errout("standard entry %s has optional inclusion specifier %s!\n", | ||||
this, wd); | this, wd); | ||||
STAILQ_FOREACH(dp, &dtab, d_next) | STAILQ_FOREACH(dp, &dtab, d_next) | ||||
if (eq(dp->d_name, wd)) { | if (eq(dp->d_name, wd)) { | ||||
if (not) | if (not) | ||||
match = 0; | match = 0; | ||||
else | else | ||||
Show All 11 Lines | |||||
nextparam:; | nextparam:; | ||||
not = 0; | not = 0; | ||||
} | } | ||||
compile += match; | compile += match; | ||||
if (compile && tp == NULL) { | if (compile && tp == NULL) { | ||||
if (std == 0 && nreqs == 0) | if (std == 0 && nreqs == 0) | ||||
errout("%s: what is %s optional on?\n", | errout("%s: what is %s optional on?\n", | ||||
fname, this); | fname, this); | ||||
if (filetype == PROFILING && profiling == 0) | |||||
goto next; | |||||
tp = new_fent(); | tp = new_fent(); | ||||
tp->f_fn = this; | tp->f_fn = this; | ||||
tp->f_type = filetype; | tp->f_type = filetype; | ||||
if (filetype == LOCAL) | if (filetype == LOCAL) | ||||
tp->f_srcprefix = ""; | tp->f_srcprefix = ""; | ||||
else | else | ||||
tp->f_srcprefix = "$S/"; | tp->f_srcprefix = "$S/"; | ||||
if (imp_rule) | if (imp_rule) | ||||
▲ Show 20 Lines • Show All 185 Lines • ▼ Show 20 Lines | STAILQ_FOREACH(ftp, &ftab, f_next) { | ||||
} | } | ||||
compilewith = ftp->f_compilewith; | compilewith = ftp->f_compilewith; | ||||
if (compilewith == NULL) { | if (compilewith == NULL) { | ||||
const char *ftype = NULL; | const char *ftype = NULL; | ||||
switch (ftp->f_type) { | switch (ftp->f_type) { | ||||
case NORMAL: | case NORMAL: | ||||
ftype = "NORMAL"; | ftype = "NORMAL"; | ||||
break; | |||||
case PROFILING: | |||||
if (!profiling) | |||||
continue; | |||||
ftype = "PROFILE"; | |||||
break; | break; | ||||
default: | default: | ||||
fprintf(stderr, | fprintf(stderr, | ||||
"config: don't know rules for %s\n", np); | "config: don't know rules for %s\n", np); | ||||
break; | break; | ||||
} | } | ||||
snprintf(cmd, sizeof(cmd), | snprintf(cmd, sizeof(cmd), | ||||
"${%s_%c%s}", ftype, | "${%s_%c%s}", ftype, | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |