Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/config Revert "Retire optional `rule' argument of `f...
details: https://anonhg.NetBSD.org/src/rev/f92a608a8235
branches: trunk
changeset: 340246:f92a608a8235
user: uebayasi <uebayasi%NetBSD.org@localhost>
date: Sat Aug 29 02:54:07 2015 +0000
description:
Revert "Retire optional `rule' argument of `file' command". It is still used
in m68k ports.
diffstat:
usr.bin/config/config.5 | 21 +++++++++++++++++++--
usr.bin/config/defs.h | 5 +++--
usr.bin/config/files.c | 21 ++++++++++++++++++---
usr.bin/config/gram.y | 13 ++++++++++---
usr.bin/config/mkmakefile.c | 10 +++++++---
5 files changed, 57 insertions(+), 13 deletions(-)
diffs (204 lines):
diff -r d07f703d6811 -r f92a608a8235 usr.bin/config/config.5
--- a/usr.bin/config/config.5 Fri Aug 28 17:41:49 2015 +0000
+++ b/usr.bin/config/config.5 Sat Aug 29 02:54:07 2015 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: config.5,v 1.27 2015/08/28 09:04:02 uebayasi Exp $
+.\" $NetBSD: config.5,v 1.28 2015/08/29 02:54:07 uebayasi Exp $
.\"
.\" Copyright (c) 2006, 2007 The NetBSD Foundation.
.\" All rights reserved.
@@ -471,7 +471,7 @@
.Ar dependencies
list.
.It Ic file Ar path Oo Ar condition Oc Oo Ic needs-count Oc \
- Oo Ic needs-flag Oc
+ Oo Ic needs-flag Oc Op Ic compile with Ar rule
Adds a source file to the list of files to be compiled into the kernel, if the
.Ar conditions
are met.
@@ -509,6 +509,23 @@
.Ic needs-count
case, or to 1 in all the other cases.
.Pp
+The
+.Ar rule
+argument specifies the
+.Xr make 1
+rule that will be used to compile the source file.
+If it is not given, the default rule for the type of the file will be used.
+For a given file, there can be more than one
+.Ic file
+statement, but not from the same configuration source file, and all later
+statements can only specify a
+.Ar rule
+argument, and no
+.Ar conditions
+or flags.
+This is useful when a file needs special consideration from one particular
+architecture.
+.Pp
The path is relative to the top of the kernel source tree, or the inner-most
defined
.Ic prefix .
diff -r d07f703d6811 -r f92a608a8235 usr.bin/config/defs.h
--- a/usr.bin/config/defs.h Fri Aug 28 17:41:49 2015 +0000
+++ b/usr.bin/config/defs.h Sat Aug 29 02:54:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.66 2015/08/28 09:04:02 uebayasi Exp $ */
+/* $NetBSD: defs.h,v 1.67 2015/08/29 02:54:07 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -365,6 +365,7 @@
const char *fi_base; /* tail minus ".c" (or whatever) */
struct condexpr *fi_optx; /* options expression */
struct nvlist *fi_optf; /* flattened version of above, if needed */
+ const char *fi_mkrule; /* special make rule, if any */
};
#define fi_srcfile fi_fit.fit_srcfile
#define fi_srcline fi_fit.fit_srcline
@@ -549,7 +550,7 @@
int fixfiles(void); /* finalize */
int fixobjects(void);
int fixdevsw(void);
-void addfile(const char *, struct condexpr *, u_char);
+void addfile(const char *, struct condexpr *, u_char, const char *);
void addobject(const char *, struct condexpr *, u_char);
int expr_eval(struct condexpr *, int (*)(const char *, void *), void *);
diff -r d07f703d6811 -r f92a608a8235 usr.bin/config/files.c
--- a/usr.bin/config/files.c Fri Aug 28 17:41:49 2015 +0000
+++ b/usr.bin/config/files.c Sat Aug 29 02:54:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: files.c,v 1.20 2015/08/28 09:04:02 uebayasi Exp $ */
+/* $NetBSD: files.c,v 1.21 2015/08/29 02:54:07 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: files.c,v 1.20 2015/08/28 09:04:02 uebayasi Exp $");
+__RCSID("$NetBSD: files.c,v 1.21 2015/08/29 02:54:07 uebayasi Exp $");
#include <sys/param.h>
#include <errno.h>
@@ -86,7 +86,7 @@
}
void
-addfile(const char *path, struct condexpr *optx, u_char flags)
+addfile(const char *path, struct condexpr *optx, u_char flags, const char *rule)
{
struct files *fi;
const char *dotp, *tail;
@@ -133,6 +133,20 @@
free(fi);
if ((fi = ht_lookup(pathtab, path)) == NULL)
panic("addfile: ht_lookup(%s)", path);
+
+ /*
+ * If it's a duplicate entry, it is must specify a make
+ * rule, and only a make rule, and must come from
+ * a different source file than the original entry.
+ * If it does otherwise, it is disallowed. This allows
+ * machine-dependent files to override the compilation
+ * options for specific files.
+ */
+ if (rule != NULL && optx == NULL && flags == 0 &&
+ yyfile != fi->fi_srcfile) {
+ fi->fi_mkrule = rule;
+ return;
+ }
cfgerror("duplicate file %s", path);
cfgxerror(fi->fi_srcfile, fi->fi_srcline,
"here is the original definition");
@@ -152,6 +166,7 @@
fi->fi_suffix = path[fi->fi_len - 1];
fi->fi_optx = optx;
fi->fi_optf = NULL;
+ fi->fi_mkrule = rule;
fi->fi_attr = NULL;
TAILQ_INSERT_TAIL(&allfiles, fi, fi_next);
return;
diff -r d07f703d6811 -r f92a608a8235 usr.bin/config/gram.y
--- a/usr.bin/config/gram.y Fri Aug 28 17:41:49 2015 +0000
+++ b/usr.bin/config/gram.y Sat Aug 29 02:54:07 2015 +0000
@@ -1,5 +1,5 @@
%{
-/* $NetBSD: gram.y,v 1.47 2015/08/28 09:04:02 uebayasi Exp $ */
+/* $NetBSD: gram.y,v 1.48 2015/08/29 02:54:07 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: gram.y,v 1.47 2015/08/28 09:04:02 uebayasi Exp $");
+__RCSID("$NetBSD: gram.y,v 1.48 2015/08/29 02:54:07 uebayasi Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -194,6 +194,7 @@
%type <condexpr> cond_base_expr
%type <str> fs_spec
%type <flag> fflags fflag oflags oflag
+%type <str> rule
%type <attr> depend
%type <devb> devbase
%type <deva> devattach_opt
@@ -337,7 +338,7 @@
/* source file: file foo/bar.c bar|baz needs-flag compile-with blah */
define_file:
- XFILE filename fopts fflags { addfile($2, $3, $4); }
+ XFILE filename fopts fflags rule { addfile($2, $3, $4, $5); }
;
/* object file: object zot.o foo|zot needs-flag */
@@ -458,6 +459,12 @@
| NEEDS_FLAG { $$ = FI_NEEDSFLAG; }
;
+/* extra compile directive for a source file */
+rule:
+ /* empty */ { $$ = NULL; }
+ | COMPILE_WITH stringvalue { $$ = $2; }
+;
+
/* zero or more flags for an object file */
oflags:
/* empty */ { $$ = 0; }
diff -r d07f703d6811 -r f92a608a8235 usr.bin/config/mkmakefile.c
--- a/usr.bin/config/mkmakefile.c Fri Aug 28 17:41:49 2015 +0000
+++ b/usr.bin/config/mkmakefile.c Sat Aug 29 02:54:07 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mkmakefile.c,v 1.41 2015/08/28 09:16:29 uebayasi Exp $ */
+/* $NetBSD: mkmakefile.c,v 1.42 2015/08/29 02:54:07 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
-__RCSID("$NetBSD: mkmakefile.c,v 1.41 2015/08/28 09:16:29 uebayasi Exp $");
+__RCSID("$NetBSD: mkmakefile.c,v 1.42 2015/08/29 02:54:07 uebayasi Exp $");
#include <sys/param.h>
#include <ctype.h>
@@ -505,7 +505,11 @@
}
fprintf(fp, "%s.o: %s%s%s%s\n", fi->fi_base, "$S/", prefix,
sep, fi->fi_path);
- fprintf(fp, "\t${NORMAL_%c}\n\n", toupper(fi->fi_suffix));
+ if (fi->fi_mkrule != NULL) {
+ fprintf(fp, "\t%s\n\n", fi->fi_mkrule);
+ } else {
+ fprintf(fp, "\t${NORMAL_%c}\n\n", toupper(fi->fi_suffix));
+ }
}
}
Home |
Main Index |
Thread Index |
Old Index