Source-Changes-HG archive

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

[src/trunk]: src/sys Abstract out a large chunk of the kernel build machinery...



details:   https://anonhg.NetBSD.org/src/rev/b52a5182fa0b
branches:  trunk
changeset: 517605:b52a5182fa0b
user:      atatat <atatat%NetBSD.org@localhost>
date:      Fri Nov 16 00:23:02 2001 +0000

description:
Abstract out a large chunk of the kernel build machinery so that new
build features (such as ross's DEBUGLIST) can easily be applied to all
ports.  This should reduce the complexity of each port's kernel
Makefile considerably.  Line counts:

     227 arch/i386/conf/Makefile.i386.orig
      98 arch/i386/conf/Makefile.i386
     227 arch/alpha/conf/Makefile.alpha.orig
      99 arch/alpha/conf/Makefile.alpha
     219 arch/sparc/conf/Makefile.sparc.orig
     102 arch/sparc/conf/Makefile.sparc
     215 arch/vax/conf/Makefile.vax.orig
     102 arch/vax/conf/Makefile.vax
     253 conf/Makefile.kern.inc

Roll i386, alpha, sparc, and vax over to the new build machinery.

diffstat:

 sys/arch/alpha/conf/Makefile.alpha |  255 ++++++++----------------------------
 sys/arch/i386/conf/Makefile.i386   |  250 ++++++++---------------------------
 sys/arch/sparc/conf/Makefile.sparc |  246 +++++++++--------------------------
 sys/arch/vax/conf/Makefile.vax     |  246 +++++++++--------------------------
 sys/conf/Makefile.kern.inc         |  255 +++++++++++++++++++++++++++++++++++++
 5 files changed, 502 insertions(+), 750 deletions(-)

diffs (truncated from 1406 to 300 lines):

diff -r f68b0a7db418 -r b52a5182fa0b sys/arch/alpha/conf/Makefile.alpha
--- a/sys/arch/alpha/conf/Makefile.alpha        Thu Nov 15 23:25:09 2001 +0000
+++ b/sys/arch/alpha/conf/Makefile.alpha        Fri Nov 16 00:23:02 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.alpha,v 1.67 2001/10/26 06:45:34 jmc Exp $
+# $NetBSD: Makefile.alpha,v 1.68 2001/11/16 00:23:03 atatat Exp $
 
 # Makefile for NetBSD
 #
@@ -11,81 +11,77 @@
 # Machine generic makefile changes should be made in
 #      /sys/arch/alpha/conf/Makefile.alpha
 # after which config should be rerun for all machines of that type.
-
-MACHINE_ARCH=alpha
-USETOOLS?=     no
-
-.include <bsd.own.mk>
-
-# DEBUG is set to -g if debugging.
-# PROF is set to -pg if profiling.
 #
 # To specify debugging, add the config line: makeoptions DEBUG="-g" 
 # A better way is to specify -g only for a few files.
 #
 #      makeoptions DEBUGLIST="uvm* trap if_*"
 
-AR?=   ar
-AS?=   as
-CC?=   cc
-CPP?=  cpp
-LD?=   ld
-LORDER?=lorder
-MKDEP?=        mkdep
-NM?=   nm
-RANLIB?=ranlib
-SIZE?= size
-STRIP?=        strip
-TSORT?=        tsort -q
+MACHINE_ARCH=  alpha
+USETOOLS?=     no
+NEED_OWN_INSTALL_TARGET?=no
+.include <bsd.own.mk>
 
-# source tree is located via $S relative to the compilation directory
-.ifndef S
-S!=    cd ../../../..; pwd
-.endif
-ALPHA= $S/arch/alpha
+##
+## (1) port identification
+##
+ALPHA=         $S/arch/alpha
+GENASSYM=      ${ALPHA}/alpha/genassym.cf
+MD_CPPFLAGS=   -Dalpha
 
-HAVE_EGCS!=    ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 
-INCLUDES=      -I. -I$S/arch -I$S -nostdinc
-CPPFLAGS=      ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dalpha
+##
+## (2) compile settings
+##
+CPPFLAGS=      ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT \
+               ${MD_CPPFLAGS}
 COPTS?=                -O2
-CWARNFLAGS?=   -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
-               -Wpointer-arith
-# XXX Delete -Wuninitialized for now, since the compiler doesn't
-# XXX always get it right.  --thorpej 
-CWARNFLAGS+=   -Wno-uninitialized
-.if (${HAVE_EGCS} != "")
-CWARNFLAGS+=   -Wno-main
-.endif
 CFLAGS=                ${DEBUG} ${COPTS} ${CWARNFLAGS} -mno-fp-regs
 AFLAGS=                -traditional -D_LOCORE
-LOADADDRESS?=  fffffc0000300000
-LINKFLAGS=     -N -Ttext ${LOADADDRESS} -e __transfer -G 4
+NORMAL_S=      ${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's,^\#.*,,' | ${AS} -o ${.TARGET}
+
+##
+## (3) libkern and compat 
+##
+
+##
+## (4) local objects, compile rules, and dependencies
+##
+MD_OBJS=       locore.o transfer.o
+MD_CFILES=
+MD_SFILES=     ${ALPHA}/alpha/locore.s ${ALPHA}/alpha/transfer.s
+
+locore.o: ${ALPHA}/alpha/locore.s assym.h
+       ${NORMAL_S}
+
+transfer.o: ${ALPHA}/alpha/transfer.s
+       ${NORMAL_S}
+
+##
+## (5) link settings
+##
+LINKFORMAT=    -N
+TEXTADDR?=     fffffc0000300000
+EXTRA_LINKFLAGS=       -G 4
+LINKFLAGS_DEBUG=       -X
+LINKFLAGS_NORMAL=      -S
 STRIPFLAGS=    -g -X
 
-%INCLUDES
+##
+## (6) port specific target dependencies
+##
 
-### find out what to use for libkern
-.include "$S/lib/libkern/Makefile.inc"
-.ifndef PROF
-LIBKERN=       ${KERNLIB}
-.else
-LIBKERN=       ${KERNLIB_PROF}
-.endif
+# depend on CPU configuration 
+clock.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile
 
-### find out what to use for libcompat
-.include "$S/compat/common/Makefile.inc"
-.ifndef PROF
-LIBCOMPAT=     ${COMPATLIB}
-.else
-LIBCOMPAT=     ${COMPATLIB_PROF}
-.endif
+##
+## (7) misc settings
+##
+MKDEP_AFLAGS=  -x assembler-with-cpp ${AFLAGS}
 
-# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or
-# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file).
-
-NORMAL_C=      ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${${<:T:R}_G} -c $<
-NOPROF_C=      ${CC} ${CFLAGS} ${CPPFLAGS} -c $<
-NORMAL_S=      ${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's,^\#.*,,' | ${AS} -o ${.TARGET}
+##
+## (8) config(8) generated machinery
+##
+%INCLUDES
 
 %OBJS
 
@@ -93,140 +89,11 @@
 
 %SFILES
 
-#
-# Define a set of xxx_G variables that will add -g to just those
-# files that match the shell patterns given in ${DEBUGLIST}
-#
-
-.for i in ${DEBUGLIST}
-.for j in ${CFILES:T:M$i.c}
-${j:R}_G= -g
-.endfor
-.endfor
-
-# load lines for config "xxx" will be emitted as:
-# xxx: ${SYSTEM_DEP} swapxxx.o
-#      ${SYSTEM_LD_HEAD}
-#      ${SYSTEM_LD} swapxxx.o
-#      ${SYSTEM_LD_TAIL}
-SYSTEM_OBJ=    locore.o transfer.o \
-               param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN}
-SYSTEM_DEP=    Makefile ${SYSTEM_OBJ}
-SYSTEM_LD_HEAD=        @rm -f $@
-SYSTEM_LD=     @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \
-               ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o
-SYSTEM_LD_TAIL=        @${SIZE} $@; chmod 755 $@
-
-DEBUG?=
-.if ${DEBUG} == "-g" || defined(DEBUGLIST)
-LINKFLAGS+=    -X
-SYSTEM_LD_TAIL+=; \
-               echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \
-               echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \
-               ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb
-.else
-LINKFLAGS+=    -S
-.endif
-
 %LOAD
 
-# Use awk to cross-build assym.h from the genassym.s file.
-assym.h: $S/kern/genassym.sh ${ALPHA}/alpha/genassym.cf
-       sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \
-           < ${ALPHA}/alpha/genassym.cf > assym.h.tmp && \
-       mv -f assym.h.tmp assym.h
-
-param.c: $S/conf/param.c
-       rm -f param.c
-       cp $S/conf/param.c .
-
-param.o: param.c Makefile
-       ${NORMAL_C}
-
-ioconf.o: ioconf.c
-       ${NORMAL_C}
-
-newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP}
-       sh $S/conf/newvers.sh
-       ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c
-
-
-__CLEANKERNEL: .USE
-       @echo "${.TARGET}ing the kernel objects"
-       rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \
-           [Ee]rrs linterrs makelinks assym.h.tmp assym.h
-
-__CLEANDEPEND: .USE
-       rm -f .depend
-
-clean: __CLEANKERNEL
-
-cleandir distclean: __CLEANKERNEL __CLEANDEPEND
-
-lint:
-       @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \
-           ${ALPHA}/alpha/Locore.c ${CFILES} \
-           ioconf.c param.c | \
-           grep -v 'static function .* unused'
-
-tags:
-       @echo "see $S/kern/Makefile for tags"
-
-links:
-       egrep '#if' ${CFILES} | sed -f $S/conf/defines | \
-         sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink
-       echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \
-         sort -u | comm -23 - dontlink | \
-         sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks
-       sh makelinks && rm -f dontlink
+%RULES
 
-SRCS=  ${ALPHA}/alpha/locore.s ${ALPHA}/alpha/transfer.s \
-       param.c ioconf.c ${CFILES} ${SFILES}
-depend: .depend
-.depend: ${SRCS} assym.h param.c
-       ${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \
-           ${ALPHA}/alpha/locore.s
-       ${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \
-           ${ALPHA}/alpha/transfer.s
-       ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES}
-       test -z "${SFILES}" || \
-       ${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES}
-       sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \
-         ${CPPFLAGS} < ${ALPHA}/alpha/genassym.cf
-       @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend
-       @rm -f assym.dep
-
-dependall: depend all
-
-
-# depend on root or device configuration
-autoconf.o conf.o: Makefile
- 
-# depend on network or filesystem configuration 
-uipc_proto.o vfs_conf.o: Makefile 
-
-# depend on maxusers
-assym.h machdep.o: Makefile
-
-# depend on CPU configuration 
-clock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile
-
-locore.o: ${ALPHA}/alpha/locore.s assym.h
-       ${NORMAL_S}
-
-transfer.o: ${ALPHA}/alpha/transfer.s
-       ${NORMAL_S}
-
-# The install target can be redefined by putting a
-# install-kernel-${MACHINE_NAME} target into /etc/mk.conf
-MACHINE_NAME!=  uname -n
-install: install-kernel-${MACHINE_NAME}
-.if !target(install-kernel-${MACHINE_NAME}})
-install-kernel-${MACHINE_NAME}:
-       rm -f /onetbsd
-       ln /netbsd /onetbsd
-       cp netbsd /nnetbsd
-       mv /nnetbsd /netbsd
-.endif
-
-%RULES
+##
+## (9) port independent kernel machinery
+##
+.include "$S/conf/Makefile.kern.inc"
diff -r f68b0a7db418 -r b52a5182fa0b sys/arch/i386/conf/Makefile.i386
--- a/sys/arch/i386/conf/Makefile.i386  Thu Nov 15 23:25:09 2001 +0000
+++ b/sys/arch/i386/conf/Makefile.i386  Fri Nov 16 00:23:02 2001 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile.i386,v 1.118 2001/10/26 06:45:37 jmc Exp $
+#      $NetBSD: Makefile.i386,v 1.119 2001/11/16 00:23:03 atatat Exp $
 
 # Makefile for NetBSD



Home | Main Index | Thread Index | Old Index