Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/config Tag each .c file with the options that might ...
details: https://anonhg.NetBSD.org/src/rev/e129ef527fd8
branches: trunk
changeset: 992380:e129ef527fd8
user: riastradh <riastradh%NetBSD.org@localhost>
date: Mon Aug 27 05:35:00 2018 +0000
description:
Tag each .c file with the options that might have brought it in.
diffstat:
usr.bin/config/mkmakefile.c | 43 +++++++++++++++++++++++++++++++++++++++++--
1 files changed, 41 insertions(+), 2 deletions(-)
diffs (71 lines):
diff -r 85e7f397d0ee -r e129ef527fd8 usr.bin/config/mkmakefile.c
--- a/usr.bin/config/mkmakefile.c Mon Aug 27 05:34:49 2018 +0000
+++ b/usr.bin/config/mkmakefile.c Mon Aug 27 05:35:00 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkmakefile.c,v 1.70 2017/06/16 02:01:10 christos Exp $ */
+/* $NetBSD: mkmakefile.c,v 1.71 2018/08/27 05:35:00 riastradh Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: mkmakefile.c,v 1.70 2017/06/16 02:01:10 christos Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.71 2018/08/27 05:35:00 riastradh Exp $");
#include <sys/param.h>
#include <ctype.h>
@@ -584,6 +584,34 @@
}
/*
+ * Emit all options included in a conditional expression
+ */
+static void
+emitopts(FILE *fp, struct condexpr *cond, int include)
+{
+
+ switch (cond->cx_type) {
+ case CX_ATOM:
+ if (include && selectopt(cond->cx_u.atom, NULL))
+ fprintf(fp, " %s", cond->cx_u.atom);
+ break;
+ case CX_NOT:
+ emitopts(fp, cond->cx_u.not, !include);
+ break;
+ case CX_AND:
+ emitopts(fp, cond->cx_u.and.left, include);
+ emitopts(fp, cond->cx_u.and.right, include);
+ break;
+ case CX_OR:
+ emitopts(fp, cond->cx_u.and.left, include);
+ emitopts(fp, cond->cx_u.and.right, include);
+ break;
+ default:
+ cfgerror("bug");
+ }
+}
+
+/*
* Emit appending makeoptions.
*/
static void
@@ -591,6 +619,17 @@
{
struct nvlist *nv;
struct condexpr *cond;
+ size_t i;
+
+ for (i = 0; i < nselfiles; i++) {
+ struct files *const fi = selfiles[i];
+
+ if (fi->fi_optx) {
+ fprintf(fp, "OPT.%s.c+=", fi->fi_base);
+ emitopts(fp, fi->fi_optx, 1);
+ fprintf(fp, "\n");
+ }
+ }
for (nv = appmkoptions; nv != NULL; nv = nv->nv_next)
fprintf(fp, "%s+=%s\n", nv->nv_name, nv->nv_str);
Home |
Main Index |
Thread Index |
Old Index