1 1.5 dbj # $NetBSD: Makefile.next68k,v 1.5 1998/11/16 04:37:56 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.5 dbj HAVE_GCC28!= ${CC} --version | egrep "^(2\.8|egcs)" ; echo 52 1.1 dbj INCLUDES= -I. -I$S/arch -I$S -nostdinc 53 1.1 dbj CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \ 54 1.1 dbj -undef -Dmc68020 -Dnext68k -D__NetBSD__ 55 1.1 dbj # -U__NeXT__ -UNeXT -U__NeXT -U_NEXT_SOURCE -U__MACH__ \ 56 1.1 dbj # -DCROSS_COMPILE_NEXTSTEP 57 1.1 dbj CWARNFLAGS= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-format 58 1.5 dbj .if (${HAVE_GCC28} != "") 59 1.5 dbj CWARNFLAGS+= -Wno-main 60 1.5 dbj .endif 61 1.1 dbj CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float 62 1.1 dbj AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 63 1.1 dbj LINKFLAGS= -n -Ttext 0 -e start 64 1.1 dbj #LINKFLAGS= -seg1addr 0x4000000 65 1.2 dbj STRIPFLAGS?= -d 66 1.1 dbj # -S is used in gnu strip, rather than -d: 67 1.1 dbj #STRIPFLAGS= -S 68 1.1 dbj 69 1.1 dbj ### Find out what to use for libkern. 70 1.4 drochner KERN_AS= obj 71 1.1 dbj .include "$S/lib/libkern/Makefile.inc" 72 1.1 dbj .ifndef PROF 73 1.1 dbj LIBKERN=${KERNLIB} 74 1.1 dbj .else 75 1.1 dbj LIBKERN=${KERNLIB_PROF} 76 1.1 dbj .endif 77 1.1 dbj 78 1.1 dbj ### Find out what to use for libcompat. 79 1.1 dbj .include "$S/compat/common/Makefile.inc" 80 1.1 dbj .ifndef PROF 81 1.1 dbj LIBCOMPAT=${COMPATLIB} 82 1.1 dbj .else 83 1.1 dbj LIBCOMPAT=${COMPATLIB_PROF} 84 1.1 dbj .endif 85 1.1 dbj 86 1.1 dbj ### for the Motorola 68040 Floating Point Software Product 87 1.1 dbj .include "$S/arch/m68k/fpsp/Makefile.inc" 88 1.1 dbj 89 1.1 dbj # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 90 1.1 dbj # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 91 1.1 dbj 92 1.1 dbj NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 93 1.1 dbj NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 94 1.1 dbj #NORMAL_S= ${CPP} ${AFLAGS} ${CPPFLAGS} $< | sed -e 's/^\#.*//' | ${AS} -o ${.TARGET} 95 1.1 dbj 96 1.1 dbj %OBJS 97 1.1 dbj 98 1.1 dbj %CFILES 99 1.1 dbj 100 1.1 dbj %SFILES 101 1.1 dbj 102 1.1 dbj # load lines for config "xxx" will be emitted as: 103 1.1 dbj # xxx: ${SYSTEM_DEP} swapxxx.o 104 1.1 dbj # ${SYSTEM_LD_HEAD} 105 1.1 dbj # ${SYSTEM_LD} swapxxx.o 106 1.1 dbj # ${SYSTEM_LD_TAIL} 107 1.1 dbj SYSTEM_OBJ= locore.o ${FPSP} \ 108 1.4 drochner param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 109 1.1 dbj SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 110 1.1 dbj SYSTEM_LD_HEAD= @rm -f $@ 111 1.1 dbj SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 112 1.1 dbj ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 113 1.1 dbj SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 114 1.1 dbj 115 1.1 dbj DEBUG?= 116 1.1 dbj .if ${DEBUG} == "-g" 117 1.1 dbj LINKFLAGS+= -X 118 1.1 dbj SYSTEM_LD_TAIL+=; \ 119 1.1 dbj echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 120 1.1 dbj echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 121 1.1 dbj .else 122 1.1 dbj LINKFLAGS+= -S 123 1.1 dbj .endif 124 1.1 dbj 125 1.1 dbj %LOAD 126 1.1 dbj 127 1.1 dbj assym.h: $S/kern/genassym.sh ${NEXT68K}/next68k/genassym.cf 128 1.1 dbj sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 129 1.1 dbj < ${NEXT68K}/next68k/genassym.cf > assym.h.tmp && \ 130 1.1 dbj mv -f assym.h.tmp assym.h 131 1.1 dbj 132 1.1 dbj param.c: $S/conf/param.c 133 1.1 dbj rm -f param.c 134 1.1 dbj cp $S/conf/param.c . 135 1.1 dbj 136 1.1 dbj param.o: param.c Makefile 137 1.1 dbj ${NORMAL_C} 138 1.1 dbj 139 1.1 dbj ioconf.o: ioconf.c 140 1.1 dbj ${NORMAL_C} 141 1.1 dbj 142 1.1 dbj newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 143 1.1 dbj sh $S/conf/newvers.sh 144 1.1 dbj ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 145 1.1 dbj 146 1.1 dbj __CLEANKERNEL: .USE 147 1.1 dbj @echo "${.TARGET}ing the kernel objects" 148 1.1 dbj rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 149 1.1 dbj [Ee]rrs linterrs makelinks assym.h.tmp assym.h 150 1.1 dbj 151 1.1 dbj __CLEANDEPEND: .USE 152 1.1 dbj rm -f .depend 153 1.1 dbj 154 1.1 dbj clean: __CLEANKERNEL 155 1.1 dbj 156 1.3 lukem cleandir distclean: __CLEANKERNEL __CLEANDEPEND 157 1.1 dbj 158 1.1 dbj lint: 159 1.1 dbj @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 160 1.1 dbj ${CFILES} ioconf.c param.c | \ 161 1.1 dbj grep -v 'static function .* unused' 162 1.1 dbj 163 1.1 dbj tags: 164 1.1 dbj @echo "see $S/kern/Makefile for tags" 165 1.1 dbj 166 1.1 dbj links: 167 1.1 dbj egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 168 1.1 dbj sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 169 1.1 dbj echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 170 1.1 dbj sort -u | comm -23 - dontlink | \ 171 1.1 dbj sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 172 1.1 dbj sh makelinks && rm -f dontlink 173 1.1 dbj 174 1.1 dbj SRCS= ${NEXT68K}/next68k/locore.s \ 175 1.1 dbj param.c ioconf.c ${CFILES} ${SFILES} 176 1.1 dbj depend: .depend 177 1.1 dbj .depend: ${SRCS} assym.h param.c 178 1.1 dbj ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${NEXT68K}/next68k/locore.s 179 1.1 dbj ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 180 1.1 dbj ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 181 1.1 dbj sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 182 1.1 dbj ${CPPFLAGS} < ${NEXT68K}/next68k/genassym.cf 183 1.1 dbj @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 184 1.1 dbj @rm -f assym.dep 185 1.1 dbj 186 1.1 dbj 187 1.1 dbj # depend on root or device configuration 188 1.1 dbj autoconf.o conf.o: Makefile 189 1.1 dbj 190 1.1 dbj # depend on network or filesystem configuration 191 1.1 dbj uipc_proto.o vfs_conf.o: Makefile 192 1.1 dbj 193 1.1 dbj # depend on maxusers 194 1.1 dbj genassym.o machdep.o: Makefile 195 1.1 dbj 196 1.1 dbj # depend on CPU configuration 197 1.1 dbj locore.o pmap.o trap.o: Makefile 198 1.1 dbj 199 1.1 dbj 200 1.1 dbj locore.o: ${NEXT68K}/next68k/locore.s assym.h 201 1.1 dbj ${NORMAL_S} 202 1.1 dbj 203 1.1 dbj %RULES 204