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