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
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=33538
5 changed files with 33 additions and 26 deletions

View File

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

View File

@ -177,6 +177,7 @@ struct cputype {
struct opt {
char *op_name;
char *op_value;
int op_line; /* line number for error-reporting */
int op_ownfile; /* true = own file, false = makefile */
struct opt *op_next;
} *opt, *mkopt;
@ -229,4 +230,6 @@ u_int loadaddress;
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))

View File

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

View File

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

View File

@ -36,7 +36,7 @@
static char sccsid[] = "@(#)mkmakefile.c 8.1 (Berkeley) 6/6/93";
#endif
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 */
/*
@ -197,6 +197,8 @@ makefile()
fprintf(ofp, " -D%s=%s", op->op_name, op->op_value);
else
fprintf(ofp, " -D%s", op->op_name);
printf("%s:%d: unknown option \"%s\"\n",
PREFIX, op->op_line, op->op_name);
}
}
fprintf(ofp, "\n");
@ -260,12 +262,18 @@ makefile()
(void) fclose(ofp);
moveifchanged(path("Makefile.new"), path("Makefile"));
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) {
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");
}
/*