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