1 # $NetBSD: Makefile.x68k,v 1.46 2000/11/13 14:47:14 minoura 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/x68k/conf/``machineid'' 9 # after which you should do 10 # config machineid 11 # Machine generic makefile changes should be made in 12 # /sys/arch/x68k/conf/Makefile.x68k 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 .include <bsd.own.mk> 22 23 # DEBUG is set to -g if debugging. 24 # PROF is set to -pg if profiling. 25 26 AR?= ar 27 AS?= as 28 CC?= cc 29 CPP?= cpp 30 LD?= ld 31 LORDER?=lorder 32 MKDEP?= mkdep 33 NM?= nm 34 RANLIB?=ranlib 35 SIZE?= size 36 STRIP?= strip 37 TSORT?= tsort -q 38 39 COPTS?= -O2 40 41 # source tree is located via $S relative to the compilation directory 42 .ifndef S 43 S!= cd ../../../..; pwd 44 .endif 45 X68K= $S/arch/x68k 46 47 HAVE_EGCS!= ${CC} --version | egrep "^(2\.8|egcs)" ; echo 48 INCLUDES= -I. -I$S/arch -I$S -nostdinc 49 CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dx68k 50 51 M68060!= ( echo '\#include "opt_m680x0.h"'; \ 52 echo '\#ifdef M68060'; \ 53 echo '1'; \ 54 echo '\#else'; \ 55 echo '0'; \ 56 echo '\#endif' ) \ 57 | ${CPP} | grep -v '^\#' 58 .if ${M68060} 59 CMACHFLAGS= -m68020-60 -Wa,-m68030 -Wa,-m68851 60 .else 61 CMACHFLAGS= -m68030 62 .endif 63 CWARNFLAGS?= -Werror -Wstrict-prototypes -Wmissing-prototypes \ 64 -Wpointer-arith 65 # XXX Delete -Wuninitialized for now, since the compiler doesn't 66 # XXX always get it right. --thorpej 67 CWARNFLAGS+= -Wno-uninitialized 68 .if (${HAVE_EGCS} != "") 69 CWARNFLAGS+= -Wno-main 70 .endif 71 CFLAGS= ${DEBUG} ${COPTS} ${CMACHFLAGS} ${CWARNFLAGS} -msoft-float 72 AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 73 LINKFLAGS= -n -Ttext 0 -e start 74 STRIPFLAGS= -g 75 76 %INCLUDES 77 78 HOSTED_CC= ${CC} 79 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 80 HOSTED_CFLAGS= ${CFLAGS} 81 82 ### find out what to use for libkern 83 KERN_AS= obj 84 .include "$S/lib/libkern/Makefile.inc" 85 .ifndef PROF 86 LIBKERN= ${KERNLIB} 87 .else 88 LIBKERN= ${KERNLIB_PROF} 89 .endif 90 91 ### find out what to use for libcompat 92 .include "$S/compat/common/Makefile.inc" 93 .ifndef PROF 94 LIBCOMPAT= ${COMPATLIB} 95 .else 96 LIBCOMPAT= ${COMPATLIB_PROF} 97 .endif 98 99 ### for the Motorola 68040 Floating Point Software Product 100 .include "$S/arch/m68k/fpsp/Makefile.inc" 101 102 ### for the Motorola 68060 Software Support Package 103 .include "$S/arch/m68k/060sp/Makefile.inc" 104 105 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 106 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 107 108 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 109 NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 110 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 111 112 HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 113 114 %OBJS 115 116 %CFILES 117 118 #%SFILES 119 120 # load lines for config "xxx" will be emitted as: 121 # xxx: ${SYSTEM_DEP} swapxxx.o 122 # ${SYSTEM_LD_HEAD} 123 # ${SYSTEM_LD} swapxxx.o 124 # ${SYSTEM_LD_TAIL} 125 SYSTEM_OBJ= locore.o ${FPSP} \ 126 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 127 SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 128 SYSTEM_LD_HEAD= @rm -f $@ 129 SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 130 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 131 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 132 133 DEBUG?= 134 .if ${DEBUG} == "-g" 135 LINKFLAGS+= -X 136 SYSTEM_LD_TAIL+=; \ 137 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 138 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 139 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 140 .else 141 LINKFLAGS+= -S 142 .endif 143 144 %LOAD 145 146 assym.h: $S/kern/genassym.sh ${X68K}/x68k/genassym.cf 147 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 148 < ${X68K}/x68k/genassym.cf > assym.h.tmp && \ 149 mv -f assym.h.tmp assym.h 150 151 param.c: $S/conf/param.c 152 rm -f param.c 153 cp $S/conf/param.c . 154 155 param.o: param.c Makefile 156 ${NORMAL_C} 157 158 ioconf.o: ioconf.c 159 ${NORMAL_C} 160 161 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 162 sh $S/conf/newvers.sh 163 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 164 165 __CLEANKERNEL: .USE 166 @echo "${.TARGET}ing the kernel objects" 167 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 168 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 169 170 __CLEANDEPEND: .USE 171 rm -f .depend 172 173 clean: __CLEANKERNEL 174 175 cleandir distclean: __CLEANKERNEL __CLEANDEPEND 176 177 lint: 178 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 179 ${CFILES} ioconf.c param.c | \ 180 grep -v 'static function .* unused' 181 182 tags: 183 @echo "see $S/kern/Makefile for tags" 184 185 links: 186 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 187 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 188 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 189 sort -u | comm -23 - dontlink | \ 190 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 191 sh makelinks && rm -f dontlink 192 193 SRCS= ${X68K}/x68k/locore.s \ 194 param.c ioconf.c ${CFILES} ${SFILES} 195 depend: .depend 196 .depend: ${SRCS} assym.h param.c 197 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${X68K}/x68k/locore.s 198 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 199 -if test -n "${SFILES}"; then \ 200 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \ 201 fi 202 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 203 ${CPPFLAGS} < ${X68K}/x68k/genassym.cf 204 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 205 @rm -f assym.dep 206 207 dependall: depend all 208 209 210 # depend on root or device configuration 211 autoconf.o conf.o: Makefile 212 213 # depend on network or filesystem configuration 214 uipc_proto.o vfs_conf.o: Makefile 215 216 # depend on maxusers 217 machdep.o: Makefile 218 219 # depend on CPU configuration 220 locore.o: Makefile 221 222 # depend on DEBUG and/or DIAGNOSTIC options 223 grf.o par.o sram.o: Makefile 224 intio_dmac.o mfp.o neptune.o opm.o scsirom.o xel.o zs.o bus.o: Makefile 225 intio.o vm_machdep.o: Makefile 226 227 228 locore.o: ${X68K}/x68k/locore.s assym.h 229 ${NORMAL_S} 230 231 # The install target can be redefined by putting a 232 # install-kernel-${MACHINE_NAME} target into /etc/mk.conf 233 MACHINE_NAME!= uname -n 234 install: install-kernel-${MACHINE_NAME} 235 .if !target(install-kernel-${MACHINE_NAME}}) 236 install-kernel-${MACHINE_NAME}: 237 rm -f /onetbsd 238 ln /netbsd /onetbsd 239 cp netbsd /nnetbsd 240 mv /nnetbsd /netbsd 241 .endif 242 243 %RULES 244