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 26 CC?= cc 27 LD?= ld 28 MKDEP?= mkdep 29 STRIP?= strip 30 SIZE?= size 31 COPTS?= -O2 32 33 # source tree is located via $S relative to the compilation directory 34 .ifndef S 35 S!= cd ../../../..; pwd 36 .endif 37 PPC= $S/arch/powerpc 38 39 INCLUDES= -I. -I$S/arch -I$S -nostdinc 40 CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \ 41 -Dpowerpc 42 CWARNFLAGS= -Werror -Wreturn-type 43 CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float 44 AFLAGS= -D_LOCORE 45 LINKFLAGS= -N -Ttext 100000 -e __start 46 STRIPFLAGS= --strip-debug 47 48 ### find out what to use for libkern 49 .include "$S/lib/libkern/Makefile.inc" 50 .ifndef PROF 51 LIBKERN= ${KERNLIB} 52 .else 53 LIBKERN= ${KERNLIB_PROF} 54 .endif 55 56 ### find out what to use for libcompat 57 .include "$S/compat/common/Makefile.inc" 58 .ifndef PROF 59 LIBCOMPAT= ${COMPATLIB} 60 .else 61 LIBCOMPAT= ${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 67 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 68 69 NORMAL_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} 88 SYSTEM_OBJ= locore.o \ 89 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 90 SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 91 SYSTEM_LD_HEAD= rm -f $@ 92 SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 93 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 94 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 95 96 DEBUG?= 97 .if ${DEBUG} == "-g" 98 LINKFLAGS+= -X 99 SYSTEM_LD_TAIL+=; \ 100 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 101 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 102 .else 103 LINKFLAGS+= -S 104 .endif 105 106 %LOAD 107 108 assym.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 113 param.c: $S/conf/param.c 114 rm -f param.c 115 cp $S/conf/param.c . 116 117 param.o: param.c Makefile 118 ${NORMAL_C} 119 120 ioconf.o: ioconf.c 121 ${NORMAL_C} 122 123 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 124 sh $S/conf/newvers.sh 125 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 126 127 clean: cleankernel 128 cleankernel: 129 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 130 [Ee]rrs linterrs makelinks assym.h 131 132 lint: 133 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 134 ${PPC}/powerpc/Locore.c ${CFILES} \ 135 ioconf.c param.c | \ 136 grep -v 'static function .* unused' 137 138 tags: 139 @echo "see $S/kern/Makefile for tags" 140 141 links: 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 149 SRCS= ${PPC}/powerpc/locore.S \ 150 param.c ioconf.c ${CFILES} ${SFILES} 151 depend: .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 164 autoconf.o conf.o: Makefile 165 166 # depend on network or filesystem configuration 167 uipc_proto.o vfs_conf.o: Makefile 168 169 # depend on maxusers 170 machdep.o: Makefile 171 172 # depend on CPU configuration 173 locore.o machdep.o: Makefile 174 175 176 locore.o: ${PPC}/powerpc/locore.S assym.h 177 ${NORMAL_S} 178 179 %RULES 180