Makefile.powerpc revision 1.9
1# $NetBSD: Makefile.powerpc,v 1.9 1997/09/30 22:56:18 christos 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} ${PARAM} -D_KERNEL \ 41 -Dpowerpc 42CWARNFLAGS= -Werror -Wreturn-type 43CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float 44AFLAGS= -D_LOCORE 45LINKFLAGS= -N -Ttext 100000 -e __start 46STRIPFLAGS= --strip-debug 47 48### find out what to use for libkern 49.include "$S/lib/libkern/Makefile.inc" 50.ifndef PROF 51LIBKERN= ${KERNLIB} 52.else 53LIBKERN= ${KERNLIB_PROF} 54.endif 55 56### find out what to use for libcompat 57.include "$S/compat/common/Makefile.inc" 58.ifndef PROF 59LIBCOMPAT= ${COMPATLIB} 60.else 61LIBCOMPAT= ${COMPATLIB_PROF} 62.endif 63 64# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 65# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 66 67NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 68 69NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 70 71#.c.o: 72# ${NORMAL_C} 73# 74#.S.o: 75# ${NORMAL_S} 76 77%OBJS 78 79%CFILES 80 81%SFILES 82 83# load lines for config "xxx" will be emitted as: 84# xxx: ${SYSTEM_DEP} swapxxx.o 85# ${SYSTEM_LD_HEAD} 86# ${SYSTEM_LD} swapxxx.o 87# ${SYSTEM_LD_TAIL} 88SYSTEM_OBJ= locore.o \ 89 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 90SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 91SYSTEM_LD_HEAD= rm -f $@ 92SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 93 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 94SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 95 96DEBUG?= 97.if ${DEBUG} == "-g" 98LINKFLAGS+= -X 99SYSTEM_LD_TAIL+=; \ 100 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 101 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 102.else 103LINKFLAGS+= -S 104.endif 105 106%LOAD 107 108assym.h: $S/kern/genassym.sh ${PPC}/powerpc/genassym.cf 109 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 110 < ${PPC}/powerpc/genassym.cf > assym.h.tmp && \ 111 mv -f assym.h.tmp assym.h 112 113param.c: $S/conf/param.c 114 rm -f param.c 115 cp $S/conf/param.c . 116 117param.o: param.c Makefile 118 ${NORMAL_C} 119 120ioconf.o: ioconf.c 121 ${NORMAL_C} 122 123newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 124 sh $S/conf/newvers.sh 125 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 126 127__CLEANKERNEL: .USE 128 @echo "${.TARGET}ing the kernel objects" 129 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 130 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 131 132__CLEANDEPEND: .USE 133 rm -f .depend 134 135clean: __CLEANKERNEL 136 137cleandir: __CLEANKERNEL __CLEANDEPEND 138 139lint: 140 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 141 ${PPC}/powerpc/Locore.c ${CFILES} \ 142 ioconf.c param.c | \ 143 grep -v 'static function .* unused' 144 145tags: 146 @echo "see $S/kern/Makefile for tags" 147 148links: 149 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 150 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 151 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 152 sort -u | comm -23 - dontlink | \ 153 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 154 sh makelinks && rm -f dontlink 155 156SRCS= ${PPC}/powerpc/locore.S \ 157 param.c ioconf.c ${CFILES} ${SFILES} 158depend: .depend 159.depend: ${SRCS} assym.h param.c 160 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S 161 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 162.if ${SFILES} != "" 163 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 164.endif 165 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 166 ${CPPFLAGS} < ${PPC}/powerpc/genassym.cf 167 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 168 @rm -f assym.dep 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 177machdep.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