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