NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

toolchain/50731: config(8) adds bogus directories to include path



>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
>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



Home | Main Index | Thread Index | Old Index