Makefile.powerpc revision 1.8
1# $NetBSD: Makefile.powerpc,v 1.8 1997/07/12 22:08:04 leo 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 127clean: cleankernel 128cleankernel: 129 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 130 [Ee]rrs linterrs makelinks assym.h 131 132lint: 133 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 134 ${PPC}/powerpc/Locore.c ${CFILES} \ 135 ioconf.c param.c | \ 136 grep -v 'static function .* unused' 137 138tags: 139 @echo "see $S/kern/Makefile for tags" 140 141links: 142 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 143 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 144 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 145 sort -u | comm -23 - dontlink | \ 146 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 147 sh makelinks && rm -f dontlink 148 149SRCS= ${PPC}/powerpc/locore.S \ 150 param.c ioconf.c ${CFILES} ${SFILES} 151depend: .depend 152.depend: ${SRCS} assym.h param.c 153 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S 154 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 155.if ${SFILES} != "" 156 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 157.endif 158 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 159 ${CPPFLAGS} < ${PPC}/powerpc/genassym.cf 160 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 161 @rm -f assym.dep 162 163# depend on root or device configuration 164autoconf.o conf.o: Makefile 165 166# depend on network or filesystem configuration 167uipc_proto.o vfs_conf.o: Makefile 168 169# depend on maxusers 170machdep.o: Makefile 171 172# depend on CPU configuration 173locore.o machdep.o: Makefile 174 175 176locore.o: ${PPC}/powerpc/locore.S assym.h 177 ${NORMAL_S} 178 179%RULES 180