Make '-n' the default, and introduce a new flag '-r' to get old

behaviour.  Also indicate which option(s) are unknown if there are any
old-style options.
This commit is contained in:
Eivind Eklund 1998-02-18 04:15:04 +00:00
parent 9ac2a83a11
commit b272cc1e22
5 changed files with 33 additions and 26 deletions

View File

@ -39,7 +39,7 @@
.Nd build system configuration files .Nd build system configuration files
.Sh SYNOPSIS .Sh SYNOPSIS
.Nm config .Nm config
.Op Fl gpn .Op Fl gpr
.Ar SYSTEM_NAME .Ar SYSTEM_NAME
.Sh DESCRIPTION .Sh DESCRIPTION
This is the old version of the This is the old version of the
@ -84,8 +84,8 @@ If two or more
options are supplied, options are supplied,
.Nm .Nm
will configure a system for high resolution profiling. will configure a system for high resolution profiling.
.It Fl n .It Fl r
Do not remove the old compile directory (see below). Remove the old compile directory (see below).
.It Ar SYSTEM_NAME .It Ar SYSTEM_NAME
Specifies the name of the system configuration file Specifies the name of the system configuration file
containing device specifications, configuration options containing device specifications, configuration options
@ -101,12 +101,9 @@ subdirectory of the system source (usually
will create the directory will create the directory
.Pa ../../compile/SYSTEM_NAME .Pa ../../compile/SYSTEM_NAME
as necessary and place all output files there. as necessary and place all output files there.
If the directory already exists, it will be removed If the directory already exists and the
first unless the .Fl r
.Fl n flag was specified, it will be removed first.
flag was specified or the environment variable
.Ev NO_CONFIG_CLOBBER
is set.
The output of The output of
.Nm .Nm
consists of a number of files; for the consists of a number of files; for the

View File

@ -177,6 +177,7 @@ struct cputype {
struct opt { struct opt {
char *op_name; char *op_name;
char *op_value; char *op_value;
int op_line; /* line number for error-reporting */
int op_ownfile; /* true = own file, false = makefile */ int op_ownfile; /* true = own file, false = makefile */
struct opt *op_next; struct opt *op_next;
} *opt, *mkopt; } *opt, *mkopt;
@ -229,4 +230,6 @@ u_int loadaddress;
extern int old_config_present; /* Old config/build directory still there */ extern int old_config_present; /* Old config/build directory still there */
extern char *PREFIX; /* Config file name - for error messages */
#define eq(a,b) (!strcmp(a,b)) #define eq(a,b) (!strcmp(a,b))

View File

@ -404,6 +404,7 @@ Option:
op->op_name = $1; op->op_name = $1;
op->op_next = opt; op->op_next = opt;
op->op_value = 0; op->op_value = 0;
op->op_line = yyline;
opt = op; opt = op;
if ((s = strchr(op->op_name, '='))) { if ((s = strchr(op->op_name, '='))) {
/* AARGH!!!! Old-style bogon */ /* AARGH!!!! Old-style bogon */
@ -418,6 +419,7 @@ Option:
op->op_name = $1; op->op_name = $1;
op->op_next = opt; op->op_next = opt;
op->op_value = $3; op->op_value = $3;
op->op_line = yyline;
opt = op; opt = op;
} ; } ;
@ -452,6 +454,7 @@ Mkoption:
op->op_ownfile = 0; /* for now */ op->op_ownfile = 0; /* for now */
op->op_next = mkopt; op->op_next = mkopt;
op->op_value = $3; op->op_value = $3;
op->op_line = yyline;
mkopt = op; mkopt = op;
} ; } ;

View File

@ -42,7 +42,7 @@ static const char copyright[] =
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif #endif
static const char rcsid[] = static const char rcsid[] =
"$Id: main.c,v 1.18 1997/09/15 06:37:08 charnier Exp $"; "$Id: main.c,v 1.19 1997/11/18 03:41:51 jdp Exp $";
#endif /* not lint */ #endif /* not lint */
#include <sys/types.h> #include <sys/types.h>
@ -65,8 +65,8 @@ static const char rcsid[] =
#define FALSE (0) #define FALSE (0)
#endif #endif
static char *PREFIX; char *PREFIX;
static int no_config_clobber = FALSE; static int no_config_clobber = TRUE;
int old_config_present; int old_config_present;
static void usage __P((void)); static void usage __P((void));
@ -86,7 +86,7 @@ main(argc, argv)
int ch; int ch;
char *p; char *p;
while ((ch = getopt(argc, argv, "gpn")) != -1) while ((ch = getopt(argc, argv, "gpr")) != -1)
switch (ch) { switch (ch) {
case 'g': case 'g':
debugging++; debugging++;
@ -94,8 +94,8 @@ main(argc, argv)
case 'p': case 'p':
profiling++; profiling++;
break; break;
case 'n': case 'r':
no_config_clobber = TRUE; no_config_clobber = FALSE;
break; break;
case '?': case '?':
default: default:
@ -109,8 +109,6 @@ main(argc, argv)
if (freopen(PREFIX = *argv, "r", stdin) == NULL) if (freopen(PREFIX = *argv, "r", stdin) == NULL)
err(2, "%s", PREFIX); err(2, "%s", PREFIX);
if (getenv("NO_CONFIG_CLOBBER"))
no_config_clobber = TRUE;
p = path((char *)NULL); p = path((char *)NULL);
if (stat(p, &buf)) { if (stat(p, &buf)) {
@ -120,7 +118,6 @@ main(argc, argv)
else if ((buf.st_mode & S_IFMT) != S_IFDIR) { else if ((buf.st_mode & S_IFMT) != S_IFDIR) {
errx(2, "%s isn't a directory", p); errx(2, "%s isn't a directory", p);
} }
#ifndef NO_CLOBBER_EVER
else if (!no_config_clobber) { else if (!no_config_clobber) {
char tmp[strlen(p) + 8]; char tmp[strlen(p) + 8];
@ -135,9 +132,8 @@ main(argc, argv)
if (mkdir(p, 0777)) if (mkdir(p, 0777))
err(2, "%s", p); err(2, "%s", p);
} }
#endif
else else
old_config_present++; old_config_present = 1;
loadaddress = -1; loadaddress = -1;
dtab = NULL; dtab = NULL;
@ -189,7 +185,7 @@ main(argc, argv)
{ {
char xxx[80]; char xxx[80];
(void) sprintf(xxx, "../../%s/include", machinename); (void) snprintf(xxx, sizeof(xxx), "../../%s/include", machinename);
(void) symlink(xxx, path("machine")); (void) symlink(xxx, path("machine"));
} }
options(); /* make options .h files */ options(); /* make options .h files */
@ -204,7 +200,7 @@ main(argc, argv)
static void static void
usage() usage()
{ {
fprintf(stderr, "usage: config [-gpn] sysname\n"); fprintf(stderr, "usage: config [-gpr] sysname\n");
exit(1); exit(1);
} }

View File

@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mkmakefile.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)mkmakefile.c 8.1 (Berkeley) 6/6/93";
#endif #endif
static const char rcsid[] = static const char rcsid[] =
"$Id: mkmakefile.c,v 1.24 1997/10/28 07:21:04 joerg Exp $"; "$Id: mkmakefile.c,v 1.25 1998/02/09 23:59:51 eivind Exp $";
#endif /* not lint */ #endif /* not lint */
/* /*
@ -197,6 +197,8 @@ makefile()
fprintf(ofp, " -D%s=%s", op->op_name, op->op_value); fprintf(ofp, " -D%s=%s", op->op_name, op->op_value);
else else
fprintf(ofp, " -D%s", op->op_name); fprintf(ofp, " -D%s", op->op_name);
printf("%s:%d: unknown option \"%s\"\n",
PREFIX, op->op_line, op->op_name);
} }
} }
fprintf(ofp, "\n"); fprintf(ofp, "\n");
@ -260,12 +262,18 @@ makefile()
(void) fclose(ofp); (void) fclose(ofp);
moveifchanged(path("Makefile.new"), path("Makefile")); moveifchanged(path("Makefile.new"), path("Makefile"));
if (warn_make_clean) { if (warn_make_clean) {
printf("WARNING: Unknown options used (not in ../../conf/options or ./options.%s).\n", machinename); printf("\nUnknown option%s used (not in ../../conf/options "
"or ./options.%s)", (warn_make_clean > 1 ? "s" : ""),
machinename);
if (old_config_present) { if (old_config_present) {
printf("It is VERY important that you do a ``make clean'' before recompiling!\n"); printf(" - it is\nVERY important that you do "
"``make clean && make depend'' before recompiling!\n\n");
} else {
printf(".\n\n");
} }
} else {
printf("Don't forget to do a ``make depend''.\n\n");
} }
printf("Don't forget to do a ``make depend''\n");
} }
/* /*