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