After thought, revert "Generate *.c files under conf/". Generate *.c files

under top build directory.  *.c files are never placed just under $S/.  Keep
this exclusiveness.
This commit is contained in:
uebayasi 2015-09-03 13:53:36 +00:00
parent 9d10d0209d
commit b5b4952dae
7 changed files with 26 additions and 62 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.88 2015/09/03 09:28:00 uebayasi Exp $ */
/* $NetBSD: defs.h,v 1.89 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@ -433,8 +433,6 @@ struct nvlist *machinesubarches;
const char *ioconfname; /* ioconf name, mutually exclusive to machine */
const char *srcdir; /* path to source directory (rel. to build) */
const char *builddir; /* path to build directory */
int builddirfd; /* dir fd of builddir */
int buildconfdirfd; /* dir fd of builddir/conf */
const char *defbuilddir; /* default build directory */
const char *ident; /* kernel "ident"ification string */
int errors; /* counts calls to error() */

View File

@ -1,4 +1,4 @@
/* $NetBSD: files.c,v 1.27 2015/09/02 05:09:25 uebayasi Exp $ */
/* $NetBSD: files.c,v 1.28 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: files.c,v 1.27 2015/09/02 05:09:25 uebayasi Exp $");
__RCSID("$NetBSD: files.c,v 1.28 2015/09/03 13:53:36 uebayasi Exp $");
#include <sys/param.h>
#include <errno.h>
@ -278,15 +278,13 @@ fixfiles(void)
struct config *cf;
char swapname[100];
buildprefix_push("conf");
addfile("conf/devsw.c", NULL, 0, NULL);
addfile("conf/ioconf.c", NULL, 0, NULL);
addfile("devsw.c", NULL, 0, NULL);
addfile("ioconf.c", NULL, 0, NULL);
TAILQ_FOREACH(cf, &allcf, cf_next) {
(void)snprintf(swapname, sizeof(swapname), "conf/swap%s.c",
(void)snprintf(swapname, sizeof(swapname), "swap%s.c",
cf->cf_name);
addfile(intern(swapname), NULL, 0, NULL);
}
buildprefix_pop();
}
err = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.87 2015/09/03 06:08:38 uebayasi Exp $ */
/* $NetBSD: main.c,v 1.88 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: main.c,v 1.87 2015/09/03 06:08:38 uebayasi Exp $");
__RCSID("$NetBSD: main.c,v 1.88 2015/09/03 13:53:36 uebayasi Exp $");
#ifndef MAKE_BOOTSTRAP
#include <sys/cdefs.h>
@ -100,8 +100,6 @@ extern int yydebug;
#endif
int dflag;
static const char *buildconfdir = ".";
static struct dlhash *obsopttab;
static struct hashtab *mkopttab;
static struct nvlist **nextopt;
@ -530,9 +528,6 @@ main(int argc, char **argv)
(void)printf("Build directory is %s\n", builddir);
(void)printf("Don't forget to run \"make depend\"\n");
close(buildconfdirfd);
close(builddirfd);
return 0;
}
@ -702,7 +697,6 @@ mkallsubdirs(void)
mksubdirs(&allfiles);
mksubdirs(&allofiles);
buildconfdir = "conf";
return 0;
}
@ -720,9 +714,6 @@ mksymlinks(void)
p = buf;
if ((buildconfdirfd = open(buildconfdir, O_RDONLY)) == -1)
errx(EXIT_FAILURE, "cannot opens %s", buildconfdir);
snprintf(buf, sizeof(buf), "%s/arch/%s/include", srcdir, machine);
ret = recreate(p, "machine");
ret = recreate(p, machine);
@ -1498,8 +1489,6 @@ setupdirs(void)
errx(EXIT_FAILURE, "cannot create %s", builddir);
} else if (!S_ISDIR(st.st_mode))
errx(EXIT_FAILURE, "%s is not a directory", builddir);
if ((builddirfd = open(builddir, O_RDONLY)) == -1)
errx(EXIT_FAILURE, "cannot opens %s", builddir);
if (chdir(builddir) == -1)
err(EXIT_FAILURE, "cannot change to %s", builddir);
if (stat(srcdir, &st) == -1)

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkdevsw.c,v 1.13 2015/09/02 05:09:25 uebayasi Exp $ */
/* $NetBSD: mkdevsw.c,v 1.14 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -34,7 +34,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: mkdevsw.c,v 1.13 2015/09/02 05:09:25 uebayasi Exp $");
__RCSID("$NetBSD: mkdevsw.c,v 1.14 2015/09/03 13:53:36 uebayasi Exp $");
#include <stdio.h>
#include <string.h>
@ -53,10 +53,9 @@ mkdevsw(void)
{
FILE *fp;
fchdir(buildconfdirfd);
if ((fp = fopen("devsw.c.tmp", "w")) == NULL) {
warn("cannot create devsw.c");
goto err;
return (1);
}
emitheader(fp);
@ -68,21 +67,17 @@ mkdevsw(void)
if (ferror(fp)) {
warn("error writing devsw.c");
fclose(fp);
goto err;
return 1;
}
(void)fclose(fp);
if (moveifchanged("devsw.c.tmp", "devsw.c") != 0) {
warn("error renaming devsw.c");
goto err;
return (1);
}
fchdir(builddirfd);
return (0);
err:
fchdir(builddirfd);
return (1);
return (0);
}
static void

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkheaders.c,v 1.28 2015/09/02 05:09:25 uebayasi Exp $ */
/* $NetBSD: mkheaders.c,v 1.29 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: mkheaders.c,v 1.28 2015/09/02 05:09:25 uebayasi Exp $");
__RCSID("$NetBSD: mkheaders.c,v 1.29 2015/09/03 13:53:36 uebayasi Exp $");
#include <sys/param.h>
#include <ctype.h>
@ -392,7 +392,6 @@ emitioconfh(void)
struct devi *i;
tfname = "tmp_ioconf.h";
fchdir(buildconfdirfd);
if ((tfp = fopen(tfname, "w")) == NULL)
return (herr("open", tfname, NULL));
@ -416,11 +415,7 @@ emitioconfh(void)
if (fclose(tfp) == EOF)
return (herr("clos", tfname, NULL));
if (moveifchanged(tfname, "ioconf.h") != 0)
return (herr("mvif", tfname, NULL));
fchdir(builddirfd);
return 0;
return (moveifchanged(tfname, "ioconf.h"));
}
/*
@ -533,7 +528,6 @@ herr(const char *what, const char *fname, FILE *fp)
warn("error %sing %s", what, fname);
if (fp)
(void)fclose(fp);
fchdir(builddirfd);
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkioconf.c,v 1.31 2015/09/02 05:09:25 uebayasi Exp $ */
/* $NetBSD: mkioconf.c,v 1.32 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: mkioconf.c,v 1.31 2015/09/02 05:09:25 uebayasi Exp $");
__RCSID("$NetBSD: mkioconf.c,v 1.32 2015/09/03 13:53:36 uebayasi Exp $");
#include <sys/param.h>
#include <err.h>
@ -87,10 +87,9 @@ mkioconf(void)
FILE *fp;
qsort(packed, npacked, sizeof *packed, cforder);
fchdir(buildconfdirfd);
if ((fp = fopen("ioconf.c.tmp", "w")) == NULL) {
warn("cannot write ioconf.c");
goto err;
return (1);
}
fprintf(fp, "#include \"ioconf.h\"\n");
@ -117,20 +116,15 @@ mkioconf(void)
#if 0
(void)unlink("ioconf.c.tmp");
#endif
goto err;
return (1);
}
(void)fclose(fp);
if (moveifchanged("ioconf.c.tmp", "ioconf.c") != 0) {
warn("error renaming ioconf.c");
goto err;
return (1);
}
fchdir(builddirfd);
return (0);
err:
fchdir(builddirfd);
return (1);
}
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkswap.c,v 1.9 2015/09/02 05:09:25 uebayasi Exp $ */
/* $NetBSD: mkswap.c,v 1.10 2015/09/03 13:53:36 uebayasi Exp $ */
/*
* Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: mkswap.c,v 1.9 2015/09/02 05:09:25 uebayasi Exp $");
__RCSID("$NetBSD: mkswap.c,v 1.10 2015/09/03 13:53:36 uebayasi Exp $");
#include <sys/param.h>
#include <errno.h>
@ -97,10 +97,9 @@ mkoneswap(struct config *cf)
(void)snprintf(fname, sizeof(fname), "swap%s.c", cf->cf_name);
(void)snprintf(tname, sizeof(tname), "swap%s.c.tmp", cf->cf_name);
fchdir(buildconfdirfd);
if ((fp = fopen(tname, "w")) == NULL) {
warn("cannot open %s", fname);
goto err;
return (1);
}
autogen_comment(fp, fname);
@ -150,9 +149,8 @@ mkoneswap(struct config *cf)
}
if (moveifchanged(tname, fname) != 0) {
warn("error renaming %s", fname);
goto err;
return (1);
}
fchdir(builddirfd);
return (0);
wrerror:
@ -162,7 +160,5 @@ mkoneswap(struct config *cf)
#if 0
(void)unlink(fname);
#endif
err:
fchdir(builddirfd);
return (1);
}