summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/config/Makefile3
-rw-r--r--usr.sbin/config/config.820
-rw-r--r--usr.sbin/config/main.c28
3 files changed, 34 insertions, 17 deletions
diff --git a/usr.sbin/config/Makefile b/usr.sbin/config/Makefile
index 5bab296..73df233 100644
--- a/usr.sbin/config/Makefile
+++ b/usr.sbin/config/Makefile
@@ -2,9 +2,6 @@
PROG= config
CFLAGS+=-I. -I${.CURDIR}
-.if defined(CONFIG_DONT_CLOBBER)
-CFLAGS+= -DCONFIG_DONT_CLOBBER
-.endif
SRCS= config.c main.c lang.c mkioconf.c mkmakefile.c mkglue.c mkheaders.c \
mkswapconf.c
MAN8= config.8
diff --git a/usr.sbin/config/config.8 b/usr.sbin/config/config.8
index 32acb0f..5f93a86 100644
--- a/usr.sbin/config/config.8
+++ b/usr.sbin/config/config.8
@@ -39,7 +39,7 @@
.Nd build system configuration files
.Sh SYNOPSIS
.Nm config
-.Op Fl gp
+.Op Fl gpn
.Ar SYSTEM_NAME
.Sh DESCRIPTION
.Pp
@@ -70,7 +70,7 @@ that give alternate files for a specific machine.
.Sx FILES
section below)
.Pp
-Available option and operand:
+Available options and operands:
.Pp
.Bl -tag -width SYSTEM_NAME
.It Fl g
@@ -88,6 +88,12 @@ will configure a system for profiling; for example,
.Xr kgmon 8
and
.Xr gprof 1 .
+.It Fl n
+If the
+.Fl n
+flag is specified,
+.Nm config
+will not remove the old compile directory (see below).
.It Ar SYSTEM_NAME
specifies the name of the system configuration file
containing device specifications, configuration options
@@ -100,9 +106,15 @@ should be run from the
subdirectory of the system source (usually
.Pa /sys/ARCH/conf ) .
.Nm Config
-assumes the directory
+will create the directory
.Pa ../../compile/SYSTEM_NAME
-exists and places all output files there.
+as necessary and place all output files there.
+If the directory already exists, it will be removed
+first unless the
+.Pa -n
+flag was specified or the environment variable
+.Nm NO_CONFIG_CLOBBER
+is set.
The output of
.Nm config
consists of a number of files; for the
diff --git a/usr.sbin/config/main.c b/usr.sbin/config/main.c
index 804a3b8..e9029d0 100644
--- a/usr.sbin/config/main.c
+++ b/usr.sbin/config/main.c
@@ -49,7 +49,16 @@ static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#include "y.tab.h"
#include "config.h"
+#ifndef TRUE
+#define TRUE (1)
+#endif
+
+#ifndef FALSE
+#define FALSE (0)
+#endif
+
static char *PREFIX;
+static int no_config_clobber = FALSE;
/*
* Config builds a set of files for building a UNIX
@@ -66,7 +75,7 @@ main(argc, argv)
int ch;
char *p;
- while ((ch = getopt(argc, argv, "gp")) != EOF)
+ while ((ch = getopt(argc, argv, "gpn")) != EOF)
switch (ch) {
case 'g':
debugging++;
@@ -74,6 +83,9 @@ main(argc, argv)
case 'p':
profiling++;
break;
+ case 'n':
+ no_config_clobber = TRUE;
+ break;
case '?':
default:
goto usage;
@@ -82,7 +94,7 @@ main(argc, argv)
argv += optind;
if (argc != 1) {
-usage: fputs("usage: config [-gp] sysname\n", stderr);
+usage: fputs("usage: config [-gpn] sysname\n", stderr);
exit(1);
}
@@ -90,12 +102,11 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
perror(PREFIX);
exit(2);
}
-#ifdef CONFIG_DONT_CLOBBER
- if (stat(p = path((char *)NULL), &buf)) {
-#else /* CONFIG_DONT_CLOBBER */
+ if (getenv("NO_CONFIG_CLOBBER"))
+ no_config_clobber = TRUE;
+
p = path((char *)NULL);
if (stat(p, &buf)) {
-#endif /* CONFIG_DONT_CLOBBER */
if (mkdir(p, 0777)) {
perror(p);
exit(2);
@@ -104,9 +115,8 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
else if ((buf.st_mode & S_IFMT) != S_IFDIR) {
fprintf(stderr, "config: %s isn't a directory.\n", p);
exit(2);
-#ifndef CONFIG_DONT_CLOBBER
}
- else {
+ else if (!no_config_clobber) {
char tmp[strlen(p) + 8];
fprintf(stderr, "Removing old directory %s: ", p);
@@ -122,9 +132,7 @@ usage: fputs("usage: config [-gp] sysname\n", stderr);
perror(p);
exit(2);
}
-#endif /* CONFIG_DONT_CLOBBER */
}
-
loadaddress = -1;
dtab = NULL;
confp = &conf_list;
OpenPOWER on IntegriCloud