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