Makefile.powerpc revision 1.10
1# $NetBSD: Makefile.powerpc,v 1.10 1997/11/12 22:26:27 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/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 28LORDER?=lorder 29MKDEP?= mkdep 30NM?= nm 31SIZE?= size 32STRIP?= strip 33TSORT?= tsort -q 34COPTS?= -O2 35 36# source tree is located via $S relative to the compilation directory 37.ifndef S 38S!= cd ../../../..; pwd 39.endif 40PPC= $S/arch/powerpc 41 42INCLUDES= -I. -I$S/arch -I$S -nostdinc 43CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \ 44 -Dpowerpc 45CWARNFLAGS= -Werror -Wreturn-type 46CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float 47AFLAGS= -D_LOCORE 48LINKFLAGS= -N -Ttext 100000 -e __start 49STRIPFLAGS= --strip-debug 50 51### find out what to use for libkern 52.include "$S/lib/libkern/Makefile.inc" 53.ifndef PROF 54LIBKERN= ${KERNLIB} 55.else 56LIBKERN= ${KERNLIB_PROF} 57.endif 58 59### find out what to use for libcompat 60.include "$S/compat/common/Makefile.inc" 61.ifndef PROF 62LIBCOMPAT= ${COMPATLIB} 63.else 64LIBCOMPAT= ${COMPATLIB_PROF} 65.endif 66 67# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 68# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 69 70NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 71 72NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 73 74#.c.o: 75# ${NORMAL_C} 76# 77#.S.o: 78# ${NORMAL_S} 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 \ 92 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 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 cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 104 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 105.else 106LINKFLAGS+= -S 107.endif 108 109%LOAD 110 111assym.h: $S/kern/genassym.sh ${PPC}/powerpc/genassym.cf 112 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 113 < ${PPC}/powerpc/genassym.cf > assym.h.tmp && \ 114 mv -f assym.h.tmp assym.h 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__CLEANKERNEL: .USE 131 @echo "${.TARGET}ing the kernel objects" 132 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 133 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 134 135__CLEANDEPEND: .USE 136 rm -f .depend 137 138clean: __CLEANKERNEL 139 140cleandir: __CLEANKERNEL __CLEANDEPEND 141 142lint: 143 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 144 ${PPC}/powerpc/Locore.c ${CFILES} \ 145 ioconf.c param.c | \ 146 grep -v 'static function .* unused' 147 148tags: 149 @echo "see $S/kern/Makefile for tags" 150 151links: 152 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 153 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 154 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 155 sort -u | comm -23 - dontlink | \ 156 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 157 sh makelinks && rm -f dontlink 158 159SRCS= ${PPC}/powerpc/locore.S \ 160 param.c ioconf.c ${CFILES} ${SFILES} 161depend: .depend 162.depend: ${SRCS} assym.h param.c 163 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S 164 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 165.if ${SFILES} != "" 166 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 167.endif 168 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 169 ${CPPFLAGS} < ${PPC}/powerpc/genassym.cf 170 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 171 @rm -f assym.dep 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 180machdep.o: Makefile 181 182# depend on CPU configuration 183locore.o machdep.o: Makefile 184 185 186locore.o: ${PPC}/powerpc/locore.S assym.h 187 ${NORMAL_S} 188 189%RULES 190