Makefile.alpha revision 1.39
1# $NetBSD: Makefile.alpha,v 1.39 1997/11/12 22:25:31 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/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 24CC?= cc 25CPP?= cpp 26LD?= ld 27LORDER?=lorder 28MKDEP?= mkdep 29NM?= nm 30SIZE?= size 31STRIP?= strip 32TSORT?= tsort -q 33 34# source tree is located via $S relative to the compilation directory 35.ifndef S 36S!= cd ../../../..; pwd 37.endif 38ALPHA= $S/arch/alpha 39 40INCLUDES= -I. -I$S/arch -I$S -nostdinc 41CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \ 42 -Dalpha 43COPTS?= -O2 44CWARNFLAGS?= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 45 -Wno-format 46CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -mno-fp-regs 47AFLAGS= -traditional -D_LOCORE 48LOADADDRESS?= fffffc0000230000 49LINKFLAGS= -N -Ttext ${LOADADDRESS} -e __transfer -G 4 50STRIPFLAGS= -g -X -x 51 52### find out what to use for libkern 53.include "$S/lib/libkern/Makefile.inc" 54.ifndef PROF 55LIBKERN= ${KERNLIB} 56.else 57LIBKERN= ${KERNLIB_PROF} 58.endif 59 60### find out what to use for libcompat 61.include "$S/compat/common/Makefile.inc" 62.ifndef PROF 63LIBCOMPAT= ${COMPATLIB} 64.else 65LIBCOMPAT= ${COMPATLIB_PROF} 66.endif 67 68# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 69# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 70 71NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 72NORMAL_S= ${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's,^\#.*,,' | ${AS} -o ${.TARGET} 73 74%OBJS 75 76%CFILES 77 78%SFILES 79 80# load lines for config "xxx" will be emitted as: 81# xxx: ${SYSTEM_DEP} swapxxx.o 82# ${SYSTEM_LD_HEAD} 83# ${SYSTEM_LD} swapxxx.o 84# ${SYSTEM_LD_TAIL} 85SYSTEM_OBJ= locore.o transfer.o \ 86 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 87SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 88SYSTEM_LD_HEAD= @rm -f $@ 89SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 90 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 91SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 92 93DEBUG?= 94.if ${DEBUG} == "-g" 95LINKFLAGS+= -X 96SYSTEM_LD_TAIL+=; \ 97 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 98 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 99.else 100LINKFLAGS+= -S 101.endif 102 103%LOAD 104 105# Use awk to cross-build assym.h from the genassym.s file. 106assym.h: genassym.o $S/kern/genassym.awk 107 awk -f $S/kern/genassym.awk < genassym.s > $@ 108 109# The above rule lists genassym.o as a prerequisite so that the 110# generated .depend rule is effective, even though we actually 111# use genassym.s instead. This always creates both. 112genassym.o: ${ALPHA}/alpha/genassym.c 113 ${CC} ${CPPFLAGS} -S $< 114 ${CC} -c $*.s 115 116param.c: $S/conf/param.c 117 rm -f param.c 118 cp $S/conf/param.c . 119 120param.o: param.c Makefile 121 ${NORMAL_C} 122 123ioconf.o: ioconf.c 124 ${NORMAL_C} 125 126newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 127 sh $S/conf/newvers.sh 128 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 129 130 131__CLEANKERNEL: .USE 132 @echo "${.TARGET}ing the kernel objects" 133 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 134 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 135 136__CLEANDEPEND: .USE 137 rm -f .depend 138 139clean: __CLEANKERNEL 140 141cleandir: __CLEANKERNEL __CLEANDEPEND 142 143lint: 144 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 145 ${ALPHA}/alpha/Locore.c ${CFILES} \ 146 ioconf.c param.c | \ 147 grep -v 'static function .* unused' 148 149tags: 150 @echo "see $S/kern/Makefile for tags" 151 152links: 153 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 154 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 155 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 156 sort -u | comm -23 - dontlink | \ 157 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 158 sh makelinks && rm -f dontlink 159 160SRCS= ${ALPHA}/alpha/locore.s ${ALPHA}/alpha/transfer.s \ 161 param.c ioconf.c ${CFILES} ${SFILES} 162depend: .depend 163.depend: ${SRCS} assym.h param.c 164 ${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \ 165 ${ALPHA}/alpha/locore.s 166 ${MKDEP} -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} \ 167 ${ALPHA}/alpha/transfer.s 168 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 169 ${MKDEP} -a -x assembler-with-cpp ${AFLAGS} ${CPPFLAGS} ${SFILES} 170 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} ${ALPHA}/alpha/genassym.c 171 172 173# depend on root or device configuration 174autoconf.o conf.o: Makefile 175 176# depend on network or filesystem configuration 177uipc_proto.o vfs_conf.o: Makefile 178 179# depend on maxusers 180genassym.o machdep.o: Makefile 181 182# depend on CPU configuration 183clock.o machdep.o apecs.o cia.o lca.o ioasic.o scc.o icasic.o: Makefile 184 185locore.o: ${ALPHA}/alpha/locore.s assym.h 186 ${NORMAL_S} 187 188transfer.o: ${ALPHA}/alpha/transfer.s 189 ${NORMAL_S} 190 191%RULES 192