Makefile.powerpc revision 1.3
1# $NetBSD: Makefile.powerpc,v 1.3 1997/02/04 04:32:18 perry 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/powerpc/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/powerpc/conf/Makefile.powerpc 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.SUFFIXES: .S .c .o 22 23# DEBUG is set to -g if debugging. 24# PROF is set to -pg if profiling. 25 26CC?= cc 27LD?= ld 28MKDEP?= mkdep 29STRIP?= strip 30SIZE?= size 31COPTS?= -O2 32 33# source tree is located via $S relative to the compilation directory 34.ifndef S 35S!= cd ../../../..; pwd 36.endif 37PPC= $S/arch/powerpc 38 39INCLUDES= -I. -I$S/arch -I$S -nostdinc 40CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL \ 41 -Dpowerpc 42CWARNFLAGS= -Werror -Wreturn-type 43CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float 44AFLAGS= -D_LOCORE 45LINKFLAGS= -N -Ttext 100000 -e start 46STRIPFLAGS= -d 47 48HOSTD_CC= ${CC} 49HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 50HOSTED_CFLAGS= ${CFLAGS} 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 $< 72 73NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 74 75HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 76 77#.c.o: 78# ${NORMAL_C} 79# 80#.S.o: 81# ${NORMAL_S} 82 83%OBJS 84 85%CFILES 86 87%SFILES 88 89# load lines for config "xxx" will be emitted as: 90# xxx: ${SYSTEM_DEP} swapxxx.o 91# ${SYSTEM_LD_HEAD} 92# ${SYSTEM_LD} swapxxx.o 93# ${SYSTEM_LD_TAIL} 94SYSTEM_OBJ= locore.o \ 95 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 96SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 97SYSTEM_LD_HEAD= rm -f $@ 98SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 99 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 100SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 101 102DEBUG?= 103.if ${DEBUG} == "-g" 104LINKFLAGS+= -X 105SYSTEM_LD_TAIL+=; \ 106 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 107 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 108.else 109LINKFLAGS+= -S 110.endif 111 112%LOAD 113 114assym.h: genassym 115 ./genassym > assym.h 116 117genassym: genassym.o 118 ${HOSTED_CC} -o $@ genassym.o 119 120genassym.o: ${PPC}/powerpc/genassym.c 121 ${HOSTED_C} 122 123param.c: $S/conf/param.c 124 rm -f param.c 125 cp $S/conf/param.c . 126 127param.o: param.c Makefile 128 ${NORMAL_C} 129 130ioconf.o: ioconf.c 131 ${NORMAL_C} 132 133newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 134 sh $S/conf/newvers.sh 135 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 136 137clean:: 138 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 139 [Ee]rrs linterrs makelinks genassym genassym.o assym.h 140 141lint: 142 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 143 ${PPC}/powerpc/Locore.c ${CFILES} ${PPC}/powerpc/swapgeneric.c \ 144 ioconf.c param.c | \ 145 grep -v 'static function .* unused' 146 147tags: 148 @echo "see $S/kern/Makefile for tags" 149 150links: 151 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 152 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 153 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 154 sort -u | comm -23 - dontlink | \ 155 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 156 sh makelinks && rm -f dontlink 157 158SRCS= ${PPC}/powerpc/locore.S \ 159 param.c ioconf.c ${CFILES} ${SFILES} 160depend:: .depend 161.depend: ${SRCS} assym.h param.c 162 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S 163 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 164.if ${SFILES} != "" 165 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 166.endif 167 ${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \ 168 ${PPC}/powerpc/genassym.c 169 170# depend on root or device configuration 171autoconf.o conf.o: Makefile 172 173# depend on network or filesystem configuration 174uipc_proto.o vfs_conf.o: Makefile 175 176# depend on maxusers 177genassym.o machdep.o: Makefile 178 179# depend on CPU configuration 180locore.o machdep.o: Makefile 181 182 183locore.o: ${PPC}/powerpc/locore.S assym.h 184 ${NORMAL_S} 185 186%RULES 187