NetBSD Problem Report #50731
From www@NetBSD.org Sun Jan 31 03:05:07 2016
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.NetBSD.org [199.233.217.200])
(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
(Client CN "mail.netbsd.org", Issuer "Postmaster NetBSD.org" (verified OK))
by mollari.NetBSD.org (Postfix) with ESMTPS id F2ECD7ACB3
for <gnats-bugs@gnats.NetBSD.org>; Sun, 31 Jan 2016 03:05:06 +0000 (UTC)
Message-Id: <20160131030505.47DAB7ACBE@mollari.NetBSD.org>
Date: Sun, 31 Jan 2016 03:05:05 +0000 (UTC)
From: okuyama@flex.phys.tohoku.ac.jp
Reply-To: okuyama@flex.phys.tohoku.ac.jp
To: gnats-bugs@NetBSD.org
Subject: config(8) adds bogus directories to include path
X-Send-Pr-Version: www-1.0
>Number: 50731
>Category: toolchain
>Synopsis: config(8) adds bogus directories to include path
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: toolchain-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Jan 31 03:10:00 +0000 2016
>Last-Modified: Thu Feb 04 13:10:00 +0000 2016
>Originator: Rin Okuyama
>Release: 7.99.26
>Organization:
Department of Physics, Tohoku University
>Environment:
NetBSD XXX 7.99.26 NetBSD 7.99.26 (XXX) #0: Wed Jan 27 21:45:05 JST 2016 rin@XXX:XXX amd64
>Description:
config(8) adds bogus directories to include path. For example,
% cd sys/arch/amd64/compile/GENERIC && cat Makefile
...
##
## (8) config(8) generated machinery
##
EXTRA_INCLUDES+= -I$S/external/bsd/acpica/dist
EXTRA_INCLUDES+= -I$S/../common/lib/libx86emu
...
Both directories are not appropriate as include path.
config(8) registers to include path a directory given as argument for
"prefix" statement. This behavior was introduced 16 years ago,
http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/config/Attic/mkmakefile.c#rev1.41
although it is not explicitly described in config(5). It was reasonable
at that time, I guess, but rather inconvenient today. "prefix" statement
appears in only two files: sys/external/bsd/acpica/conf/files.acpica and
sys/lib/x86emu/files.x86emu. Both of them are used in order to strip off
lengthy paths from "file" statements, and not intended to indicate extra
include path. If one wants to add some directory to include path,
conditional "makeoptions" statement should be used as follows:
% cat sys/external/bsd/acpica/conf/files.acpica
...
makeoptions acpi CPPFLAGS+="-I$S/external/bsd/acpica/dist/include"
...
%
I think the current behavior of "prefix" statement is too much; it merely
leads to undesired side effects.
>How-To-Repeat:
n/a
>Fix:
--- src/usr.bin/config/defs.h.orig 2016-01-31 10:09:25.437391353 +0900
+++ src/usr.bin/config/defs.h 2016-01-31 10:09:46.352005127 +0900
@@ -491,10 +491,8 @@
struct filelist allsfiles; /* list of all .S files */
struct filelist allofiles; /* list of all .o files */
-struct prefixlist prefixes, /* prefix stack */
- allprefixes; /* all prefixes used (after popped) */
-struct prefixlist buildprefixes, /* build prefix stack */
- allbuildprefixes;/* all build prefixes used (after popped) */
+struct prefixlist prefixes; /* prefix stack */
+struct prefixlist buildprefixes; /* build prefix stack */
SLIST_HEAD(, prefix) curdirs; /* curdir stack */
extern struct attr allattr;
--- src/usr.bin/config/mkmakefile.c.orig 2016-01-31 10:09:25.438038145 +0900
+++ src/usr.bin/config/mkmakefile.c 2016-01-31 10:09:46.352353243 +0900
@@ -75,7 +75,6 @@
static void emitsfiles(FILE *);
static void emitrules(FILE *);
static void emitload(FILE *);
-static void emitincludes(FILE *);
static void emitappmkoptions(FILE *);
static void emitsubs(FILE *, const char *, const char *, int);
static int selectopt(const char *, void *);
@@ -154,8 +153,6 @@
fn = emitrules;
else if (strcmp(line, "%LOAD\n") == 0)
fn = emitload;
- else if (strcmp(line, "%INCLUDES\n") == 0)
- fn = emitincludes;
else if (strcmp(line, "%MAKEOPTIONSAPPEND\n") == 0)
fn = emitappmkoptions;
else if (strncmp(line, "%VERSION ", sizeof("%VERSION ")-1) == 0) {
@@ -553,22 +550,6 @@
}
/*
- * Emit include headers (for any prefixes encountered)
- */
-static void
-emitincludes(FILE *fp)
-{
- struct prefix *pf;
-
- SLIST_FOREACH(pf, &allprefixes, pf_next) {
- const char *prologue = (*pf->pf_prefix == '/') ? "" : "$S/";
-
- fprintf(fp, "EXTRA_INCLUDES+=\t-I%s%s\n",
- prologue, pf->pf_prefix);
- }
-}
-
-/*
* Emit appending makeoptions.
*/
static void
--- src/usr.bin/config/util.c.orig 2016-01-31 10:09:25.438496877 +0900
+++ src/usr.bin/config/util.c 2016-01-31 10:09:46.352642491 +0900
@@ -95,7 +95,7 @@
}
static void
-prefixlist_pop(struct prefixlist *allpl, struct prefixlist *pl)
+prefixlist_pop(struct prefixlist *pl)
{
struct prefix *pf;
@@ -105,8 +105,6 @@
}
SLIST_REMOVE_HEAD(pl, pf_next);
- /* Remember this prefix for emitting -I... directives later. */
- SLIST_INSERT_HEAD(allpl, pf, pf_next);
}
/*
@@ -124,7 +122,7 @@
void
prefix_pop(void)
{
- prefixlist_pop(&allprefixes, &prefixes);
+ prefixlist_pop(&prefixes);
}
/*
@@ -142,7 +140,7 @@
void
buildprefix_pop(void)
{
- prefixlist_pop(&allbuildprefixes, &buildprefixes);
+ prefixlist_pop(&buildprefixes);
}
/*
--- src/sys/arch/aarch64/conf/Makefile.aarch64.orig 2016-01-31 10:09:22.942616502 +0900
+++ src/sys/arch/aarch64/conf/Makefile.aarch64 2016-01-31 10:11:22.179646102 +0900
@@ -91,8 +91,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/acorn26/conf/Makefile.acorn26.orig 2016-01-31 10:09:22.949600485 +0900
+++ src/sys/arch/acorn26/conf/Makefile.acorn26 2016-01-31 10:11:22.179826480 +0900
@@ -91,8 +91,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/acorn32/conf/Makefile.acorn32.orig 2016-01-31 10:09:22.960680512 +0900
+++ src/sys/arch/acorn32/conf/Makefile.acorn32 2016-01-31 10:11:22.180004275 +0900
@@ -97,8 +97,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/alpha/conf/Makefile.alpha.orig 2016-01-31 10:09:22.987454073 +0900
+++ src/sys/arch/alpha/conf/Makefile.alpha 2016-01-31 10:11:22.180191566 +0900
@@ -87,8 +87,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/amd64/conf/Makefile.amd64.orig 2016-01-31 10:09:23.013572532 +0900
+++ src/sys/arch/amd64/conf/Makefile.amd64 2016-01-31 10:11:22.180372363 +0900
@@ -83,8 +83,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/amiga/conf/Makefile.amiga.orig 2016-01-31 10:09:23.023904789 +0900
+++ src/sys/arch/amiga/conf/Makefile.amiga 2016-01-31 10:11:22.180550507 +0900
@@ -87,8 +87,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/arm/conf/Makefile.arm.orig 2016-01-31 10:09:23.094274851 +0900
+++ src/sys/arch/arm/conf/Makefile.arm 2016-01-31 10:11:22.180746318 +0900
@@ -112,8 +112,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/atari/conf/Makefile.atari.orig 2016-01-31 10:09:23.155122507 +0900
+++ src/sys/arch/atari/conf/Makefile.atari 2016-01-31 10:11:22.180927954 +0900
@@ -78,8 +78,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/cesfic/conf/Makefile.cesfic.orig 2016-01-31 10:09:23.198042607 +0900
+++ src/sys/arch/cesfic/conf/Makefile.cesfic 2016-01-31 10:11:22.181105678 +0900
@@ -73,8 +73,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/hp300/conf/Makefile.hp300.orig 2016-01-31 10:09:23.354842677 +0900
+++ src/sys/arch/hp300/conf/Makefile.hp300 2016-01-31 10:11:22.181282146 +0900
@@ -74,8 +74,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/hpcarm/conf/Makefile.hpcarm.orig 2016-01-31 10:09:23.389741568 +0900
+++ src/sys/arch/hpcarm/conf/Makefile.hpcarm 2016-01-31 10:11:22.181465038 +0900
@@ -78,8 +78,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/hppa/conf/Makefile.hppa.orig 2016-01-31 10:09:23.434310352 +0900
+++ src/sys/arch/hppa/conf/Makefile.hppa 2016-01-31 10:11:22.181641575 +0900
@@ -90,8 +90,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/i386/conf/Makefile.i386.orig 2016-01-31 10:09:23.454519347 +0900
+++ src/sys/arch/i386/conf/Makefile.i386 2016-01-31 10:11:22.181824817 +0900
@@ -102,8 +102,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/ia64/conf/Makefile.ia64.orig 2016-01-31 10:09:23.494499065 +0900
+++ src/sys/arch/ia64/conf/Makefile.ia64 2016-01-31 10:11:22.181996536 +0900
@@ -66,8 +66,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/luna68k/conf/Makefile.luna68k.orig 2016-01-31 10:09:23.529327355 +0900
+++ src/sys/arch/luna68k/conf/Makefile.luna68k 2016-01-31 10:11:22.182178171 +0900
@@ -80,8 +80,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/mac68k/conf/Makefile.mac68k.orig 2016-01-31 10:09:23.559958133 +0900
+++ src/sys/arch/mac68k/conf/Makefile.mac68k 2016-01-31 10:11:22.182355197 +0900
@@ -76,8 +76,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/mips/conf/Makefile.mips.orig 2016-01-31 10:09:23.599012986 +0900
+++ src/sys/arch/mips/conf/Makefile.mips 2016-01-31 10:11:22.182541022 +0900
@@ -129,8 +129,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/mvme68k/conf/Makefile.mvme68k.orig 2016-01-31 10:09:23.637986413 +0900
+++ src/sys/arch/mvme68k/conf/Makefile.mvme68k 2016-01-31 10:11:22.182713579 +0900
@@ -92,8 +92,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/sh3/conf/Makefile.sh3.orig 2016-01-31 10:09:23.662905772 +0900
+++ src/sys/arch/sh3/conf/Makefile.sh3 2016-01-31 10:11:22.183620428 +0900
@@ -79,8 +79,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/news68k/conf/Makefile.news68k.orig 2016-01-31 10:09:23.672194029 +0900
+++ src/sys/arch/news68k/conf/Makefile.news68k 2016-01-31 10:11:22.182885996 +0900
@@ -76,8 +76,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/next68k/conf/Makefile.next68k.orig 2016-01-31 10:09:23.691297500 +0900
+++ src/sys/arch/next68k/conf/Makefile.next68k 2016-01-31 10:11:22.183061277 +0900
@@ -76,8 +76,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/powerpc/conf/Makefile.powerpc.orig 2016-01-31 10:09:23.735554061 +0900
+++ src/sys/arch/powerpc/conf/Makefile.powerpc 2016-01-31 10:11:22.183265747 +0900
@@ -151,8 +151,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/riscv/conf/Makefile.riscv.orig 2016-01-31 10:09:23.769030317 +0900
+++ src/sys/arch/riscv/conf/Makefile.riscv 2016-01-31 10:11:22.183446265 +0900
@@ -119,8 +119,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/sparc/conf/Makefile.sparc.orig 2016-01-31 10:09:23.825774596 +0900
+++ src/sys/arch/sparc/conf/Makefile.sparc 2016-01-31 10:11:22.183789144 +0900
@@ -74,8 +74,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/sparc64/conf/Makefile.sparc64.orig 2016-01-31 10:09:23.846177726 +0900
+++ src/sys/arch/sparc64/conf/Makefile.sparc64 2016-01-31 10:11:22.183982093 +0900
@@ -142,8 +142,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/sun2/conf/Makefile.sun2.orig 2016-01-31 10:09:23.861888997 +0900
+++ src/sys/arch/sun2/conf/Makefile.sun2 2016-01-31 10:11:22.184155767 +0900
@@ -85,8 +85,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/sun3/conf/Makefile.sun3.orig 2016-01-31 10:09:23.869351893 +0900
+++ src/sys/arch/sun3/conf/Makefile.sun3 2016-01-31 10:11:22.184330698 +0900
@@ -87,8 +87,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/usermode/conf/Makefile.usermode.orig 2016-01-31 10:09:23.888286648 +0900
+++ src/sys/arch/usermode/conf/Makefile.usermode 2016-01-31 10:11:22.184508632 +0900
@@ -110,8 +110,6 @@
##
## (8) config(8) generated machinery
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/vax/conf/Makefile.vax.orig 2016-01-31 10:09:23.898753962 +0900
+++ src/sys/arch/vax/conf/Makefile.vax 2016-01-31 10:11:22.184680840 +0900
@@ -78,8 +78,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/x68k/conf/Makefile.x68k.orig 2016-01-31 10:09:23.926509302 +0900
+++ src/sys/arch/x68k/conf/Makefile.x68k 2016-01-31 10:11:22.184848788 +0900
@@ -91,8 +91,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
--- src/sys/arch/xen/conf/Makefile.xen.orig 2016-01-31 10:09:23.948380807 +0900
+++ src/sys/arch/xen/conf/Makefile.xen 2016-01-31 10:11:22.185026583 +0900
@@ -132,8 +132,6 @@
##
## (8) config(8) generated machinery
##
-%INCLUDES
-
%OBJS
%CFILES
>Audit-Trail:
From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: toolchain/50731: config(8) adds bogus directories to include path
Date: Sun, 31 Jan 2016 17:42:43 +0000
On Sun, Jan 31, 2016 at 03:10:00AM +0000, okuyama@flex.phys.tohoku.ac.jp wrote:
> config(8) adds bogus directories to include path. For example,
> [snip]
I agree with all your reasoning, but I have an objection to the patch:
I don't think it's a good idea to remove the %INCLUDES logic. We'll
inevitably want it back sometime.
--
David A. Holland
dholland@netbsd.org
From: Rin Okuyama <okuyama@flex.phys.tohoku.ac.jp>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: toolchain/50731: config(8) adds bogus directories to include path
Date: Mon, 1 Feb 2016 21:00:12 +0900
On 2016/02/01 2:45, David Holland wrote:
> I agree with all your reasoning, but I have an objection to the patch:
> I don't think it's a good idea to remove the %INCLUDES logic. We'll
> inevitably want it back sometime.
Thank you for your comment. Then, we will have two options:
(1) Leave the current implementation almost untouched; keep the variable
"allprefixes" and logic related to it. In the final step, do not emit
include path, like this:
if (strcmp(line, "%OBJS\n") == 0)
fn = Mflag ? emitkobjs : emitofiles;
else if ....
....
else if (strcmp(line, "%INCLUDES\n") == 0)
- fn = emitincludes;
+ fn = NULL; /* reserved */
else if ....
....
- (*fn)(ofp);
+ if (fn != NULL)
+ (*fn)(ofp);
(2) Leave the previous patch almost untouched; remove "allprefixes" and
related logic. Only keep "%INCLUDES" as a reserved word.
Which one sounds better to you? Or, any other idea?
From: Masao Uebayashi <uebayasi@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: toolchain/50731: config(8) adds bogus directories to include path
Date: Tue, 2 Feb 2016 19:48:07 +0900
On Sun, Jan 31, 2016 at 12:10 PM, <okuyama@flex.phys.tohoku.ac.jp> wrote:
>>Description:
> config(8) adds bogus directories to include path. For example,
>
> % cd sys/arch/amd64/compile/GENERIC && cat Makefile
> ...
> ##
> ## (8) config(8) generated machinery
> ##
> EXTRA_INCLUDES+= -I$S/external/bsd/acpica/dist
> EXTRA_INCLUDES+= -I$S/../common/lib/libx86emu
>
> ...
>
> Both directories are not appropriate as include path.
>
> config(8) registers to include path a directory given as argument for
> "prefix" statement. This behavior was introduced 16 years ago,
>
> http://cvsweb.netbsd.org/bsdweb.cgi/src/usr.sbin/config/Attic/mkmakefile.c#rev1.41
>
> although it is not explicitly described in config(5). It was reasonable
> at that time, I guess, but rather inconvenient today. "prefix" statement
> appears in only two files: sys/external/bsd/acpica/conf/files.acpica and
> sys/lib/x86emu/files.x86emu.
This is partially because NetBSD has no good API for external kernel modules.
> Both of them are used in order to strip off
> lengthy paths from "file" statements, and not intended to indicate extra
> include path. If one wants to add some directory to include path,
> conditional "makeoptions" statement should be used as follows:
>
> % cat sys/external/bsd/acpica/conf/files.acpica
> ...
> makeoptions acpi CPPFLAGS+="-I$S/external/bsd/acpica/dist/include"
> ...
> %
>
> I think the current behavior of "prefix" statement is too much; it merely
> leads to undesired side effects.
I don't like "makeoptions" in general, because it can do anything.
Anything using "makeoptions" is a hack, IMO.
It would be nice if such a thing can be done in config(5); for
example, per-module "compile-with", instead of per-file.
>>How-To-Repeat:
> n/a
>>Fix:
> --- src/usr.bin/config/defs.h.orig 2016-01-31 10:09:25.437391353 +0900
> +++ src/usr.bin/config/defs.h 2016-01-31 10:09:46.352005127 +0900
> @@ -491,10 +491,8 @@
> struct filelist allsfiles; /* list of all .S files */
> struct filelist allofiles; /* list of all .o files */
>
> -struct prefixlist prefixes, /* prefix stack */
> - allprefixes; /* all prefixes used (after popped) */
> -struct prefixlist buildprefixes, /* build prefix stack */
> - allbuildprefixes;/* all build prefixes used (after popped) */
> +struct prefixlist prefixes; /* prefix stack */
> +struct prefixlist buildprefixes; /* build prefix stack */
> SLIST_HEAD(, prefix) curdirs; /* curdir stack */
>
> extern struct attr allattr;
> --- src/usr.bin/config/mkmakefile.c.orig 2016-01-31 10:09:25.438038145 +0900
> +++ src/usr.bin/config/mkmakefile.c 2016-01-31 10:09:46.352353243 +0900
> @@ -75,7 +75,6 @@
> static void emitsfiles(FILE *);
> static void emitrules(FILE *);
> static void emitload(FILE *);
> -static void emitincludes(FILE *);
> static void emitappmkoptions(FILE *);
> static void emitsubs(FILE *, const char *, const char *, int);
> static int selectopt(const char *, void *);
> @@ -154,8 +153,6 @@
> fn = emitrules;
> else if (strcmp(line, "%LOAD\n") == 0)
> fn = emitload;
> - else if (strcmp(line, "%INCLUDES\n") == 0)
> - fn = emitincludes;
> else if (strcmp(line, "%MAKEOPTIONSAPPEND\n") == 0)
> fn = emitappmkoptions;
> else if (strncmp(line, "%VERSION ", sizeof("%VERSION ")-1) == 0) {
> @@ -553,22 +550,6 @@
> }
>
> /*
> - * Emit include headers (for any prefixes encountered)
> - */
> -static void
> -emitincludes(FILE *fp)
> -{
> - struct prefix *pf;
> -
> - SLIST_FOREACH(pf, &allprefixes, pf_next) {
> - const char *prologue = (*pf->pf_prefix == '/') ? "" : "$S/";
> -
> - fprintf(fp, "EXTRA_INCLUDES+=\t-I%s%s\n",
> - prologue, pf->pf_prefix);
> - }
> -}
> -
> -/*
> * Emit appending makeoptions.
> */
> static void
> --- src/usr.bin/config/util.c.orig 2016-01-31 10:09:25.438496877 +0900
> +++ src/usr.bin/config/util.c 2016-01-31 10:09:46.352642491 +0900
> @@ -95,7 +95,7 @@
> }
>
> static void
> -prefixlist_pop(struct prefixlist *allpl, struct prefixlist *pl)
> +prefixlist_pop(struct prefixlist *pl)
> {
> struct prefix *pf;
>
> @@ -105,8 +105,6 @@
> }
>
> SLIST_REMOVE_HEAD(pl, pf_next);
> - /* Remember this prefix for emitting -I... directives later. */
> - SLIST_INSERT_HEAD(allpl, pf, pf_next);
> }
>
> /*
> @@ -124,7 +122,7 @@
> void
> prefix_pop(void)
> {
> - prefixlist_pop(&allprefixes, &prefixes);
> + prefixlist_pop(&prefixes);
> }
>
> /*
> @@ -142,7 +140,7 @@
> void
> buildprefix_pop(void)
> {
> - prefixlist_pop(&allbuildprefixes, &buildprefixes);
> + prefixlist_pop(&buildprefixes);
> }
>
> /*
> --- src/sys/arch/aarch64/conf/Makefile.aarch64.orig 2016-01-31 10:09:22.942616502 +0900
> +++ src/sys/arch/aarch64/conf/Makefile.aarch64 2016-01-31 10:11:22.179646102 +0900
> @@ -91,8 +91,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/acorn26/conf/Makefile.acorn26.orig 2016-01-31 10:09:22.949600485 +0900
> +++ src/sys/arch/acorn26/conf/Makefile.acorn26 2016-01-31 10:11:22.179826480 +0900
> @@ -91,8 +91,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/acorn32/conf/Makefile.acorn32.orig 2016-01-31 10:09:22.960680512 +0900
> +++ src/sys/arch/acorn32/conf/Makefile.acorn32 2016-01-31 10:11:22.180004275 +0900
> @@ -97,8 +97,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/alpha/conf/Makefile.alpha.orig 2016-01-31 10:09:22.987454073 +0900
> +++ src/sys/arch/alpha/conf/Makefile.alpha 2016-01-31 10:11:22.180191566 +0900
> @@ -87,8 +87,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/amd64/conf/Makefile.amd64.orig 2016-01-31 10:09:23.013572532 +0900
> +++ src/sys/arch/amd64/conf/Makefile.amd64 2016-01-31 10:11:22.180372363 +0900
> @@ -83,8 +83,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/amiga/conf/Makefile.amiga.orig 2016-01-31 10:09:23.023904789 +0900
> +++ src/sys/arch/amiga/conf/Makefile.amiga 2016-01-31 10:11:22.180550507 +0900
> @@ -87,8 +87,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/arm/conf/Makefile.arm.orig 2016-01-31 10:09:23.094274851 +0900
> +++ src/sys/arch/arm/conf/Makefile.arm 2016-01-31 10:11:22.180746318 +0900
> @@ -112,8 +112,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/atari/conf/Makefile.atari.orig 2016-01-31 10:09:23.155122507 +0900
> +++ src/sys/arch/atari/conf/Makefile.atari 2016-01-31 10:11:22.180927954 +0900
> @@ -78,8 +78,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/cesfic/conf/Makefile.cesfic.orig 2016-01-31 10:09:23.198042607 +0900
> +++ src/sys/arch/cesfic/conf/Makefile.cesfic 2016-01-31 10:11:22.181105678 +0900
> @@ -73,8 +73,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/hp300/conf/Makefile.hp300.orig 2016-01-31 10:09:23.354842677 +0900
> +++ src/sys/arch/hp300/conf/Makefile.hp300 2016-01-31 10:11:22.181282146 +0900
> @@ -74,8 +74,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/hpcarm/conf/Makefile.hpcarm.orig 2016-01-31 10:09:23.389741568 +0900
> +++ src/sys/arch/hpcarm/conf/Makefile.hpcarm 2016-01-31 10:11:22.181465038 +0900
> @@ -78,8 +78,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/hppa/conf/Makefile.hppa.orig 2016-01-31 10:09:23.434310352 +0900
> +++ src/sys/arch/hppa/conf/Makefile.hppa 2016-01-31 10:11:22.181641575 +0900
> @@ -90,8 +90,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/i386/conf/Makefile.i386.orig 2016-01-31 10:09:23.454519347 +0900
> +++ src/sys/arch/i386/conf/Makefile.i386 2016-01-31 10:11:22.181824817 +0900
> @@ -102,8 +102,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/ia64/conf/Makefile.ia64.orig 2016-01-31 10:09:23.494499065 +0900
> +++ src/sys/arch/ia64/conf/Makefile.ia64 2016-01-31 10:11:22.181996536 +0900
> @@ -66,8 +66,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/luna68k/conf/Makefile.luna68k.orig 2016-01-31 10:09:23.529327355 +0900
> +++ src/sys/arch/luna68k/conf/Makefile.luna68k 2016-01-31 10:11:22.182178171 +0900
> @@ -80,8 +80,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/mac68k/conf/Makefile.mac68k.orig 2016-01-31 10:09:23.559958133 +0900
> +++ src/sys/arch/mac68k/conf/Makefile.mac68k 2016-01-31 10:11:22.182355197 +0900
> @@ -76,8 +76,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/mips/conf/Makefile.mips.orig 2016-01-31 10:09:23.599012986 +0900
> +++ src/sys/arch/mips/conf/Makefile.mips 2016-01-31 10:11:22.182541022 +0900
> @@ -129,8 +129,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/mvme68k/conf/Makefile.mvme68k.orig 2016-01-31 10:09:23.637986413 +0900
> +++ src/sys/arch/mvme68k/conf/Makefile.mvme68k 2016-01-31 10:11:22.182713579 +0900
> @@ -92,8 +92,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/sh3/conf/Makefile.sh3.orig 2016-01-31 10:09:23.662905772 +0900
> +++ src/sys/arch/sh3/conf/Makefile.sh3 2016-01-31 10:11:22.183620428 +0900
> @@ -79,8 +79,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/news68k/conf/Makefile.news68k.orig 2016-01-31 10:09:23.672194029 +0900
> +++ src/sys/arch/news68k/conf/Makefile.news68k 2016-01-31 10:11:22.182885996 +0900
> @@ -76,8 +76,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/next68k/conf/Makefile.next68k.orig 2016-01-31 10:09:23.691297500 +0900
> +++ src/sys/arch/next68k/conf/Makefile.next68k 2016-01-31 10:11:22.183061277 +0900
> @@ -76,8 +76,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/powerpc/conf/Makefile.powerpc.orig 2016-01-31 10:09:23.735554061 +0900
> +++ src/sys/arch/powerpc/conf/Makefile.powerpc 2016-01-31 10:11:22.183265747 +0900
> @@ -151,8 +151,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/riscv/conf/Makefile.riscv.orig 2016-01-31 10:09:23.769030317 +0900
> +++ src/sys/arch/riscv/conf/Makefile.riscv 2016-01-31 10:11:22.183446265 +0900
> @@ -119,8 +119,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/sparc/conf/Makefile.sparc.orig 2016-01-31 10:09:23.825774596 +0900
> +++ src/sys/arch/sparc/conf/Makefile.sparc 2016-01-31 10:11:22.183789144 +0900
> @@ -74,8 +74,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/sparc64/conf/Makefile.sparc64.orig 2016-01-31 10:09:23.846177726 +0900
> +++ src/sys/arch/sparc64/conf/Makefile.sparc64 2016-01-31 10:11:22.183982093 +0900
> @@ -142,8 +142,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/sun2/conf/Makefile.sun2.orig 2016-01-31 10:09:23.861888997 +0900
> +++ src/sys/arch/sun2/conf/Makefile.sun2 2016-01-31 10:11:22.184155767 +0900
> @@ -85,8 +85,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/sun3/conf/Makefile.sun3.orig 2016-01-31 10:09:23.869351893 +0900
> +++ src/sys/arch/sun3/conf/Makefile.sun3 2016-01-31 10:11:22.184330698 +0900
> @@ -87,8 +87,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/usermode/conf/Makefile.usermode.orig 2016-01-31 10:09:23.888286648 +0900
> +++ src/sys/arch/usermode/conf/Makefile.usermode 2016-01-31 10:11:22.184508632 +0900
> @@ -110,8 +110,6 @@
>
> ##
> ## (8) config(8) generated machinery
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/vax/conf/Makefile.vax.orig 2016-01-31 10:09:23.898753962 +0900
> +++ src/sys/arch/vax/conf/Makefile.vax 2016-01-31 10:11:22.184680840 +0900
> @@ -78,8 +78,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/x68k/conf/Makefile.x68k.orig 2016-01-31 10:09:23.926509302 +0900
> +++ src/sys/arch/x68k/conf/Makefile.x68k 2016-01-31 10:11:22.184848788 +0900
> @@ -91,8 +91,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
> --- src/sys/arch/xen/conf/Makefile.xen.orig 2016-01-31 10:09:23.948380807 +0900
> +++ src/sys/arch/xen/conf/Makefile.xen 2016-01-31 10:11:22.185026583 +0900
> @@ -132,8 +132,6 @@
> ##
> ## (8) config(8) generated machinery
> ##
> -%INCLUDES
> -
> %OBJS
>
> %CFILES
>
From: Rin Okuyama <okuyama@flex.phys.tohoku.ac.jp>
To: gnats-bugs@NetBSD.org
Cc:
Subject: Re: toolchain/50731: config(8) adds bogus directories to include path
Date: Tue, 2 Feb 2016 21:43:25 +0900
On 2016/02/02 19:50, Masao Uebayashi wrote:
> This is partially because NetBSD has no good API for external kernel modules.
>
> > Both of them are used in order to strip off
> > lengthy paths from "file" statements, and not intended to indicate extra
> > include path. If one wants to add some directory to include path,
> > conditional "makeoptions" statement should be used as follows:
> >
> > % cat sys/external/bsd/acpica/conf/files.acpica
> > ...
> > makeoptions acpi CPPFLAGS+="-I$S/external/bsd/acpica/dist/include"
> > ...
> > %
> >
> > I think the current behavior of "prefix" statement is too much; it merely
> > leads to undesired side effects.
>
> I don't like "makeoptions" in general, because it can do anything.
> Anything using "makeoptions" is a hack, IMO.
>
> It would be nice if such a thing can be done in config(5); for
> example, per-module "compile-with", instead of per-file.
Thank you for your comment. I agree with you about "makeoptions". I don't
intend to encourage abuse of "makeoptions".
I just mean that we should register a directory into include path, only
if it is actually required. The "prefix" statement unconditionally adds
its argument to EXTRA_INCLUDES. As a result, for example, the directory
of libx86emu is registered into include path even for vax!
The simplest solution would be (1) stop "prefix" emitting include path,
and (2) add a sentence like this:
emitinclude acpi external/bsd/acpica/dist/include
However, you prefer to more sophisticated framework or notation for
external kernel modules, don't you?
From: Masao Uebayashi <uebayasi@gmail.com>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: toolchain/50731: config(8) adds bogus directories to include path
Date: Thu, 4 Feb 2016 11:13:44 +0900
On Tue, Feb 2, 2016 at 9:45 PM, Rin Okuyama
<okuyama@flex.phys.tohoku.ac.jp> wrote:
(snip)
> > > % cat sys/external/bsd/acpica/conf/files.acpica
> > > ...
> > > makeoptions acpi CPPFLAGS+="-I$S/external/bsd/acpica/dist/include"
> > > ...
> > > %
(snip)
> Thank you for your comment. I agree with you about "makeoptions". I don't
> intend to encourage abuse of "makeoptions".
>
> I just mean that we should register a directory into include path, only
> if it is actually required. The "prefix" statement unconditionally adds
> its argument to EXTRA_INCLUDES. As a result, for example, the directory
> of libx86emu is registered into include path even for vax!
>
> The simplest solution would be (1) stop "prefix" emitting include path,
> and (2) add a sentence like this:
>
> emitinclude acpi external/bsd/acpica/dist/include
>
> However, you prefer to more sophisticated framework or notation for
> external kernel modules, don't you?
I was only talking about the long term direction. I come to think
that the conditional "makeoptions" is one step foward, and I'm OK with
that.
From: Rin Okuyama <okuyama@flex.phys.tohoku.ac.jp>
To: gnats-bugs@NetBSD.org, uebayasi@gmail.com
Cc:
Subject: Re: toolchain/50731: config(8) adds bogus directories to include path
Date: Thu, 4 Feb 2016 22:05:33 +0900
On 2016/02/04 11:15, Masao Uebayashi wrote:
> I was only talking about the long term direction. I come to think
> that the conditional "makeoptions" is one step foward, and I'm OK with
> that.
I understand. Here I attached revised patches for the two plans,
with which GENERIC kernel for amd64 is successfully built.
Plan-1: Leave the current implementation almost untouched; keep the
variable "allprefixes" and logic related to it. In the final step,
do not emit include path.
====
--- src/usr.bin/config/defs.h.orig 2016-02-04 21:35:58.527160744 +0900
+++ src/usr.bin/config/defs.h 2016-02-04 21:29:14.023277339 +0900
@@ -492,9 +492,11 @@
struct filelist allofiles; /* list of all .o files */
struct prefixlist prefixes, /* prefix stack */
- allprefixes; /* all prefixes used (after popped) */
+ allprefixes; /* all prefixes used (after popped,
+ not currently used) */
struct prefixlist buildprefixes, /* build prefix stack */
- allbuildprefixes;/* all build prefixes used (after popped) */
+ allbuildprefixes;/* all build prefixes used (after
+ popped, not currently used) */
SLIST_HEAD(, prefix) curdirs; /* curdir stack */
extern struct attr allattr;
--- src/usr.bin/config/mkmakefile.c.orig 2016-02-04 21:35:51.631754007 +0900
+++ src/usr.bin/config/mkmakefile.c 2016-02-04 21:32:55.517993638 +0900
@@ -558,6 +558,7 @@
static void
emitincludes(FILE *fp)
{
+#if 0
struct prefix *pf;
SLIST_FOREACH(pf, &allprefixes, pf_next) {
@@ -566,6 +567,9 @@
fprintf(fp, "EXTRA_INCLUDES+=\t-I%s%s\n",
prologue, pf->pf_prefix);
}
+#else
+ /* nothing; see toolchain/50731 */
+#endif
}
/*
====
Plan-2: Leave the previous patch almost untouched; remove "allprefixes"
and related logic. Only keep "%INCLUDES" as a reserved word.
====
--- src/usr.bin/config/defs.h.orig 2016-02-04 21:18:10.087159194 +0900
+++ src/usr.bin/config/defs.h 2016-02-04 21:21:28.212663989 +0900
@@ -491,10 +491,8 @@
struct filelist allsfiles; /* list of all .S files */
struct filelist allofiles; /* list of all .o files */
-struct prefixlist prefixes, /* prefix stack */
- allprefixes; /* all prefixes used (after popped) */
-struct prefixlist buildprefixes, /* build prefix stack */
- allbuildprefixes;/* all build prefixes used (after popped) */
+struct prefixlist prefixes; /* prefix stack */
+struct prefixlist buildprefixes; /* build prefix stack */
SLIST_HEAD(, prefix) curdirs; /* curdir stack */
extern struct attr allattr;
--- src/usr.bin/config/mkmakefile.c.orig 2016-02-04 21:18:10.087790344 +0900
+++ src/usr.bin/config/mkmakefile.c 2016-02-04 21:23:24.101189349 +0900
@@ -75,7 +75,6 @@
static void emitsfiles(FILE *);
static void emitrules(FILE *);
static void emitload(FILE *);
-static void emitincludes(FILE *);
static void emitappmkoptions(FILE *);
static void emitsubs(FILE *, const char *, const char *, int);
static int selectopt(const char *, void *);
@@ -155,7 +154,7 @@
else if (strcmp(line, "%LOAD\n") == 0)
fn = emitload;
else if (strcmp(line, "%INCLUDES\n") == 0)
- fn = emitincludes;
+ fn = NULL; /* reserved */
else if (strcmp(line, "%MAKEOPTIONSAPPEND\n") == 0)
fn = emitappmkoptions;
else if (strncmp(line, "%VERSION ", sizeof("%VERSION ")-1) == 0) {
@@ -174,7 +173,8 @@
emitsubs(ofp, line, ifname, lineno);
continue;
}
- (*fn)(ofp);
+ if (fn != NULL)
+ (*fn)(ofp);
}
fflush(ofp);
@@ -553,22 +553,6 @@
}
/*
- * Emit include headers (for any prefixes encountered)
- */
-static void
-emitincludes(FILE *fp)
-{
- struct prefix *pf;
-
- SLIST_FOREACH(pf, &allprefixes, pf_next) {
- const char *prologue = (*pf->pf_prefix == '/') ? "" : "$S/";
-
- fprintf(fp, "EXTRA_INCLUDES+=\t-I%s%s\n",
- prologue, pf->pf_prefix);
- }
-}
-
-/*
* Emit appending makeoptions.
*/
static void
--- src/usr.bin/config/util.c.orig 2016-02-04 21:18:10.088225263 +0900
+++ src/usr.bin/config/util.c 2016-02-04 21:21:28.213424120 +0900
@@ -95,7 +95,7 @@
}
static void
-prefixlist_pop(struct prefixlist *allpl, struct prefixlist *pl)
+prefixlist_pop(struct prefixlist *pl)
{
struct prefix *pf;
@@ -105,8 +105,6 @@
}
SLIST_REMOVE_HEAD(pl, pf_next);
- /* Remember this prefix for emitting -I... directives later. */
- SLIST_INSERT_HEAD(allpl, pf, pf_next);
}
/*
@@ -124,7 +122,7 @@
void
prefix_pop(void)
{
- prefixlist_pop(&allprefixes, &prefixes);
+ prefixlist_pop(&prefixes);
}
/*
@@ -142,7 +140,7 @@
void
buildprefix_pop(void)
{
- prefixlist_pop(&allbuildprefixes, &buildprefixes);
+ prefixlist_pop(&buildprefixes);
}
/*
====
(Contact us)
$NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.