diff --git a/sys/arch/alpha/conf/Makefile.alpha b/sys/arch/alpha/conf/Makefile.alpha index 9642110547db..a3c33c65687e 100644 --- a/sys/arch/alpha/conf/Makefile.alpha +++ b/sys/arch/alpha/conf/Makefile.alpha @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.alpha,v 1.51 1999/05/31 18:54:49 ross Exp $ +# $NetBSD: Makefile.alpha,v 1.52 1999/07/09 09:52:55 mrg Exp $ # Makefile for NetBSD # @@ -55,6 +55,8 @@ LOADADDRESS?= fffffc0000300000 LINKFLAGS= -N -Ttext ${LOADADDRESS} -e __transfer -G 4 STRIPFLAGS= -g -X +%INCLUDES + ### find out what to use for libkern .include "$S/lib/libkern/Makefile.inc" .ifndef PROF diff --git a/sys/arch/amiga/conf/Makefile.amiga b/sys/arch/amiga/conf/Makefile.amiga index 339e88544833..599d175ec8df 100644 --- a/sys/arch/amiga/conf/Makefile.amiga +++ b/sys/arch/amiga/conf/Makefile.amiga @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.amiga,v 1.80 1999/01/15 23:37:05 thorpej Exp $ +# $NetBSD: Makefile.amiga,v 1.81 1999/07/09 09:52:55 mrg Exp $ # Makefile for NetBSD # @@ -60,6 +60,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -n -Ttext 0 -e start STRIPFLAGS= -d +%INCLUDES + ### find out what to use for libkern KERN_AS= obj .include "$S/lib/libkern/Makefile.inc" diff --git a/sys/arch/arm32/conf/Makefile.arm32 b/sys/arch/arm32/conf/Makefile.arm32 index 39d79ad0ac58..996026b9c9dc 100644 --- a/sys/arch/arm32/conf/Makefile.arm32 +++ b/sys/arch/arm32/conf/Makefile.arm32 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.arm32,v 1.45 1999/01/29 22:20:49 tron Exp $ +# $NetBSD: Makefile.arm32,v 1.46 1999/07/09 09:52:56 mrg Exp $ # Makefile for NetBSD # @@ -54,6 +54,8 @@ AFLAGS= -x assembler-with-cpp -D_LOCORE LINKFLAGS= -Ttext F0000000 -e start STRIPFLAGS= -d +%INCLUDES + HOSTED_CC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} diff --git a/sys/arch/atari/conf/Makefile.atari b/sys/arch/atari/conf/Makefile.atari index c703fe47f794..6e0103ad6c89 100644 --- a/sys/arch/atari/conf/Makefile.atari +++ b/sys/arch/atari/conf/Makefile.atari @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.atari,v 1.52 1999/05/06 20:25:17 leo Exp $ +# $NetBSD: Makefile.atari,v 1.53 1999/07/09 09:52:56 mrg Exp $ # Makefile for NetBSD # @@ -60,6 +60,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -n -Ttext 0 -e start STRIPFLAGS= -d +%INCLUDES + HOSTED_CC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} diff --git a/sys/arch/bebox/conf/Makefile.bebox b/sys/arch/bebox/conf/Makefile.bebox index 990319beed38..2f061a75ec12 100644 --- a/sys/arch/bebox/conf/Makefile.bebox +++ b/sys/arch/bebox/conf/Makefile.bebox @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.bebox,v 1.12 1999/06/24 01:19:51 sakamoto Exp $ +# $NetBSD: Makefile.bebox,v 1.13 1999/07/09 09:52:56 mrg Exp $ # Makefile for NetBSD # @@ -57,6 +57,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -N -Ttext 0x3100 -e __start STRIPFLAGS= --strip-debug +%INCLUDES + ### find out what to use for libkern KERN_AS= obj .include "$S/lib/libkern/Makefile.inc" diff --git a/sys/arch/hp300/conf/Makefile.hp300 b/sys/arch/hp300/conf/Makefile.hp300 index 3c0c291cd612..cb6115fcd644 100644 --- a/sys/arch/hp300/conf/Makefile.hp300 +++ b/sys/arch/hp300/conf/Makefile.hp300 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.hp300,v 1.68 1999/01/15 23:37:06 thorpej Exp $ +# $NetBSD: Makefile.hp300,v 1.69 1999/07/09 09:52:57 mrg Exp $ # Makefile for NetBSD # @@ -55,6 +55,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -n -Ttext 0 -e start STRIPFLAGS= -d +%INCLUDES + HOSTED_CC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} diff --git a/sys/arch/i386/conf/Makefile.i386 b/sys/arch/i386/conf/Makefile.i386 index 978e8ac7e558..54fcbb528717 100644 --- a/sys/arch/i386/conf/Makefile.i386 +++ b/sys/arch/i386/conf/Makefile.i386 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.i386,v 1.97 1999/01/28 20:04:54 christos Exp $ +# $NetBSD: Makefile.i386,v 1.98 1999/07/09 09:52:57 mrg Exp $ # Makefile for NetBSD # @@ -62,6 +62,8 @@ LINKFLAGS+= -z .endif STRIPFLAGS= -d +%INCLUDES + ### find out what to use for libkern KERN_AS= obj .include "$S/lib/libkern/Makefile.inc" diff --git a/sys/arch/mac68k/conf/Makefile.mac68k b/sys/arch/mac68k/conf/Makefile.mac68k index 5ecf1b782ba7..f7a38b9cb5bd 100644 --- a/sys/arch/mac68k/conf/Makefile.mac68k +++ b/sys/arch/mac68k/conf/Makefile.mac68k @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.mac68k,v 1.68 1999/01/15 23:37:06 thorpej Exp $ +# $NetBSD: Makefile.mac68k,v 1.69 1999/07/09 09:52:57 mrg Exp $ # Makefile for NetBSD # @@ -55,6 +55,8 @@ AFLAGS= -traditional -D_LOCORE LINKFLAGS= -n -Ttext 0 -e start STRIPFLAGS= -d +%INCLUDES + ### Find out what to use for libkern. KERN_AS= obj .include "$S/lib/libkern/Makefile.inc" diff --git a/sys/arch/macppc/conf/Makefile.macppc b/sys/arch/macppc/conf/Makefile.macppc index 9cfcfe14f6ef..9cc106016ad8 100644 --- a/sys/arch/macppc/conf/Makefile.macppc +++ b/sys/arch/macppc/conf/Makefile.macppc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.macppc,v 1.6 1999/01/15 23:37:06 thorpej Exp $ +# $NetBSD: Makefile.macppc,v 1.7 1999/07/09 09:52:57 mrg Exp $ # # Makefile for NetBSD # @@ -56,6 +56,8 @@ AFLAGS= -D_LOCORE LINKFLAGS= -N -Ttext 100000 -e __start STRIPFLAGS= --strip-debug +%INCLUDES + ### find out what to use for libkern .include "$S/lib/libkern/Makefile.inc" .ifndef PROF diff --git a/sys/arch/mvme68k/conf/Makefile.mvme68k b/sys/arch/mvme68k/conf/Makefile.mvme68k index c23660511d5b..82a5f36001c5 100644 --- a/sys/arch/mvme68k/conf/Makefile.mvme68k +++ b/sys/arch/mvme68k/conf/Makefile.mvme68k @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.mvme68k,v 1.39 1999/01/15 23:37:06 thorpej Exp $ +# $NetBSD: Makefile.mvme68k,v 1.40 1999/07/09 09:52:58 mrg Exp $ # Makefile for NetBSD # @@ -56,6 +56,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -n -Ttext 8000 -e start STRIPFLAGS= -d +%INCLUDES + HOSTED_CC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} diff --git a/sys/arch/newsmips/conf/Makefile.newsmips b/sys/arch/newsmips/conf/Makefile.newsmips index c2c3b6239da6..e0cf5d04de4d 100644 --- a/sys/arch/newsmips/conf/Makefile.newsmips +++ b/sys/arch/newsmips/conf/Makefile.newsmips @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.newsmips,v 1.17 1999/07/08 11:53:35 tsubai Exp $ +# $NetBSD: Makefile.newsmips,v 1.18 1999/07/09 09:52:58 mrg Exp $ # Makefile for NetBSD # @@ -58,6 +58,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -N -Ttext 80001000 -e start ${GP} -T ../../conf/kern.ldscript STRIPFLAGS= -g -X -x +%INCLUDES + ### find out what to use for libkern .include "$S/lib/libkern/Makefile.inc" .ifndef PROF diff --git a/sys/arch/next68k/conf/Makefile.next68k b/sys/arch/next68k/conf/Makefile.next68k index bd0fdaede10f..1b3ea5ebf69a 100644 --- a/sys/arch/next68k/conf/Makefile.next68k +++ b/sys/arch/next68k/conf/Makefile.next68k @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.next68k,v 1.7 1999/01/15 23:21:26 thorpej Exp $ +# $NetBSD: Makefile.next68k,v 1.8 1999/07/09 09:52:59 mrg Exp $ # Makefile for NetBSD # @@ -67,6 +67,8 @@ STRIPFLAGS?= -d # -S is used in gnu strip, rather than -d: #STRIPFLAGS= -S +%INCLUDES + ### Find out what to use for libkern. KERN_AS= obj .include "$S/lib/libkern/Makefile.inc" diff --git a/sys/arch/ofppc/conf/Makefile.ofppc b/sys/arch/ofppc/conf/Makefile.ofppc index 32318ffa886f..d23f25e2c95b 100644 --- a/sys/arch/ofppc/conf/Makefile.ofppc +++ b/sys/arch/ofppc/conf/Makefile.ofppc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.ofppc,v 1.18 1999/01/15 23:37:07 thorpej Exp $ +# $NetBSD: Makefile.ofppc,v 1.19 1999/07/09 09:52:59 mrg Exp $ # # Makefile for NetBSD # @@ -57,6 +57,8 @@ AFLAGS= -D_LOCORE LINKFLAGS= -N -Ttext 100000 -e __start STRIPFLAGS= --strip-debug +%INCLUDES + ### find out what to use for libkern .include "$S/lib/libkern/Makefile.inc" .ifndef PROF diff --git a/sys/arch/pc532/conf/Makefile.pc532 b/sys/arch/pc532/conf/Makefile.pc532 index 05b98f6fd163..9cf8f164d42b 100644 --- a/sys/arch/pc532/conf/Makefile.pc532 +++ b/sys/arch/pc532/conf/Makefile.pc532 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.pc532,v 1.54 1999/03/14 05:03:35 jonb Exp $ +# $NetBSD: Makefile.pc532,v 1.55 1999/07/09 09:52:59 mrg Exp $ # Makefile for NetBSD # @@ -55,6 +55,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -z -Ttext F8002000 -e start STRIPFLAGS= -d +%INCLUDES + HOSTED_CC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} diff --git a/sys/arch/pica/conf/Makefile.pica b/sys/arch/pica/conf/Makefile.pica index 1b67a97d5ebd..786d227481a0 100644 --- a/sys/arch/pica/conf/Makefile.pica +++ b/sys/arch/pica/conf/Makefile.pica @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.pica,v 1.25 1999/01/15 23:37:07 thorpej Exp $ +# $NetBSD: Makefile.pica,v 1.26 1999/07/09 09:52:59 mrg Exp $ # Makefile for NetBSD # @@ -58,6 +58,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -T${MIPS}/conf/kern.ldscript -Ttext 80080000 -e start ${GP} STRIPFLAGS= -g -X -x +%INCLUDES + ### find out what to use for libkern .include "$S/lib/libkern/Makefile.inc" .ifndef PROF diff --git a/sys/arch/pmax/conf/Makefile.pmax b/sys/arch/pmax/conf/Makefile.pmax index 41ba62d69c01..443eaa9a44dc 100644 --- a/sys/arch/pmax/conf/Makefile.pmax +++ b/sys/arch/pmax/conf/Makefile.pmax @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.pmax,v 1.73 1999/07/02 20:55:19 tv Exp $ +# $NetBSD: Makefile.pmax,v 1.74 1999/07/09 09:53:00 mrg Exp $ # Makefile for NetBSD # @@ -59,6 +59,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -Ttext 0x80030000 -T ${MIPS}/conf/kern.ldscript -e start ${GP} STRIPFLAGS= -g -X -x +%INCLUDES + ### find out what to use for libkern .include "$S/lib/libkern/Makefile.inc" .ifndef PROF diff --git a/sys/arch/sparc/conf/Makefile.sparc b/sys/arch/sparc/conf/Makefile.sparc index 302bd0a5b917..437676403788 100644 --- a/sys/arch/sparc/conf/Makefile.sparc +++ b/sys/arch/sparc/conf/Makefile.sparc @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.sparc,v 1.60 1999/06/28 21:03:23 pk Exp $ +# $NetBSD: Makefile.sparc,v 1.61 1999/07/09 09:53:00 mrg Exp $ # Makefile for NetBSD # @@ -64,6 +64,8 @@ LINKFLAGS+= -n .endif STRIPFLAGS= -d +%INCLUDES + ### find out what to use for libkern KERN_AS= obj .include "$S/lib/libkern/Makefile.inc" diff --git a/sys/arch/sparc64/conf/Makefile.sparc64 b/sys/arch/sparc64/conf/Makefile.sparc64 index 8a6012ec6474..4e0feba14390 100644 --- a/sys/arch/sparc64/conf/Makefile.sparc64 +++ b/sys/arch/sparc64/conf/Makefile.sparc64 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.sparc64,v 1.9 1999/06/05 01:56:31 mrg Exp $ +# $NetBSD: Makefile.sparc64,v 1.10 1999/07/09 09:53:00 mrg Exp $ # Makefile for NetBSD # @@ -67,6 +67,8 @@ AFLAGS= -x assembler-with-cpp -Wa,-Av9a -traditional-cpp -D_LOCORE LINKFLAGS= -N -p -Ttext f8000000 -e start >lderr #STRIPFLAGS= -d +%INCLUDES + ### find out what to use for libkern KERN_AS= obj .include "$S/lib/libkern/Makefile.inc" diff --git a/sys/arch/sun3/conf/Makefile.sun3 b/sys/arch/sun3/conf/Makefile.sun3 index f13fe9c90c51..d18fd18e08c4 100644 --- a/sys/arch/sun3/conf/Makefile.sun3 +++ b/sys/arch/sun3/conf/Makefile.sun3 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.sun3,v 1.74 1999/01/15 23:21:27 thorpej Exp $ +# $NetBSD: Makefile.sun3,v 1.75 1999/07/09 09:53:00 mrg Exp $ # Makefile for NetBSD # @@ -72,6 +72,8 @@ AFLAGS= LINKFLAGS= -N -Ttext ${TEXTADDR} -e start STRIPFLAGS= -d +%INCLUDES + ### find out what to use for libkern KERN_AS= obj .include "$S/lib/libkern/Makefile.inc" diff --git a/sys/arch/vax/conf/Makefile.vax b/sys/arch/vax/conf/Makefile.vax index ac967a3bf766..1458a1ac62af 100644 --- a/sys/arch/vax/conf/Makefile.vax +++ b/sys/arch/vax/conf/Makefile.vax @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.vax,v 1.47 1999/01/17 19:09:00 matt Exp $ +# $NetBSD: Makefile.vax,v 1.48 1999/07/09 09:53:01 mrg Exp $ # Makefile for NetBSD # @@ -59,6 +59,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -N -Ttext 80000000 -e start STRIPFLAGS= -d +%INCLUDES + HOSTED_CC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} diff --git a/sys/arch/x68k/conf/Makefile.x68k b/sys/arch/x68k/conf/Makefile.x68k index acc6e2a56466..f04380f81779 100644 --- a/sys/arch/x68k/conf/Makefile.x68k +++ b/sys/arch/x68k/conf/Makefile.x68k @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.x68k,v 1.35 1999/04/01 14:11:21 minoura Exp $ +# $NetBSD: Makefile.x68k,v 1.36 1999/07/09 09:53:01 mrg Exp $ # Makefile for NetBSD # @@ -62,6 +62,8 @@ AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE LINKFLAGS= -n -Ttext 0 -e start STRIPFLAGS= -d +%INCLUDES + HOSTED_CC= ${CC} HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} HOSTED_CFLAGS= ${CFLAGS} diff --git a/usr.sbin/config/config.h b/usr.sbin/config/config.h index 88cd92ad5481..79746bbebc8c 100644 --- a/usr.sbin/config/config.h +++ b/usr.sbin/config/config.h @@ -1,4 +1,4 @@ -/* $NetBSD: config.h,v 1.44 1999/07/09 06:44:58 thorpej Exp $ */ +/* $NetBSD: config.h,v 1.45 1999/07/09 09:53:01 mrg Exp $ */ /* * Copyright (c) 1992, 1993 @@ -348,6 +348,7 @@ struct files *allfiles; /* list of all kernel source files */ struct objects *allobjects; /* list of all kernel object and library files */ struct prefix *prefixes; /* prefix stack */ +struct prefix *allprefixes; /* all prefixes used (after popped) */ struct devi **packed; /* arrayified table for packed devi's */ int npacked; /* size of packed table, <= ndevi */ diff --git a/usr.sbin/config/mkmakefile.c b/usr.sbin/config/mkmakefile.c index 7b98402796cd..422e1b24c4ae 100644 --- a/usr.sbin/config/mkmakefile.c +++ b/usr.sbin/config/mkmakefile.c @@ -1,4 +1,4 @@ -/* $NetBSD: mkmakefile.c,v 1.40 1999/07/09 06:44:59 thorpej Exp $ */ +/* $NetBSD: mkmakefile.c,v 1.41 1999/07/09 09:53:01 mrg Exp $ */ /* * Copyright (c) 1992, 1993 @@ -67,6 +67,7 @@ static int emitcfiles __P((FILE *)); static int emitsfiles __P((FILE *)); static int emitrules __P((FILE *)); static int emitload __P((FILE *)); +static int emitincludes __P((FILE *)); int mkmakefile() @@ -111,6 +112,8 @@ mkmakefile() fn = emitrules; else if (strcmp(line, "%LOAD\n") == 0) fn = emitload; + else if (strcmp(line, "%INCLUDES\n") == 0) + fn = emitincludes; else { xerror(ifname, lineno, "unknown %% construct ignored: %s", line); @@ -388,9 +391,20 @@ emitrules(fp) continue; if ((fpath = srcpath(fi)) == NULL) return (1); - if (fprintf(fp, "%s.o: %s%s\n", fi->fi_base, - *fpath != '/' ? "$S/" : "", fpath) < 0) - return (1); + if (*fpath == '/') { + if (fprintf(fp, "%s.o: %s\n", fi->fi_base, fpath) < 0) + return (1); + } else { + if (fi->fi_prefix != NULL) { + if (fprintf(fp, "%s.o: $S/%s/%s\n", fi->fi_base, + fi->fi_prefix, fpath) < 0) + return (1); + } else { + if (fprintf(fp, "%s.o: $S/%s\n", fi->fi_base, + fpath) < 0) + return (1); + } + } if ((cp = fi->fi_mkrule) == NULL) { cp = "NORMAL"; ch = fpath[strlen(fpath) - 1]; @@ -452,3 +466,25 @@ swap%s.o: ", swname, swname) < 0) } return (0); } + +/* + * Emit include headers (for any prefixes encountered) + */ +static int +emitincludes(fp) + FILE *fp; +{ + struct prefix *pf; + int done = 0; + + for (pf = allprefixes; pf != NULL; pf = pf->pf_next) { + if (done == 0) { + done = 1; + fprintf(fp, "INCLUDES+=\t"); + } + fprintf(fp, " -I$S/%s", pf->pf_prefix); + } + putc('\n', fp); + + return (0); +} diff --git a/usr.sbin/config/util.c b/usr.sbin/config/util.c index 7f590d61b848..cd745813998b 100644 --- a/usr.sbin/config/util.c +++ b/usr.sbin/config/util.c @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.8 1999/07/09 06:44:59 thorpej Exp $ */ +/* $NetBSD: util.c,v 1.9 1999/07/09 09:53:01 mrg Exp $ */ /* * Copyright (c) 1992, 1993 @@ -151,7 +151,17 @@ prefix_pop() } prefixes = pf->pf_next; - free(pf); + + /* + * Once we're done with it, put it on the allprefixes list. + */ + if (allprefixes) { + allprefixes = pf; + pf->pf_next = NULL; + } else { + pf->pf_next = allprefixes; + allprefixes = pf; + } } /*