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