Makefile.acorn32 revision 1.2
1# $NetBSD: Makefile.acorn32,v 1.2 2001/10/23 17:32:35 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/acorn32/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/acorn32/conf/Makefile.acorn32 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 39ACORN32= $S/arch/acorn32 40ARM= $S/arch/arm 41 42HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 43INCLUDES= -I. -I$S/arch -I$S -nostdinc 44CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Darm32 45CWARNFLAGS?= -Werror -Wall -Wcomment -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 -D_LOCORE 54 55LOADADDRESS= 0xF0000000 56LINKFLAGS= -Ttext ${LOADADDRESS} -e start 57STRIPFLAGS= -g 58 59%INCLUDES 60 61HOSTED_CC= ${CC} 62HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 63HOSTED_CFLAGS= ${CFLAGS} 64 65### find out what to use for libkern 66KERN_AS= obj 67.include "$S/lib/libkern/Makefile.inc" 68.ifndef PROF 69LIBKERN= ${KERNLIB} 70.else 71LIBKERN= ${KERNLIB_PROF} 72.endif 73 74### find out what to use for libcompat 75.include "$S/compat/common/Makefile.inc" 76.ifndef PROF 77LIBCOMPAT= ${COMPATLIB} 78.else 79LIBCOMPAT= ${COMPATLIB_PROF} 80.endif 81 82# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 83# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 84 85NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 86NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 87NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 88 89HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 90 91%OBJS 92 93%CFILES 94 95%SFILES 96 97# load lines for config "xxx" will be emitted as: 98# xxx: ${SYSTEM_DEP} swapxxx.o 99# ${SYSTEM_LD_HEAD} 100# ${SYSTEM_LD} swapxxx.o 101# ${SYSTEM_LD_TAIL} 102.ifdef MONITOR 103SYSTEM_OBJ= locore.o modedefs.o \ 104 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 105.else 106SYSTEM_OBJ= locore.o \ 107 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 108.endif 109SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 110SYSTEM_LD_HEAD= rm -f $@ 111SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 112 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 113SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 114 115DEBUG?= 116.if ${DEBUG} == "-g" 117LINKFLAGS+= -X 118SYSTEM_LD_TAIL+=; \ 119 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 120 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 121 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 122.else 123#LINKFLAGS+= -S 124LINKFLAGS+= -x 125.endif 126 127%LOAD 128 129assym.h: $S/kern/genassym.sh ${ARM}/arm32/genassym.cf 130 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 131 < ${ARM}/arm32/genassym.cf > assym.h.tmp && \ 132 mv -f assym.h.tmp assym.h 133 134param.c: $S/conf/param.c 135 rm -f param.c 136 cp $S/conf/param.c . 137 138param.o: param.c Makefile 139 ${NORMAL_C} 140 141ioconf.o: ioconf.c 142 ${NORMAL_C} 143 144newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 145 sh $S/conf/newvers.sh 146 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 147 148__CLEANKERNEL: .USE 149 @echo "${.TARGET}ing the kernel objects" 150 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 151 [Ee]rrs linterrs makelinks assym.h.tmp assym.h modedefs.c 152 153__CLEANDEPEND: .USE 154 rm -f .depend 155 156clean: __CLEANKERNEL 157 158cleandir distclean: __CLEANKERNEL __CLEANDEPEND 159 160lint: 161 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 162 ${ARM}/arm32/Locore.c ${CFILES} \ 163 ioconf.c param.c | \ 164 grep -v 'static function .* unused' 165 166tags: 167 @echo "see $S/kern/Makefile for tags" 168 169links: 170 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 171 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 172 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 173 sort -u | comm -23 - dontlink | \ 174 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 175 sh makelinks && rm -f dontlink 176 177SRCS= ${ARM}/arm32/locore.S param.c ioconf.c ${CFILES} ${SFILES} 178.ifdef MONITOR 179SRCS+= modedefs.c 180.endif 181depend: .depend 182.depend: ${SRCS} assym.h param.c 183 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${ARM}/arm32/locore.S 184 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 185 test -z "${SFILES}" || ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 186 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 187 ${CPPFLAGS} < ${ARM}/arm32/genassym.cf 188 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 189 @rm -f assym.dep 190.ifdef MONITOR 191 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} modedefs.c 192.endif 193 194dependall: depend all 195 196 197# depend on root or device configuration 198autoconf.o conf.o: Makefile 199 200# depend on network 201uipc_proto.o: Makefile 202 203# depend on maxusers 204assym.h: Makefile 205 206# depend on CPU configuration 207cpufunc.o cpufunc_asm.o: Makefile 208 209# depend on DIAGNOSTIC etc. 210cpuswitch.o fault.o machdep.o: Makefile 211 212 213locore.o: ${ARM}/arm32/locore.S assym.h 214 ${NORMAL_S} 215 216modedefs.c: ${ARM}/iomd/makemodes.awk ${ACORN32}/conf/monitors/${MONITOR} Makefile 217 awk -f ${ARM}/iomd/makemodes.awk ${ACORN32}/conf/monitors/${MONITOR} ${MODES} >modedefs.c 218 219modedefs.o: modedefs.c 220 ${NORMAL_C} 221 222# The install target can be redefined by putting a 223# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 224MACHINE_NAME!= uname -n 225install: install-kernel-${MACHINE_NAME} 226.if !target(install-kernel-${MACHINE_NAME}}) 227install-kernel-${MACHINE_NAME}: 228 rm -f /onetbsd 229 ln /netbsd /onetbsd 230 cp netbsd /nnetbsd 231 mv /nnetbsd /netbsd 232.endif 233 234%RULES 235