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