1 # $NetBSD: Makefile.powerpc,v 1.1 1996/09/30 16:34:18 ws 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 32 # source tree is located via $S relative to the compilation directory 33 .ifndef S 34 S!= cd ../../../..; pwd 35 .endif 36 PPC= $S/arch/powerpc 37 38 INCLUDES= -I. -I$S/arch -I$S -nostdinc 39 CPPFLAGS= ${INCLUDES} ${IDENT} -D_KERNEL \ 40 -Dpowerpc 41 CWARNFLAGS= -Werror -Wreturn-type 42 CFLAGS= ${DEBUG} ${CWARNFLAGS} -O2 -msoft-float 43 AFLAGS= -D_LOCORE 44 LINKFLAGS= -N -Ttext 100000 -e start 45 STRIPFLAGS= -d 46 47 HOSTD_CC= ${CC} 48 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 49 HOSTED_CFLAGS= ${CFLAGS} 50 51 ### find out what to use for libkern 52 .include "$S/lib/libkern/Makefile.inc" 53 .ifndef PROF 54 LIBKERN= ${KERNLIB} 55 .else 56 LIBKERN= ${KERNLIB_PROF} 57 .endif 58 59 ### find out what to use for libcompat 60 .include "$S/compat/common/Makefile.inc" 61 .ifndef PROF 62 LIBCOMPAT= ${COMPATLIB} 63 .else 64 LIBCOMPAT= ${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 70 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 71 72 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 73 74 HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 75 76 #.c.o: 77 # ${NORMAL_C} 78 # 79 #.S.o: 80 # ${NORMAL_S} 81 82 %OBJS 83 84 %CFILES 85 86 %SFILES 87 88 # load lines for config "xxx" will be emitted as: 89 # xxx: ${SYSTEM_DEP} swapxxx.o 90 # ${SYSTEM_LD_HEAD} 91 # ${SYSTEM_LD} swapxxx.o 92 # ${SYSTEM_LD_TAIL} 93 SYSTEM_OBJ= locore.o \ 94 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 95 SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 96 SYSTEM_LD_HEAD= rm -f $@ 97 SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 98 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 99 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 100 101 DEBUG?= 102 .if ${DEBUG} == "-g" 103 LINKFLAGS+= -X 104 SYSTEM_LD_TAIL+=; \ 105 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 106 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 107 .else 108 LINKFLAGS+= -S 109 .endif 110 111 %LOAD 112 113 assym.h: genassym 114 ./genassym > assym.h 115 116 genassym: genassym.o 117 ${HOSTED_CC} -o $@ genassym.o 118 119 genassym.o: ${PPC}/powerpc/genassym.c 120 ${HOSTED_C} 121 122 param.c: $S/conf/param.c 123 rm -f param.c 124 cp $S/conf/param.c . 125 126 param.o: param.c Makefile 127 ${NORMAL_C} 128 129 ioconf.o: ioconf.c 130 ${NORMAL_C} 131 132 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 133 sh $S/conf/newvers.sh 134 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 135 136 clean:: 137 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 138 [Ee]rrs linterrs makelinks genassym genassym.o assym.h 139 140 lint: 141 @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \ 142 ${PPC}/powerpc/Locore.c ${CFILES} ${PPC}/powerpc/swapgeneric.c \ 143 ioconf.c param.c | \ 144 grep -v 'static function .* unused' 145 146 tags: 147 @echo "see $S/kern/Makefile for tags" 148 149 links: 150 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 151 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 152 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 153 sort -u | comm -23 - dontlink | \ 154 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 155 sh makelinks && rm -f dontlink 156 157 SRCS= ${PPC}/powerpc/locore.S \ 158 param.c ioconf.c ${CFILES} ${SFILES} 159 depend:: .depend 160 .depend: ${SRCS} assym.h param.c 161 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${PPC}/powerpc/locore.S 162 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 163 .if ${SFILES} != "" 164 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 165 .endif 166 ${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \ 167 ${PPC}/powerpc/genassym.c 168 169 # depend on root or device configuration 170 autoconf.o conf.o: Makefile 171 172 # depend on network or filesystem configuration 173 uipc_proto.o vfs_conf.o: Makefile 174 175 # depend on maxusers 176 genassym.o machdep.o: Makefile 177 178 # depend on CPU configuration 179 locore.o machdep.o: Makefile 180 181 182 locore.o: ${PPC}/powerpc/locore.S assym.h 183 ${NORMAL_S} 184 185 %RULES 186