Makefile.arm revision 1.10
1# $NetBSD: Makefile.arm,v 1.10 2001/10/26 06:45:35 jmc 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%LOAD 132 133assym.h: $S/kern/genassym.sh ${ARM}/arm32/genassym.cf 134 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 135 < ${ARM}/arm32/genassym.cf > assym.h.tmp && \ 136 mv -f assym.h.tmp assym.h 137 138param.c: $S/conf/param.c 139 rm -f param.c 140 cp $S/conf/param.c . 141 142param.o: param.c Makefile 143 ${NORMAL_C} 144 145ioconf.o: ioconf.c 146 ${NORMAL_C} 147 148newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 149 sh $S/conf/newvers.sh 150 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 151 152__CLEANKERNEL: .USE 153 @echo "${.TARGET}ing the kernel objects" 154 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 155 [Ee]rrs linterrs makelinks assym.h.tmp assym.h ${EXTRA_CLEAN} 156 157__CLEANDEPEND: .USE 158 rm -f .depend 159 160clean: __CLEANKERNEL 161 162cleandir distclean: __CLEANKERNEL __CLEANDEPEND 163 164lint: 165 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 166 ${ARM32}/arm32/Locore.c ${CFILES} \ 167 ioconf.c param.c | \ 168 grep -v 'static function .* unused' 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= ${ARM}/arm32/locore.S param.c ioconf.c ${CFILES} ${SFILES} \ 182 ${EXTRA_CFILES} ${EXTRA_SFILES} ${SYSTEM_FIRST_SFILE} 183 184depend: .depend 185.depend: ${SRCS} assym.h param.c 186 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SYSTEM_FIRST_SFILE} \ 187 ${ARM}/arm32/locore.S ${EXTRA_SFILES} 188 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} \ 189 ${EXTRA_CFILES} 190 test -z "${SFILES}" || ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 191 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 192 ${CPPFLAGS} < ${ARM}/arm32/genassym.cf 193 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 194 @rm -f assym.dep 195 196dependall: depend all 197 198.if !exists(include) 199${OBJS} assym.h .depend: include-dir 200include-dir: 201 @rm -rf include 202 @mkdir -p include/arm 203.if (${S} == "../../../..") 204 @(cd include/arm; ln -s ../../$S/arch/${MACHINE}/include ${MACHINE}) 205 @(cd include; ln -s ../$S/arch/arm/include machine) 206.else 207 @ln -s $S/arch/${MACHINE}/include include/arm/${MACHINE} 208 @ln -s $S/arch/arm/include include/machine 209.endif 210.endif 211 212# depend on root or device configuration 213autoconf.o conf.o: Makefile 214 215# depend on network 216uipc_proto.o: Makefile 217 218# depend on maxusers 219assym.h: Makefile 220 221# depend on CPU configuration 222cpufunc.o cpufunc_asm.o: Makefile 223 224# depend on DIAGNOSTIC etc. 225cpuswitch.o fault.o machdep.o: Makefile 226 227.if defined(SYSTEM_FIRST_OBJ) 228${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h 229 ${NORMAL_S} 230.endif 231 232locore.o: ${ARM}/arm32/locore.S assym.h 233 ${NORMAL_S} 234 235# The install target can be redefined by putting a 236# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 237MACHINE_NAME!= uname -n 238install: install-kernel-${MACHINE_NAME} 239.if !target(install-kernel-${MACHINE_NAME}}) 240install-kernel-${MACHINE_NAME}: 241 rm -f /onetbsd 242 ln /netbsd /onetbsd 243 cp netbsd /nnetbsd 244 mv /nnetbsd /netbsd 245.endif 246 247%RULES 248