Makefile.alpha revision 1.58
1# $NetBSD: Makefile.alpha,v 1.58 2000/05/09 00:56:21 hubertf 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: genassym.o $S/kern/genassym.awk 120 awk -f $S/kern/genassym.awk < genassym.s > $@ 121 122# The above rule lists genassym.o as a prerequisite so that the 123# generated .depend rule is effective, even though we actually 124# use genassym.s instead. This always creates both. 125genassym.o: ${ALPHA}/alpha/genassym.c 126 ${CC} ${CPPFLAGS} -S $< 127 ${CC} -c $*.s 128 129param.c: $S/conf/param.c 130 rm -f param.c 131 cp $S/conf/param.c . 132 133param.o: param.c Makefile 134 ${NORMAL_C} 135 136ioconf.o: ioconf.c 137 ${NORMAL_C} 138 139newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 140 sh $S/conf/newvers.sh 141 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 142 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 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 ${ALPHA}/alpha/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= ${ALPHA}/alpha/locore.s ${ALPHA}/alpha/transfer.s \ 174 param.c ioconf.c ${CFILES} ${SFILES} 175depend: .depend 176.depend: ${SRCS} assym.h param.c 177 ${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \ 178 ${ALPHA}/alpha/locore.s 179 ${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \ 180 ${ALPHA}/alpha/transfer.s 181 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 182 test -z "${SFILES}" || \ 183 ${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES} 184 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/genassym.c 185 186dependall: depend all 187 188 189# depend on root or device configuration 190autoconf.o conf.o: Makefile 191 192# depend on network or filesystem configuration 193uipc_proto.o vfs_conf.o: Makefile 194 195# depend on maxusers 196genassym.o machdep.o: Makefile 197 198# depend on CPU configuration 199clock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile 200 201locore.o: ${ALPHA}/alpha/locore.s assym.h 202 ${NORMAL_S} 203 204transfer.o: ${ALPHA}/alpha/transfer.s 205 ${NORMAL_S} 206 207# The install target can be redefined by putting a 208# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 209MACHINE_NAME!= uname -n 210install: install-kernel-${MACHINE_NAME} 211.if !target(install-kernel-${MACHINE_NAME}}) 212install-kernel-${MACHINE_NAME}: 213 rm -f /onetbsd 214 ln /netbsd /onetbsd 215 cp netbsd /nnetbsd 216 mv /nnetbsd /netbsd 217.endif 218 219%RULES 220