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