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