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