1 1.16 hubertf # $NetBSD: Makefile.next68k,v 1.16 2000/05/09 00:56:26 hubertf 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 AR?= ar 25 1.1 dbj AS?= as 26 1.1 dbj CC?= cc 27 1.1 dbj CPP?= cpp 28 1.1 dbj LD?= ld 29 1.1 dbj LORDER?=lorder 30 1.1 dbj MKDEP?= mkdep 31 1.1 dbj NM?= nm 32 1.1 dbj RANLIB?=ranlib 33 1.1 dbj SIZE?= size 34 1.14 tsutsui STRIP?= strip 35 1.1 dbj TSORT?= tsort -q 36 1.1 dbj 37 1.10 dbj COPTS?= -O2 38 1.1 dbj 39 1.1 dbj # source tree is located via $S relative to the compilation directory 40 1.1 dbj .ifndef S 41 1.1 dbj S!= cd ../../../..; pwd 42 1.1 dbj .endif 43 1.1 dbj NEXT68K= $S/arch/next68k 44 1.1 dbj 45 1.15 thorpej HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 46 1.1 dbj INCLUDES= -I. -I$S/arch -I$S -nostdinc 47 1.10 dbj CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -Dnext68k 48 1.6 augustss CWARNFLAGS= -Wall -Wstrict-prototypes -Wmissing-prototypes -Wno-format \ 49 1.6 augustss -Wpointer-arith 50 1.15 thorpej # XXX Delete -Wuninitialized for now, since the compiler doesn't 51 1.15 thorpej # XXX always get it right. --thorpej 52 1.15 thorpej CWARNFLAGS+= -Wno-uninitialized 53 1.15 thorpej .if (${HAVE_EGCS} != "") 54 1.5 dbj CWARNFLAGS+= -Wno-main 55 1.5 dbj .endif 56 1.1 dbj CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float 57 1.1 dbj AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 58 1.10 dbj LINKFLAGS= -n -Ttext 0 -e start 59 1.11 tsutsui STRIPFLAGS= -g 60 1.8 mrg 61 1.8 mrg %INCLUDES 62 1.1 dbj 63 1.10 dbj HOSTED_CC= ${CC} 64 1.10 dbj HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 65 1.10 dbj HOSTED_CFLAGS= ${CFLAGS} 66 1.10 dbj 67 1.10 dbj ### find out what to use for libkern 68 1.4 drochner KERN_AS= obj 69 1.1 dbj .include "$S/lib/libkern/Makefile.inc" 70 1.1 dbj .ifndef PROF 71 1.10 dbj LIBKERN= ${KERNLIB} 72 1.1 dbj .else 73 1.10 dbj LIBKERN= ${KERNLIB_PROF} 74 1.1 dbj .endif 75 1.1 dbj 76 1.1 dbj ### Find out what to use for libcompat. 77 1.1 dbj .include "$S/compat/common/Makefile.inc" 78 1.1 dbj .ifndef PROF 79 1.10 dbj LIBCOMPAT= ${COMPATLIB} 80 1.1 dbj .else 81 1.10 dbj LIBCOMPAT= ${COMPATLIB_PROF} 82 1.1 dbj .endif 83 1.1 dbj 84 1.1 dbj ### for the Motorola 68040 Floating Point Software Product 85 1.1 dbj .include "$S/arch/m68k/fpsp/Makefile.inc" 86 1.1 dbj 87 1.1 dbj # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 88 1.1 dbj # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 89 1.1 dbj 90 1.1 dbj NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 91 1.10 dbj NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 92 1.1 dbj NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 93 1.10 dbj 94 1.10 dbj HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 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.9 cgd echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 120 1.14 tsutsui echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 121 1.14 tsutsui ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 122 1.1 dbj .else 123 1.1 dbj LINKFLAGS+= -S 124 1.1 dbj .endif 125 1.1 dbj 126 1.1 dbj %LOAD 127 1.1 dbj 128 1.1 dbj assym.h: $S/kern/genassym.sh ${NEXT68K}/next68k/genassym.cf 129 1.1 dbj sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 130 1.1 dbj < ${NEXT68K}/next68k/genassym.cf > assym.h.tmp && \ 131 1.1 dbj mv -f assym.h.tmp assym.h 132 1.1 dbj 133 1.1 dbj param.c: $S/conf/param.c 134 1.1 dbj rm -f param.c 135 1.1 dbj cp $S/conf/param.c . 136 1.1 dbj 137 1.1 dbj param.o: param.c Makefile 138 1.1 dbj ${NORMAL_C} 139 1.1 dbj 140 1.1 dbj ioconf.o: ioconf.c 141 1.1 dbj ${NORMAL_C} 142 1.1 dbj 143 1.1 dbj newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 144 1.1 dbj sh $S/conf/newvers.sh 145 1.1 dbj ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 146 1.1 dbj 147 1.1 dbj __CLEANKERNEL: .USE 148 1.1 dbj @echo "${.TARGET}ing the kernel objects" 149 1.1 dbj rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 150 1.1 dbj [Ee]rrs linterrs makelinks assym.h.tmp assym.h 151 1.1 dbj 152 1.1 dbj __CLEANDEPEND: .USE 153 1.1 dbj rm -f .depend 154 1.1 dbj 155 1.1 dbj clean: __CLEANKERNEL 156 1.1 dbj 157 1.3 lukem cleandir distclean: __CLEANKERNEL __CLEANDEPEND 158 1.1 dbj 159 1.1 dbj lint: 160 1.1 dbj @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 161 1.1 dbj ${CFILES} ioconf.c param.c | \ 162 1.1 dbj grep -v 'static function .* unused' 163 1.1 dbj 164 1.1 dbj tags: 165 1.1 dbj @echo "see $S/kern/Makefile for tags" 166 1.1 dbj 167 1.1 dbj links: 168 1.1 dbj egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 169 1.1 dbj sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 170 1.1 dbj echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 171 1.1 dbj sort -u | comm -23 - dontlink | \ 172 1.1 dbj sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 173 1.1 dbj sh makelinks && rm -f dontlink 174 1.1 dbj 175 1.1 dbj SRCS= ${NEXT68K}/next68k/locore.s \ 176 1.1 dbj param.c ioconf.c ${CFILES} ${SFILES} 177 1.1 dbj depend: .depend 178 1.1 dbj .depend: ${SRCS} assym.h param.c 179 1.1 dbj ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${NEXT68K}/next68k/locore.s 180 1.1 dbj ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 181 1.1 dbj ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 182 1.1 dbj sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 183 1.1 dbj ${CPPFLAGS} < ${NEXT68K}/next68k/genassym.cf 184 1.1 dbj @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 185 1.1 dbj @rm -f assym.dep 186 1.13 tron 187 1.13 tron dependall: depend all 188 1.1 dbj 189 1.1 dbj 190 1.1 dbj # depend on root or device configuration 191 1.1 dbj autoconf.o conf.o: Makefile 192 1.1 dbj 193 1.1 dbj # depend on network or filesystem configuration 194 1.1 dbj uipc_proto.o vfs_conf.o: Makefile 195 1.1 dbj 196 1.1 dbj # depend on maxusers 197 1.1 dbj genassym.o machdep.o: Makefile 198 1.1 dbj 199 1.1 dbj # depend on CPU configuration 200 1.1 dbj locore.o pmap.o trap.o: Makefile 201 1.1 dbj 202 1.1 dbj 203 1.1 dbj locore.o: ${NEXT68K}/next68k/locore.s assym.h 204 1.1 dbj ${NORMAL_S} 205 1.16 hubertf 206 1.16 hubertf # The install target can be redefined by putting a 207 1.16 hubertf # install-kernel-${MACHINE_NAME} target into /etc/mk.conf 208 1.16 hubertf MACHINE_NAME!= uname -n 209 1.16 hubertf install: install-kernel-${MACHINE_NAME} 210 1.16 hubertf .if !target(install-kernel-${MACHINE_NAME}}) 211 1.16 hubertf install-kernel-${MACHINE_NAME}: 212 1.16 hubertf rm -f /onetbsd 213 1.16 hubertf ln /netbsd /onetbsd 214 1.16 hubertf cp netbsd /nnetbsd 215 1.16 hubertf mv /nnetbsd /netbsd 216 1.16 hubertf .endif 217 1.1 dbj 218 1.1 dbj %RULES 219