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