1 # $NetBSD: Makefile.mvme68k,v 1.31 1997/11/12 22:26:11 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/mvme68k/conf/``machineid'' 9 # after which you should do 10 # config machineid 11 # Machine generic makefile changes should be made in 12 # /sys/arch/mvme68k/conf/Makefile.mvme68k 13 # after which config should be rerun for all machines of that type. 14 # 15 # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 16 # IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 17 # 18 # -DTRACE compile in kernel tracing hooks 19 # -DQUOTA compile in file system quotas 20 21 # DEBUG is set to -g if debugging. 22 # PROF is set to -pg if profiling. 23 24 CC?= cc 25 LD?= ld 26 LORDER?=lorder 27 MKDEP?= mkdep 28 NM?= nm 29 SIZE?= size 30 STRIP?= strip 31 TSORT?= tsort -q 32 COPTS?= -O2 33 34 # source tree is located via $S relative to the compilation directory 35 .ifndef S 36 S!= cd ../../../..; pwd 37 .endif 38 MVME68K=$S/arch/mvme68k 39 40 # Override CPP defaults entirely, so cross-compilation works. 41 # Keep -nostdinc before all -I flags, similar for -undef ... 42 INCLUDES= -nostdinc -I. -I$S/arch -I$S 43 CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \ 44 -Dmc68020 -Dmvme68k 45 CWARNFLAGS= -Werror 46 CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float 47 AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 48 LINKFLAGS= -n -Ttext 8000 -e start 49 STRIPFLAGS= -d 50 51 HOSTED_CC= ${CC} 52 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 53 HOSTED_CFLAGS= ${CFLAGS} 54 55 ### find out what to use for libkern 56 .include "$S/lib/libkern/Makefile.inc" 57 .ifndef PROF 58 LIBKERN= ${KERNLIB} 59 .else 60 LIBKERN= ${KERNLIB_PROF} 61 .endif 62 63 ### find out what to use for libcompat 64 .include "$S/compat/common/Makefile.inc" 65 .ifndef PROF 66 LIBCOMPAT= ${COMPATLIB} 67 .else 68 LIBCOMPAT= ${COMPATLIB_PROF} 69 .endif 70 71 ### for the Motorola 68040 Floating Point Software Product 72 .include "$S/arch/m68k/fpsp/Makefile.inc" 73 74 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 75 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 76 77 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 78 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 79 80 HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 81 82 %OBJS 83 84 %CFILES 85 86 %SFILES 87 88 # load lines for config "xxx" will be emitted as: 89 # xxx: ${SYSTEM_DEP} swapxxx.o 90 # ${SYSTEM_LD_HEAD} 91 # ${SYSTEM_LD} swapxxx.o 92 # ${SYSTEM_LD_TAIL} 93 SYSTEM_OBJ= locore.o ${FPSP} \ 94 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 95 SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 96 SYSTEM_LD_HEAD= @rm -f $@ 97 SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 98 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 99 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 100 101 DEBUG?= 102 .if ${DEBUG} == "-g" 103 LINKFLAGS+= -X 104 SYSTEM_LD_TAIL+=; \ 105 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 106 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 107 .else 108 LINKFLAGS+= -S 109 .endif 110 111 %LOAD 112 113 assym.h: $S/kern/genassym.sh ${MVME68K}/mvme68k/genassym.cf 114 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 115 < ${MVME68K}/mvme68k/genassym.cf > assym.h.tmp && \ 116 mv -f assym.h.tmp assym.h 117 118 param.c: $S/conf/param.c 119 rm -f param.c 120 cp $S/conf/param.c . 121 122 param.o: param.c Makefile 123 ${NORMAL_C} 124 125 ioconf.o: ioconf.c 126 ${NORMAL_C} 127 128 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 129 sh $S/conf/newvers.sh 130 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 131 132 __CLEANKERNEL: .USE 133 @echo "${.TARGET}ing the kernel objects" 134 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 135 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 136 137 __CLEANDEPEND: .USE 138 rm -f .depend 139 140 clean: __CLEANKERNEL 141 142 cleandir: __CLEANKERNEL __CLEANDEPEND 143 144 lint: 145 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 146 ${CFILES} ioconf.c param.c | \ 147 grep -v 'static function .* unused' 148 149 tags: 150 @echo "see $S/kern/Makefile for tags" 151 152 links: 153 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 154 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 155 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 156 sort -u | comm -23 - dontlink | \ 157 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 158 sh makelinks && rm -f dontlink 159 160 SRCS= ${MVME68K}/mvme68k/locore.s \ 161 param.c ioconf.c ${CFILES} ${SFILES} 162 depend: .depend 163 .depend: ${SRCS} assym.h param.c 164 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${MVME68K}/mvme68k/locore.s 165 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 166 -if test -n "${SFILES}"; then \ 167 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \ 168 fi 169 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 170 ${CPPFLAGS} < ${MVME68K}/mvme68k/genassym.cf 171 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 172 @rm -f assym.dep 173 174 175 # depend on root or device configuration 176 autoconf.o conf.o: Makefile 177 178 # depend on network or filesystem configuration 179 uipc_proto.o vfs_conf.o: Makefile 180 181 # depend on maxusers 182 machdep.o: Makefile 183 184 # depend on CPU configuration 185 locore.o pmap.o sys_machdep.o trap.o: Makefile 186 187 188 locore.o: ${MVME68K}/mvme68k/locore.s assym.h 189 ${NORMAL_S} 190 191 %RULES 192