Makefile.i386 revision 1.116
1# $NetBSD: Makefile.i386,v 1.116 2001/06/05 05:05:46 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.include <bsd.own.mk> 16 17# DEBUG is set to -g if debugging. 18# PROF is set to -pg if profiling. 19 20AR?= ar 21AS?= as 22CC?= cc 23CPP?= cpp 24LD?= ld 25LORDER?=lorder 26MKDEP?= mkdep 27NM?= nm 28RANLIB?=ranlib 29SIZE?= size 30STRIP?= strip 31TSORT?= tsort -q 32 33COPTS?= -O2 34 35# source tree is located via $S relative to the compilation directory 36.ifndef S 37S!= cd ../../../..; pwd 38.endif 39I386= $S/arch/i386 40 41HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 42INCLUDES= -I. -I$S/arch -I$S -nostdinc 43CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Di386 44CWARNFLAGS?= -Werror -Wall -Wmissing-prototypes -Wstrict-prototypes \ 45 -Wpointer-arith 46# XXX Delete -Wuninitialized for now, since the compiler doesn't 47# XXX always get it right. --thorpej 48CWARNFLAGS+= -Wno-uninitialized 49.if (${HAVE_EGCS} != "") 50CWARNFLAGS+= -Wno-main 51.endif 52CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} 53AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 54 55TEXTADDR?= c0100000 56LINKFLAGS= -Ttext ${TEXTADDR} -e start 57 58.if (${OBJECT_FMT} == "ELF") 59KERN_LDSCRIPT?= kern.ldscript 60LINKFLAGS+= -T ${I386}/conf/${KERN_LDSCRIPT} 61.else 62LINKFLAGS+= -z 63.endif 64 65STRIPFLAGS= -g 66 67%INCLUDES 68 69### find out what to use for libkern 70KERN_AS= obj 71.include "$S/lib/libkern/Makefile.inc" 72.ifndef PROF 73LIBKERN= ${KERNLIB} 74.else 75LIBKERN= ${KERNLIB_PROF} 76.endif 77 78### find out what to use for libcompat 79.include "$S/compat/common/Makefile.inc" 80.ifndef PROF 81LIBCOMPAT= ${COMPATLIB} 82.else 83LIBCOMPAT= ${COMPATLIB_PROF} 84.endif 85 86# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 87# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 88 89NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 90NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 91NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 92 93%OBJS 94 95%CFILES 96 97%SFILES 98 99# load lines for config "xxx" will be emitted as: 100# xxx: ${SYSTEM_DEP} swapxxx.o 101# ${SYSTEM_LD_HEAD} 102# ${SYSTEM_LD} swapxxx.o 103# ${SYSTEM_LD_TAIL} 104SYSTEM_OBJ= locore.o \ 105 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 106SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 107SYSTEM_LD_HEAD= rm -f $@ 108SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 109 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 110SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 111 112DEBUG?= 113.if ${DEBUG} == "-g" 114LINKFLAGS+= -X 115SYSTEM_LD_TAIL+=; \ 116 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 117 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 118 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 119.else 120LINKFLAGS+= -X 121.endif 122 123%LOAD 124 125assym.h: $S/kern/genassym.sh ${I386}/i386/genassym.cf 126 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 127 < ${I386}/i386/genassym.cf > assym.h.tmp && \ 128 mv -f assym.h.tmp assym.h 129 130param.c: $S/conf/param.c 131 rm -f param.c 132 cp $S/conf/param.c . 133 134param.o: param.c Makefile 135 ${NORMAL_C} 136 137ioconf.o: ioconf.c 138 ${NORMAL_C} 139 140newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 141 sh $S/conf/newvers.sh 142 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 143 144 145__CLEANKERNEL: .USE 146 @echo "${.TARGET}ing the kernel objects" 147 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 148 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 149 150__CLEANDEPEND: .USE 151 rm -f .depend 152 153clean: __CLEANKERNEL 154 155cleandir distclean: __CLEANKERNEL __CLEANDEPEND 156 157ALLSFILES= ${I386}/i386/locore.s ${SFILES} 158LINTSTUBS= ${ALLSFILES:T:R:C/^.*$/LintStub_&.c/g} 159 160.for _sfile in ${ALLSFILES} 161LintStub_${_sfile:T:R}.c: ${_sfile} assym.h 162 ${CC} -E -C ${AFLAGS} ${CPPFLAGS} ${_sfile} | \ 163 awk -f $S/kern/genlintstub.awk >${.TARGET} 164.endfor 165 166lint: ${CFILES} ${LINTSTUBS} ioconf.c param.c 167 @lint -bceghnxzF ${CPPFLAGS} -UKGDB \ 168 ${CFILES} ${LINTSTUBS} ioconf.c param.c 169 170tags: 171 @echo "see $S/kern/Makefile for tags" 172 173links: 174 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 175 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 176 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 177 sort -u | comm -23 - dontlink | \ 178 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 179 sh makelinks && rm -f dontlink 180 181SRCS= ${I386}/i386/locore.s \ 182 param.c ioconf.c ${CFILES} ${SFILES} 183depend: .depend 184.depend: ${SRCS} assym.h param.c 185 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${I386}/i386/locore.s 186 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 187 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 188 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 189 ${CPPFLAGS} < ${I386}/i386/genassym.cf 190 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 191 @rm -f assym.dep 192 193dependall: depend all 194 195 196# depend on root or device configuration 197autoconf.o conf.o: Makefile 198 199# depend on network or filesystem configuration 200uipc_proto.o vfs_conf.o: Makefile 201 202# depend on maxusers 203machdep.o: Makefile 204 205# depend on CPU configuration 206locore.o machdep.o: Makefile 207 208locore.o: ${I386}/i386/locore.s assym.h 209 ${NORMAL_S} 210 211apmcall.o in_cksum.o pnpbioscall.o: assym.h 212 213freebsd_sigcode.o ibcs2_sigcode.o linux_sigcode.o svr4_sigcode.o: assym.h 214 215# The install target can be redefined by putting a 216# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 217MACHINE_NAME!= uname -n 218install: install-kernel-${MACHINE_NAME} 219.if !target(install-kernel-${MACHINE_NAME}}) 220install-kernel-${MACHINE_NAME}: 221 rm -f /onetbsd 222 ln /netbsd /onetbsd 223 cp netbsd /nnetbsd 224 mv /nnetbsd /netbsd 225.endif 226 227%RULES 228