Makefile.alpha revision 1.61
1# $NetBSD: Makefile.alpha,v 1.61 2000/12/07 17:32:33 jdolecek 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/alpha/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/alpha/conf/Makefile.alpha 13# after which config should be rerun for all machines of that type. 14# 15# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 16# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 17# 18# -DTRACE compile in kernel tracing hooks 19# -DQUOTA compile in file system quotas 20 21# DEBUG is set to -g if debugging. 22# PROF is set to -pg if profiling. 23 24AR?= ar 25AS?= as 26CC?= cc 27CPP?= cpp 28LD?= ld 29LORDER?=lorder 30MKDEP?= mkdep 31NM?= nm 32RANLIB?=ranlib 33SIZE?= size 34STRIP?= strip 35TSORT?= tsort -q 36 37# source tree is located via $S relative to the compilation directory 38.ifndef S 39S!= cd ../../../..; pwd 40.endif 41ALPHA= $S/arch/alpha 42 43HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 44INCLUDES= -I. -I$S/arch -I$S -nostdinc 45CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dalpha 46COPTS?= -O2 47CWARNFLAGS?= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 48 -Wpointer-arith 49# XXX Delete -Wuninitialized for now, since the compiler doesn't 50# XXX always get it right. --thorpej 51CWARNFLAGS+= -Wno-uninitialized 52.if (${HAVE_EGCS} != "") 53CWARNFLAGS+= -Wno-main 54.endif 55CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -mno-fp-regs 56AFLAGS= -traditional -D_LOCORE 57LOADADDRESS?= fffffc0000300000 58LINKFLAGS= -N -Ttext ${LOADADDRESS} -e __transfer -G 4 59STRIPFLAGS= -g -X 60 61%INCLUDES 62 63### find out what to use for libkern 64.include "$S/lib/libkern/Makefile.inc" 65.ifndef PROF 66LIBKERN= ${KERNLIB} 67.else 68LIBKERN= ${KERNLIB_PROF} 69.endif 70 71### find out what to use for libcompat 72.include "$S/compat/common/Makefile.inc" 73.ifndef PROF 74LIBCOMPAT= ${COMPATLIB} 75.else 76LIBCOMPAT= ${COMPATLIB_PROF} 77.endif 78 79# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 80# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 81 82NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 83NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 84NORMAL_S= ${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's,^\#.*,,' | ${AS} -o ${.TARGET} 85 86%OBJS 87 88%CFILES 89 90%SFILES 91 92# load lines for config "xxx" will be emitted as: 93# xxx: ${SYSTEM_DEP} swapxxx.o 94# ${SYSTEM_LD_HEAD} 95# ${SYSTEM_LD} swapxxx.o 96# ${SYSTEM_LD_TAIL} 97SYSTEM_OBJ= locore.o transfer.o \ 98 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 99SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 100SYSTEM_LD_HEAD= @rm -f $@ 101SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 102 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 103SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 104 105DEBUG?= 106.if ${DEBUG} == "-g" 107LINKFLAGS+= -X 108SYSTEM_LD_TAIL+=; \ 109 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 110 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 111 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 112.else 113LINKFLAGS+= -S 114.endif 115 116%LOAD 117 118# Use awk to cross-build assym.h from the genassym.s file. 119assym.h: $S/kern/genassym.sh ${ALPHA}/alpha/genassym.cf 120 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 121 < ${ALPHA}/alpha/genassym.cf > assym.h.tmp && \ 122 mv -f assym.h.tmp assym.h 123 124param.c: $S/conf/param.c 125 rm -f param.c 126 cp $S/conf/param.c . 127 128param.o: param.c Makefile 129 ${NORMAL_C} 130 131ioconf.o: ioconf.c 132 ${NORMAL_C} 133 134newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 135 sh $S/conf/newvers.sh 136 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 137 138 139__CLEANKERNEL: .USE 140 @echo "${.TARGET}ing the kernel objects" 141 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 142 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 143 144__CLEANDEPEND: .USE 145 rm -f .depend 146 147clean: __CLEANKERNEL 148 149cleandir distclean: __CLEANKERNEL __CLEANDEPEND 150 151lint: 152 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 153 ${ALPHA}/alpha/Locore.c ${CFILES} \ 154 ioconf.c param.c | \ 155 grep -v 'static function .* unused' 156 157tags: 158 @echo "see $S/kern/Makefile for tags" 159 160links: 161 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 162 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 163 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 164 sort -u | comm -23 - dontlink | \ 165 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 166 sh makelinks && rm -f dontlink 167 168SRCS= ${ALPHA}/alpha/locore.s ${ALPHA}/alpha/transfer.s \ 169 param.c ioconf.c ${CFILES} ${SFILES} 170depend: .depend 171.depend: ${SRCS} assym.h param.c 172 ${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \ 173 ${ALPHA}/alpha/locore.s 174 ${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \ 175 ${ALPHA}/alpha/transfer.s 176 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 177 test -z "${SFILES}" || \ 178 ${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES} 179 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 180 ${CPPFLAGS} < ${ALPHA}/alpha/genassym.cf 181 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 182 @rm -f assym.dep 183 184dependall: depend all 185 186 187# depend on root or device configuration 188autoconf.o conf.o: Makefile 189 190# depend on network or filesystem configuration 191uipc_proto.o vfs_conf.o: Makefile 192 193# depend on maxusers 194assym.h machdep.o: Makefile 195 196# depend on CPU configuration 197clock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile 198 199locore.o: ${ALPHA}/alpha/locore.s assym.h 200 ${NORMAL_S} 201 202transfer.o: ${ALPHA}/alpha/transfer.s 203 ${NORMAL_S} 204 205# The install target can be redefined by putting a 206# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 207MACHINE_NAME!= uname -n 208install: install-kernel-${MACHINE_NAME} 209.if !target(install-kernel-${MACHINE_NAME}}) 210install-kernel-${MACHINE_NAME}: 211 rm -f /onetbsd 212 ln /netbsd /onetbsd 213 cp netbsd /nnetbsd 214 mv /nnetbsd /netbsd 215.endif 216 217%RULES 218