mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-30 23:48:09 +01:00
Make good on my promise to finally clean up the config clobbering.
If you invoke config with the `-n' flag or have NO_CONFIG_CLOBBER in your environment, config will behave the same way it used to. This is now _documented_ as well. Rip out all the CONFIG_DONT_CLOBBER cruft; some of it wasn't even correct anyway.
This commit is contained in:
parent
d9dc2f74ef
commit
b5909509ee
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=6631
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user