From a05a325f551b5d6aa4486218242ada4d3cd08931 Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Wed, 7 Mar 2001 23:34:40 +0000 Subject: General cleanup in the kernel compilation process, sync style with other ports, add warning flags. --- sys/arch/mvme88k/conf/Makefile.mvme88k | 169 +++++++++++++++++---------------- 1 file changed, 85 insertions(+), 84 deletions(-) diff --git a/sys/arch/mvme88k/conf/Makefile.mvme88k b/sys/arch/mvme88k/conf/Makefile.mvme88k index 04b91a7a0f7..d88d20e4f8e 100644 --- a/sys/arch/mvme88k/conf/Makefile.mvme88k +++ b/sys/arch/mvme88k/conf/Makefile.mvme88k @@ -1,5 +1,4 @@ -# $OpenBSD: Makefile.mvme88k,v 1.9 2001/01/13 05:18:58 smurph Exp $ -# @(#)Makefile.hp300 7.10 (Berkeley) 6/27/91 +# $OpenBSD: Makefile.mvme88k,v 1.10 2001/03/07 23:34:39 miod Exp $ # # Makefile for OpenBSD # @@ -19,33 +18,38 @@ # -DTRACE compile in kernel tracing hooks # -DQUOTA compile in file system quotas - # DEBUG is set to -g by config if debugging is requested (config -g). # PROF is set to -pg by config if profiling is requested (config -p). -AS?= as ${DEBUG} -AWK?= awk -CC?= cc ${DEBUG} +AS?= as +CC?= cc CPP?= cpp LD?= ld -TOUCH?= touch -f -c +MKDEP?= mkdep SIZE?= size STRIP?= strip - -.ifndef HOSTCC -HOSTCC=cc -.endif +TOUCH?= touch # source tree is located via $S relative to the compilation directory -S= ../../../.. -MVME88K= ../.. - -INCLUDES= -I. -I$S/arch -I$S -I$S/sys -.if defined(DESTDIR) -INCLUDES+= -nostdinc -idirafter ${DESTDIR}/usr/include +.ifndef S +S!= cd ../../../..; pwd .endif -CPPFLAGS= ${INCLUDES} ${IDENT} -DKERNEL -D_KERNEL -Dmvme88k -Dm88k -CFLAGS= -O ${DEBUG} #-Werror +MVME88K= $S/arch/mvme88k + +INCLUDES= -nostdinc -I. -I$S/arch -I$S +CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL -Dmvme88k -Dm88k +CDIAGFLAGS= -Wall -Wmissing-prototypes \ + -Wno-uninitialized -Wno-format -Wno-main # -Wstrict-prototypes +CMACHFLAGS= +CFLAGS= ${DEBUG} -O ${CDIAGFLAGS} ${CMACHFLAGS} ${COPTS} +AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE +LINKFLAGS= -Ttext 0x10000 -e start +STRIPFLAGS= -d +TOUCHFLAGS= -f -c + +HOSTCC= ${CC} +HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} +HOSTED_CFLAGS= ${CFLAGS} ### find out what to use for libkern .include "$S/lib/libkern/Makefile.inc" @@ -68,46 +72,51 @@ LIBCOMPAT= ${COMPATLIB_PROF} # capitalized (e.g. C for a .c file), and CONFIG_DEP is _C if the file # is marked as config-dependent. -NORMAL_C= ${CC} -c ${CFLAGS} ${CPPFLAGS} ${PROF} $< -NORMAL_C_C= ${CC} -c ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} $< +NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< +NORMAL_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< -DRIVER_C= ${CC} -c ${CFLAGS} ${CPPFLAGS} ${PROF} $< -DRIVER_C_C= ${CC} -c ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} $< +DRIVER_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< +DRIVER_C_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} ${PARAM} -c $< + +NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< +NORMAL_S_C= ${CC} ${AFLAGS} ${CPPFLAGS} ${PARAM} -c $< + +HOSTED_C= ${HOSTCC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< PROFILE_C= ${CC} -S -c ${CFLAGS} ${CPPFLAGS} $<; \ sed -e s/_mcount/mcount/ -e s/subrmcount/subr_mcount/ <$*.s | \ ${AS} -o $@; \ rm -f $*.s -NORMAL_S= ${CC} -E ${CFLAGS} ${CPPFLAGS} $< | ${AS} -o $@ -NORMAL_S_C= ${CC} -E ${CFLAGS} ${CPPFLAGS} ${PARAM} $< | ${AS} -o $@ - %OBJS %CFILES +%SFILES + # load lines for config "xxx" will be emitted as: # xxx: ${SYSTEM_DEP} swapxxx.o # ${SYSTEM_LD_HEAD} # ${SYSTEM_LD} swapxxx.o # ${SYSTEM_LD_TAIL} # Kernel is linked as a ZMAGIC executable, with start at 10020 -SYSTEM_OBJ= locore.o ${OBJS} param.o ioconf.o \ - ${LIBKERN} ${LIBCOMPAT} +SYSTEM_OBJ= locore.o \ + param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} SYSTEM_DEP= Makefile ${SYSTEM_OBJ} -SYSTEM_LD_HEAD= @echo loading $@; rm -f $@ -SYSTEM_LD= -@if [ X${DEBUG} = X-g ]; \ - then strip=-X; \ - else strip=-x; \ - fi; \ - echo ${LD} $$strip -Ttext 0x10000 -o $@ '$${SYSTEM_OBJ}' vers.o; \ - ${LD} $$strip -Ttext 0x10000 -e start ${LINKFLAGS} -o $@ \ - ${SYSTEM_OBJ} vers.o -L. -lgcc -lgcc - -SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@; \ - [ X${DEBUG} = X-g ] && { \ +SYSTEM_LD_HEAD= @rm -f $@ +SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ + ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o -L. -lgcc -lgcc +SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@; + +DEBUG?= +.if ${DEBUG} == "-g" +LINKFLAGS+= -X +SYSTEM_LD_TAIL+=; \ echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ - echo ${STRIP} -d $@; ${STRIP} -d $@; } || true + echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ +.else +LINKFLAGS+= -x +.endif %LOAD @@ -115,37 +124,52 @@ assym.s: genassym ./genassym >assym.s genassym: - ${HOSTCC} -static ${INCLUDES} ${IDENT} ${PARAM} -Dmvme88k -Dm88k \ - -o genassym ${MVME88K}/mvme88k/genassym.c + ${HOSTCC} -static ${INCLUDES} -I$S/sys ${IDENT} ${PARAM} \ + -Dmvme88k -Dm88k -o genassym ${MVME88K}/mvme88k/genassym.c + +param.c: $S/conf/param.c + rm -f param.c + cp $S/conf/param.c . -assym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf - sh $S/kern/genassym.sh ${HOSTCC} ${CFLAGS} ${CPPFLAGS} \ - ${PARAM} < ${MVME88K}/mvme88k/genassym.cf > assym.h.tmp && \ - mv -f assym.h.tmp assym.h +param.o: param.c Makefile + ${NORMAL_C_C} -vers.o: newvers +ioconf.o: ioconf.c + ${NORMAL_C} newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} sh $S/conf/newvers.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c clean:: - rm -f eddep *bsd bsd.gdb tags *.o locore.i \ - [a-z]*.s [Ee]rrs errs linterrs makelinks + rm -f eddep *bsd bsd.gdb tags *.[io] [a-z]*.s \ + [Ee]rrs linterrs makelinks assym.s genassym -realclean:: - rm -f eddep *bsd bsd.gdb tags *.o locore.i .depend \ - [a-z]*.s [Ee]rrs errs linterrs makelinks - -lint: /tmp param.c - @lint -hbxn -DGENERIC -Dvolatile= ${CFLAGS} ${CPPFLAGS} ${PARAM} -UKGDB \ - ${CFILES} ${MVME88K}/mvme88k/swapgeneric.c ioconf.c param.c| \ +lint: + @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} ${PARAM} -UKGDB \ + ${CFILES} ${MVME88K}/mvme88k/swapgeneric.c ioconf.c param.c | \ grep -v 'struct/union .* never defined' | \ grep -v 'possible pointer alignment problem' -locore.o: assym.s ${MVME88K}/mvme88k/eh.S ${MVME88K}/mvme88k/locore.S -locore.o: machine/trap.h machine/psl.h machine/cpu.h - ${CPP} -DLOCORE ${CPPFLAGS} ${MVME88K}/mvme88k/locore.S | ${AS} -o locore.o +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 + +SRCS= param.c ioconf.c ${CFILES} ${SFILES} +depend:: .depend +.depend: ${SRCS} assym.s param.c + ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} +.if !empty(SFILES) + ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} +.endif + # depend on root or device configuration autoconf.o conf.o: Makefile @@ -161,30 +185,7 @@ genassym.o machdep.o: Makefile # depend on CPU configuration locore.o machdep.o: Makefile -depend:: .depend -.depend: assym.s param.c - mkdep ${CFLAGS} ${CPPFLAGS} ${CFILES} ioconf.c param.c - mkdep -a -p ${INCLUDES} ${IDENT} ${PARAM} ${MVME88K}/mvme88k/genassym.c - -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 - -tags: - @echo "see $S/kern/Makefile for tags" - -param.c: $S/conf/param.c - rm -f param.c - cp $S/conf/param.c . - -param.o: param.c Makefile - ${NORMAL_C_C} - -ioconf.o: ioconf.c - ${NORMAL_C} +locore.o: ${MVME88K}/mvme88k/locore.S assym.s + ${NORMAL_S} %RULES -- cgit v1.2.3