1 1.19 jmc # $NetBSD: Makefile.powerpc,v 1.19 2001/10/26 06:45:39 jmc Exp $ 2 1.1 ws # 3 1.1 ws # Makefile for NetBSD 4 1.1 ws # 5 1.1 ws # This makefile is constructed from a machine description: 6 1.1 ws # config machineid 7 1.1 ws # Most changes should be made in the machine description 8 1.1 ws # /sys/arch/powerpc/conf/``machineid'' 9 1.1 ws # after which you should do 10 1.1 ws # config machineid 11 1.1 ws # Machine generic makefile changes should be made in 12 1.1 ws # /sys/arch/powerpc/conf/Makefile.powerpc 13 1.1 ws # after which config should be rerun for all machines of that type. 14 1.1 ws # 15 1.1 ws # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 16 1.1 ws # IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 17 1.1 ws # 18 1.1 ws # -DTRACE compile in kernel tracing hooks 19 1.1 ws # -DQUOTA compile in file system quotas 20 1.18 thorpej 21 1.18 thorpej MACHINE_ARCH=powerpc 22 1.19 jmc USETOOLS?= no 23 1.14 matt 24 1.16 thorpej .include <bsd.own.mk> 25 1.1 ws 26 1.1 ws # DEBUG is set to -g if debugging. 27 1.1 ws # PROF is set to -pg if profiling. 28 1.1 ws 29 1.14 matt AR?= ar 30 1.14 matt AS?= as 31 1.14 matt CC?= cc 32 1.14 matt CPP?= cpp 33 1.14 matt LD?= ld 34 1.14 matt LORDER?= lorder 35 1.14 matt MKDEP?= mkdep 36 1.14 matt NM?= nm 37 1.14 matt OBJCOPY?= objcopy 38 1.14 matt OBJDUMP?= objdump 39 1.14 matt RANLIB?= ranlib 40 1.14 matt SIZE?= size 41 1.14 matt STRIP?= strip 42 1.14 matt TSORT?= tsort -q 43 1.11 thorpej 44 1.14 matt COPTS?= -O2 45 1.14 matt TEXTADDR?= 0x100000 46 1.1 ws 47 1.1 ws # source tree is located via $S relative to the compilation directory 48 1.14 matt .ifndef S 49 1.14 matt S!= cd ../../../..; pwd 50 1.1 ws .endif 51 1.17 thorpej THISPPC= $S/arch/${MACHINE} 52 1.14 matt POWERPC= $S/arch/powerpc 53 1.1 ws 54 1.1 ws INCLUDES= -I. -I$S/arch -I$S -nostdinc 55 1.14 matt CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} \ 56 1.17 thorpej -D_KERNEL -D_KERNEL_OPT -D${MACHINE} 57 1.14 matt CWARNFLAGS?= -Werror -Wall -Wreturn-type -Wpointer-arith -Wno-main \ 58 1.14 matt -Wmissing-prototypes -Wstrict-prototypes 59 1.14 matt # XXX Delete -Wuninitialized for now, since the compiler doesn't 60 1.14 matt # XXX always get it right. --thorpej 61 1.14 matt CWARNFLAGS+= -Wno-uninitialized 62 1.14 matt CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float ${CCPUOPTS} 63 1.14 matt AFLAGS= -D_LOCORE ${AOPTS} 64 1.14 matt LINKFLAGS= -N -Ttext ${TEXTADDR} -e __start 65 1.6 thorpej STRIPFLAGS= --strip-debug 66 1.15 simonb 67 1.17 thorpej .if exists(${THISPPC}/conf/Makefile.${MACHINE}.inc) 68 1.17 thorpej .include "${THISPPC}/conf/Makefile.${MACHINE}.inc" 69 1.15 simonb .endif 70 1.1 ws 71 1.14 matt %INCLUDES 72 1.14 matt 73 1.1 ws ### find out what to use for libkern 74 1.1 ws .include "$S/lib/libkern/Makefile.inc" 75 1.1 ws .ifndef PROF 76 1.1 ws LIBKERN= ${KERNLIB} 77 1.1 ws .else 78 1.1 ws LIBKERN= ${KERNLIB_PROF} 79 1.1 ws .endif 80 1.1 ws 81 1.1 ws ### find out what to use for libcompat 82 1.1 ws .include "$S/compat/common/Makefile.inc" 83 1.1 ws .ifndef PROF 84 1.1 ws LIBCOMPAT= ${COMPATLIB} 85 1.1 ws .else 86 1.1 ws LIBCOMPAT= ${COMPATLIB_PROF} 87 1.1 ws .endif 88 1.1 ws 89 1.1 ws # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 90 1.1 ws # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 91 1.1 ws 92 1.1 ws NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 93 1.14 matt NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 94 1.1 ws NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 95 1.1 ws 96 1.1 ws %OBJS 97 1.1 ws 98 1.1 ws %CFILES 99 1.1 ws 100 1.1 ws %SFILES 101 1.1 ws 102 1.1 ws # load lines for config "xxx" will be emitted as: 103 1.1 ws # xxx: ${SYSTEM_DEP} swapxxx.o 104 1.1 ws # ${SYSTEM_LD_HEAD} 105 1.1 ws # ${SYSTEM_LD} swapxxx.o 106 1.1 ws # ${SYSTEM_LD_TAIL} 107 1.1 ws SYSTEM_OBJ= locore.o \ 108 1.14 matt param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 109 1.1 ws SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 110 1.1 ws SYSTEM_LD_HEAD= rm -f $@ 111 1.1 ws SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 112 1.1 ws ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 113 1.1 ws SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 114 1.1 ws 115 1.1 ws DEBUG?= 116 1.1 ws .if ${DEBUG} == "-g" 117 1.1 ws LINKFLAGS+= -X 118 1.1 ws SYSTEM_LD_TAIL+=; \ 119 1.14 matt echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 120 1.14 matt echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 121 1.14 matt ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 122 1.1 ws .else 123 1.1 ws LINKFLAGS+= -S 124 1.1 ws .endif 125 1.14 matt .if defined(NEED_SREC) 126 1.14 matt SYSTEM_LD_TAIL+=; \ 127 1.14 matt ${OBJCOPY} -v -O srec $@ $@.srec 128 1.14 matt .endif 129 1.1 ws 130 1.1 ws %LOAD 131 1.1 ws 132 1.17 thorpej assym.h: $S/kern/genassym.sh ${THISPPC}/${MACHINE}/genassym.cf 133 1.6 thorpej sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 134 1.17 thorpej < ${THISPPC}/${MACHINE}/genassym.cf > assym.h.tmp && \ 135 1.6 thorpej mv -f assym.h.tmp assym.h 136 1.1 ws 137 1.1 ws param.c: $S/conf/param.c 138 1.1 ws rm -f param.c 139 1.1 ws cp $S/conf/param.c . 140 1.1 ws 141 1.1 ws param.o: param.c Makefile 142 1.1 ws ${NORMAL_C} 143 1.1 ws 144 1.1 ws ioconf.o: ioconf.c 145 1.1 ws ${NORMAL_C} 146 1.1 ws 147 1.1 ws newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 148 1.1 ws sh $S/conf/newvers.sh 149 1.1 ws ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 150 1.1 ws 151 1.9 christos __CLEANKERNEL: .USE 152 1.9 christos @echo "${.TARGET}ing the kernel objects" 153 1.1 ws rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 154 1.9 christos [Ee]rrs linterrs makelinks assym.h.tmp assym.h 155 1.9 christos 156 1.9 christos __CLEANDEPEND: .USE 157 1.9 christos rm -f .depend 158 1.9 christos 159 1.9 christos clean: __CLEANKERNEL 160 1.9 christos 161 1.14 matt cleandir distclean: __CLEANKERNEL __CLEANDEPEND 162 1.1 ws 163 1.1 ws lint: 164 1.3 perry @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 165 1.17 thorpej ${THISPPC}/${MACHINE}/Locore.c ${CFILES} \ 166 1.14 matt ioconf.c param.c | \ 167 1.14 matt grep -v 'static function .* unused' 168 1.1 ws 169 1.1 ws tags: 170 1.1 ws @echo "see $S/kern/Makefile for tags" 171 1.1 ws 172 1.1 ws links: 173 1.1 ws egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 174 1.1 ws sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 175 1.1 ws echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 176 1.1 ws sort -u | comm -23 - dontlink | \ 177 1.1 ws sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 178 1.1 ws sh makelinks && rm -f dontlink 179 1.1 ws 180 1.17 thorpej SRCS= ${THISPPC}/${MACHINE}/locore.S \ 181 1.1 ws param.c ioconf.c ${CFILES} ${SFILES} 182 1.6 thorpej depend: .depend 183 1.1 ws .depend: ${SRCS} assym.h param.c 184 1.17 thorpej ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${THISPPC}/${MACHINE}/locore.S 185 1.1 ws ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 186 1.1 ws .if ${SFILES} != "" 187 1.1 ws ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 188 1.1 ws .endif 189 1.8 leo sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 190 1.17 thorpej ${CPPFLAGS} < ${THISPPC}/${MACHINE}/genassym.cf 191 1.8 leo @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 192 1.8 leo @rm -f assym.dep 193 1.1 ws 194 1.14 matt dependall: depend all 195 1.14 matt 196 1.1 ws # depend on root or device configuration 197 1.1 ws autoconf.o conf.o: Makefile 198 1.1 ws 199 1.1 ws # depend on network or filesystem configuration 200 1.1 ws uipc_proto.o vfs_conf.o: Makefile 201 1.1 ws 202 1.1 ws # depend on maxusers 203 1.6 thorpej machdep.o: Makefile 204 1.1 ws 205 1.1 ws # depend on CPU configuration 206 1.1 ws locore.o machdep.o: Makefile 207 1.1 ws 208 1.17 thorpej locore.o: ${THISPPC}/${MACHINE}/locore.S assym.h 209 1.14 matt ${NORMAL_S} 210 1.1 ws 211 1.14 matt # The install target can be redefined by putting a 212 1.14 matt # install-kernel-${MACHINE_NAME} target into /etc/mk.conf 213 1.14 matt MACHINE_NAME!= uname -n 214 1.14 matt install: install-kernel-${MACHINE_NAME} 215 1.14 matt .if !target(install-kernel-${MACHINE_NAME}}) 216 1.14 matt install-kernel-${MACHINE_NAME}: 217 1.14 matt rm -f /onetbsd 218 1.14 matt ln /netbsd /onetbsd 219 1.14 matt cp netbsd /nnetbsd 220 1.14 matt mv /nnetbsd /netbsd 221 1.14 matt .endif 222 1.1 ws 223 1.1 ws %RULES 224