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