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 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} -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= -d 47 48 HOSTD_CC= ${CC} 49 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 50 HOSTED_CFLAGS= ${CFLAGS} 51 52 ### find out what to use for libkern 53 .include "$S/lib/libkern/Makefile.inc" 54 .ifndef PROF 55 LIBKERN= ${KERNLIB} 56 .else 57 LIBKERN= ${KERNLIB_PROF} 58 .endif 59 60 ### find out what to use for libcompat 61 .include "$S/compat/common/Makefile.inc" 62 .ifndef PROF 63 LIBCOMPAT= ${COMPATLIB} 64 .else 65 LIBCOMPAT= ${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 71 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 72 73 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 74 75 HOSTED_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} 94 SYSTEM_OBJ= locore.o \ 95 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 96 SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 97 SYSTEM_LD_HEAD= rm -f $@ 98 SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 99 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 100 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 101 102 DEBUG?= 103 .if ${DEBUG} == "-g" 104 LINKFLAGS+= -X 105 SYSTEM_LD_TAIL+=; \ 106 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 107 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 108 .else 109 LINKFLAGS+= -S 110 .endif 111 112 %LOAD 113 114 assym.h: genassym 115 ./genassym > assym.h 116 117 genassym: genassym.o 118 ${HOSTED_CC} -o $@ genassym.o 119 120 genassym.o: ${PPC}/powerpc/genassym.c 121 ${HOSTED_C} 122 123 param.c: $S/conf/param.c 124 rm -f param.c 125 cp $S/conf/param.c . 126 127 param.o: param.c Makefile 128 ${NORMAL_C} 129 130 ioconf.o: ioconf.c 131 ${NORMAL_C} 132 133 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 134 sh $S/conf/newvers.sh 135 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 136 137 clean:: 138 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 139 [Ee]rrs linterrs makelinks genassym genassym.o assym.h 140 141 lint: 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 147 tags: 148 @echo "see $S/kern/Makefile for tags" 149 150 links: 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 158 SRCS= ${PPC}/powerpc/locore.S \ 159 param.c ioconf.c ${CFILES} ${SFILES} 160 depend:: .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 171 autoconf.o conf.o: Makefile 172 173 # depend on network or filesystem configuration 174 uipc_proto.o vfs_conf.o: Makefile 175 176 # depend on maxusers 177 genassym.o machdep.o: Makefile 178 179 # depend on CPU configuration 180 locore.o machdep.o: Makefile 181 182 183 locore.o: ${PPC}/powerpc/locore.S assym.h 184 ${NORMAL_S} 185 186 %RULES 187