Global paths looked up at output stage (mk*()) are relative to `srcdir'.

Ignore "prefix" by not calling sourcepath().
This commit is contained in:
uebayasi 2015-08-28 03:55:15 +00:00
parent 0b9ddf3cc0
commit 50408f97eb
3 changed files with 23 additions and 32 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: main.c,v 1.76 2015/08/08 15:52:41 shm Exp $ */ /* $NetBSD: main.c,v 1.77 2015/08/28 03:55:15 uebayasi Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
#endif #endif
#include <sys/cdefs.h> #include <sys/cdefs.h>
__RCSID("$NetBSD: main.c,v 1.76 2015/08/08 15:52:41 shm Exp $"); __RCSID("$NetBSD: main.c,v 1.77 2015/08/28 03:55:15 uebayasi Exp $");
#ifndef MAKE_BOOTSTRAP #ifndef MAKE_BOOTSTRAP
#include <sys/cdefs.h> #include <sys/cdefs.h>
@ -616,30 +616,26 @@ mksymlinks(void)
const char *q; const char *q;
struct nvlist *nv; struct nvlist *nv;
snprintf(buf, sizeof(buf), "arch/%s/include", machine); p = buf;
p = sourcepath(buf);
snprintf(buf, sizeof(buf), "%s/arch/%s/include", srcdir, machine);
ret = recreate(p, "machine"); ret = recreate(p, "machine");
ret = recreate(p, machine); ret = recreate(p, machine);
free(p);
if (machinearch != NULL) { if (machinearch != NULL) {
snprintf(buf, sizeof(buf), "arch/%s/include", machinearch); snprintf(buf, sizeof(buf), "%s/arch/%s/include", srcdir, machinearch);
p = sourcepath(buf);
q = machinearch; q = machinearch;
} else { } else {
p = estrdup("machine"); snprintf(buf, sizeof(buf), "machine");
q = machine; q = machine;
} }
ret = recreate(p, q); ret = recreate(p, q);
free(p);
for (nv = machinesubarches; nv != NULL; nv = nv->nv_next) { for (nv = machinesubarches; nv != NULL; nv = nv->nv_next) {
q = nv->nv_name; q = nv->nv_name;
snprintf(buf, sizeof(buf), "arch/%s/include", q); snprintf(buf, sizeof(buf), "%s/arch/%s/include", srcdir, q);
p = sourcepath(buf);
ret = recreate(p, q); ret = recreate(p, q);
free(p);
} }
return (ret); return (ret);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkioconf.c,v 1.29 2015/08/20 09:44:24 christos Exp $ */ /* $NetBSD: mkioconf.c,v 1.30 2015/08/28 03:55:15 uebayasi Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
#endif #endif
#include <sys/cdefs.h> #include <sys/cdefs.h>
__RCSID("$NetBSD: mkioconf.c,v 1.29 2015/08/20 09:44:24 christos Exp $"); __RCSID("$NetBSD: mkioconf.c,v 1.30 2015/08/28 03:55:15 uebayasi Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <err.h> #include <err.h>
@ -147,9 +147,10 @@ emithdr(FILE *ofp)
autogen_comment(ofp, "ioconf.c"); autogen_comment(ofp, "ioconf.c");
(void)snprintf(ifnbuf, sizeof(ifnbuf), "arch/%s/conf/ioconf.incl.%s", (void)snprintf(ifnbuf, sizeof(ifnbuf), "%s/arch/%s/conf/ioconf.incl.%s",
srcdir,
machine ? machine : "(null)", machine ? machine : "(null)"); machine ? machine : "(null)", machine ? machine : "(null)");
ifn = sourcepath(ifnbuf); ifn = ifnbuf;
if ((ifp = fopen(ifn, "r")) != NULL) { if ((ifp = fopen(ifn, "r")) != NULL) {
while ((n = fread(buf, 1, sizeof(buf), ifp)) > 0) while ((n = fread(buf, 1, sizeof(buf), ifp)) > 0)
(void)fwrite(buf, 1, n, ofp); (void)fwrite(buf, 1, n, ofp);
@ -162,7 +163,6 @@ emithdr(FILE *ofp)
"#include <sys/device.h>\n" "#include <sys/device.h>\n"
"#include <sys/mount.h>\n", ofp); "#include <sys/mount.h>\n", ofp);
} }
free(ifn);
} }
/* /*

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkmakefile.c,v 1.37 2014/12/15 15:49:25 uebayasi Exp $ */ /* $NetBSD: mkmakefile.c,v 1.38 2015/08/28 03:55:15 uebayasi Exp $ */
/* /*
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -45,7 +45,7 @@
#endif #endif
#include <sys/cdefs.h> #include <sys/cdefs.h>
__RCSID("$NetBSD: mkmakefile.c,v 1.37 2014/12/15 15:49:25 uebayasi Exp $"); __RCSID("$NetBSD: mkmakefile.c,v 1.38 2015/08/28 03:55:15 uebayasi Exp $");
#include <sys/param.h> #include <sys/param.h>
#include <ctype.h> #include <ctype.h>
@ -94,8 +94,7 @@ mkmakefile(void)
FILE *ifp, *ofp; FILE *ifp, *ofp;
int lineno; int lineno;
void (*fn)(FILE *); void (*fn)(FILE *);
char *ifname; char line[BUFSIZ], ifname[200];
char line[BUFSIZ], buf[200];
/* /*
* Check if conf/Makefile.kern.inc defines "build_kernel". * Check if conf/Makefile.kern.inc defines "build_kernel".
@ -104,8 +103,8 @@ mkmakefile(void)
* unfortunately the "build_kernel" change done around 2014 Aug didn't * unfortunately the "build_kernel" change done around 2014 Aug didn't
* bump that version. Thus this hack.) * bump that version. Thus this hack.)
*/ */
(void)snprintf(buf, sizeof(buf), "conf/Makefile.kern.inc"); (void)snprintf(ifname, sizeof(ifname), "%s/conf/Makefile.kern.inc",
ifname = sourcepath(buf); srcdir);
if ((ifp = fopen(ifname, "r")) == NULL) { if ((ifp = fopen(ifname, "r")) == NULL) {
warn("cannot read %s", ifname); warn("cannot read %s", ifname);
goto bad2; goto bad2;
@ -121,17 +120,15 @@ mkmakefile(void)
/* /*
* Try a makefile for the port first. * Try a makefile for the port first.
*/ */
(void)snprintf(buf, sizeof(buf), "arch/%s/conf/Makefile.%s", (void)snprintf(ifname, sizeof(ifname), "%s/arch/%s/conf/Makefile.%s",
machine, machine); srcdir, machine, machine);
ifname = sourcepath(buf);
if ((ifp = fopen(ifname, "r")) == NULL) { if ((ifp = fopen(ifname, "r")) == NULL) {
/* /*
* Try a makefile for the architecture second. * Try a makefile for the architecture second.
*/ */
(void)snprintf(buf, sizeof(buf), "arch/%s/conf/Makefile.%s", (void)snprintf(ifname, sizeof(ifname),
machinearch, machinearch); "%s/arch/%s/conf/Makefile.%s",
free(ifname); srcdir, machinearch, machinearch);
ifname = sourcepath(buf);
ifp = fopen(ifname, "r"); ifp = fopen(ifname, "r");
} }
if (ifp == NULL) { if (ifp == NULL) {
@ -205,7 +202,6 @@ mkmakefile(void)
warn("error renaming Makefile"); warn("error renaming Makefile");
goto bad2; goto bad2;
} }
free(ifname);
return (0); return (0);
wrerror: wrerror:
@ -217,7 +213,6 @@ mkmakefile(void)
(void)fclose(ifp); (void)fclose(ifp);
/* (void)unlink("Makefile.tmp"); */ /* (void)unlink("Makefile.tmp"); */
bad2: bad2:
free(ifname);
return (1); return (1);
} }