Makefile.i386 revision 1.87
1# $NetBSD: Makefile.i386,v 1.87 1997/11/12 22:26:02 thorpej Exp $ 2 3# Makefile for NetBSD 4# 5# This makefile is constructed from a machine description: 6# config machineid 7# Most changes should be made in the machine description 8# /sys/arch/i386/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/i386/conf/Makefile.i386 13# after which config should be rerun for all machines of that type. 14# 15# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 16# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 17# 18# -DTRACE compile in kernel tracing hooks 19# -DQUOTA compile in file system quotas 20 21# DEBUG is set to -g if debugging. 22# PROF is set to -pg if profiling. 23 24CC?= cc 25LD?= ld 26LORDER?=lorder 27MKDEP?= mkdep 28NM?= nm 29SIZE?= size 30STRIP?= strip 31TSORT?= tsort -q 32COPTS?= -O2 33 34# source tree is located via $S relative to the compilation directory 35.ifndef S 36S!= cd ../../../..; pwd 37.endif 38I386= $S/arch/i386 39 40INCLUDES= -I. -I$S/arch -I$S -nostdinc 41CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \ 42 -Di386 43CWARNFLAGS= -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes 44CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} 45AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 46LINKFLAGS= -z -Ttext F0100000 -e start 47STRIPFLAGS= -d 48 49### find out what to use for libkern 50.include "$S/lib/libkern/Makefile.inc" 51.ifndef PROF 52LIBKERN= ${KERNLIB} 53.else 54LIBKERN= ${KERNLIB_PROF} 55.endif 56 57### find out what to use for libcompat 58.include "$S/compat/common/Makefile.inc" 59.ifndef PROF 60LIBCOMPAT= ${COMPATLIB} 61.else 62LIBCOMPAT= ${COMPATLIB_PROF} 63.endif 64 65# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 66# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 67 68NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 69NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 70 71%OBJS 72 73%CFILES 74 75%SFILES 76 77# load lines for config "xxx" will be emitted as: 78# xxx: ${SYSTEM_DEP} swapxxx.o 79# ${SYSTEM_LD_HEAD} 80# ${SYSTEM_LD} swapxxx.o 81# ${SYSTEM_LD_TAIL} 82SYSTEM_OBJ= locore.o \ 83 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 84SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 85SYSTEM_LD_HEAD= rm -f $@ 86SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 87 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 88SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 89 90DEBUG?= 91.if ${DEBUG} == "-g" 92LINKFLAGS+= -X 93SYSTEM_LD_TAIL+=; \ 94 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 95 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 96.else 97LINKFLAGS+= -S 98.endif 99 100%LOAD 101 102assym.h: $S/kern/genassym.sh ${I386}/i386/genassym.cf 103 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 104 < ${I386}/i386/genassym.cf > assym.h.tmp && \ 105 mv -f assym.h.tmp assym.h 106 107param.c: $S/conf/param.c 108 rm -f param.c 109 cp $S/conf/param.c . 110 111param.o: param.c Makefile 112 ${NORMAL_C} 113 114ioconf.o: ioconf.c 115 ${NORMAL_C} 116 117newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 118 sh $S/conf/newvers.sh 119 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 120 121 122__CLEANKERNEL: .USE 123 @echo "${.TARGET}ing the kernel objects" 124 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 125 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 126 127__CLEANDEPEND: .USE 128 rm -f .depend 129 130clean: __CLEANKERNEL 131 132cleandir: __CLEANKERNEL __CLEANDEPEND 133 134lint: 135 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 136 ${I386}/i386/Locore.c ${CFILES} \ 137 ioconf.c param.c | \ 138 grep -v 'static function .* unused' 139 140tags: 141 @echo "see $S/kern/Makefile for tags" 142 143links: 144 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 145 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 146 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 147 sort -u | comm -23 - dontlink | \ 148 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 149 sh makelinks && rm -f dontlink 150 151SRCS= ${I386}/i386/locore.s \ 152 param.c ioconf.c ${CFILES} ${SFILES} 153depend: .depend 154.depend: ${SRCS} assym.h param.c 155 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s 156 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 157 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 158 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 159 ${CPPFLAGS} < ${I386}/i386/genassym.cf 160 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 161 @rm -f assym.dep 162 163 164# depend on root or device configuration 165autoconf.o conf.o: Makefile 166 167# depend on network or filesystem configuration 168uipc_proto.o vfs_conf.o: Makefile 169 170# depend on maxusers 171machdep.o: Makefile 172 173# depend on CPU configuration 174locore.o machdep.o: Makefile 175 176 177locore.o: ${I386}/i386/locore.s assym.h 178 ${NORMAL_S} 179 180%RULES 181