1 1.95.2.1 thorpej # $NetBSD: Makefile.amiga,v 1.95.2.1 2001/11/12 21:16:21 thorpej Exp $ 2 1.21 cgd 3 1.35 mycroft # Makefile for NetBSD 4 1.1 mw # 5 1.1 mw # This makefile is constructed from a machine description: 6 1.1 mw # config machineid 7 1.1 mw # Most changes should be made in the machine description 8 1.35 mycroft # /sys/arch/amiga/conf/``machineid'' 9 1.1 mw # after which you should do 10 1.35 mycroft # config machineid 11 1.1 mw # Machine generic makefile changes should be made in 12 1.35 mycroft # /sys/arch/amiga/conf/Makefile.amiga 13 1.1 mw # after which config should be rerun for all machines of that type. 14 1.95 thorpej 15 1.95 thorpej MACHINE_ARCH=m68k 16 1.95.2.1 thorpej USETOOLS?= no 17 1.95.2.1 thorpej 18 1.95.2.1 thorpej .include <bsd.own.mk> 19 1.1 mw 20 1.35 mycroft # DEBUG is set to -g if debugging. 21 1.35 mycroft # PROF is set to -pg if profiling. 22 1.1 mw 23 1.69 thorpej AR?= ar 24 1.69 thorpej AS?= as 25 1.38 mycroft CC?= cc 26 1.69 thorpej CPP?= cpp 27 1.38 mycroft LD?= ld 28 1.68 thorpej LORDER?=lorder 29 1.46 mycroft MKDEP?= mkdep 30 1.68 thorpej NM?= nm 31 1.69 thorpej RANLIB?=ranlib 32 1.64 lukem SIZE?= size 33 1.87 tsutsui STRIP?= strip 34 1.68 thorpej TSORT?= tsort -q 35 1.69 thorpej 36 1.52 veego COPTS?= -O2 37 1.1 mw 38 1.1 mw # source tree is located via $S relative to the compilation directory 39 1.49 mycroft .ifndef S 40 1.46 mycroft S!= cd ../../../..; pwd 41 1.49 mycroft .endif 42 1.46 mycroft AMIGA= $S/arch/amiga 43 1.1 mw 44 1.88 thorpej HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 45 1.47 mycroft INCLUDES= -I. -I$S/arch -I$S -nostdinc 46 1.94 mrg CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Damiga -DFPCOPROC 47 1.78 augustss CWARNFLAGS?= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 48 1.78 augustss -Wpointer-arith 49 1.88 thorpej # XXX Delete -Wuninitialized for now, since the compiler doesn't 50 1.88 thorpej # XXX always get it right. --thorpej 51 1.88 thorpej CWARNFLAGS+= -Wno-uninitialized 52 1.88 thorpej .if (${HAVE_EGCS} != "") 53 1.70 tv CWARNFLAGS+= -Wno-main 54 1.70 tv .endif 55 1.73 is .if empty(IDENT:M-DM68060) 56 1.46 mycroft CMACHFLAGS= -m68020 57 1.40 is .else 58 1.83 is CMACHFLAGS= -m68060 -Wa,-m68030 -Wa,-m68851 59 1.40 is .endif 60 1.52 veego CFLAGS= ${DEBUG} ${CWARNFLAGS} ${COPTS} ${CMACHFLAGS} -msoft-float 61 1.37 mycroft AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 62 1.35 mycroft LINKFLAGS= -n -Ttext 0 -e start 63 1.84 tsutsui STRIPFLAGS= -g 64 1.81 mrg 65 1.81 mrg %INCLUDES 66 1.50 mycroft 67 1.4 mw ### find out what to use for libkern 68 1.77 drochner KERN_AS= obj 69 1.4 mw .include "$S/lib/libkern/Makefile.inc" 70 1.4 mw .ifndef PROF 71 1.4 mw LIBKERN= ${KERNLIB} 72 1.4 mw .else 73 1.4 mw LIBKERN= ${KERNLIB_PROF} 74 1.4 mw .endif 75 1.20 chopps 76 1.24 christos ### find out what to use for libcompat 77 1.24 christos .include "$S/compat/common/Makefile.inc" 78 1.24 christos .ifndef PROF 79 1.24 christos LIBCOMPAT= ${COMPATLIB} 80 1.24 christos .else 81 1.24 christos LIBCOMPAT= ${COMPATLIB_PROF} 82 1.24 christos .endif 83 1.24 christos 84 1.20 chopps ### for the Motorola 68040 Floating Point Software Product 85 1.20 chopps .include "$S/arch/m68k/fpsp/Makefile.inc" 86 1.20 chopps 87 1.41 is ### for the Motorola 68060 Software Support Package 88 1.44 is .include "$S/arch/m68k/060sp/Makefile.inc" 89 1.41 is 90 1.48 mycroft # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 91 1.48 mycroft # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 92 1.1 mw 93 1.35 mycroft NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 94 1.75 thorpej NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 95 1.37 mycroft NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 96 1.1 mw 97 1.29 jtc .SUFFIXES: .o .g 98 1.29 jtc 99 1.29 jtc .g.o: ; echo This is a dummy rule and should not be executed. 100 1.29 jtc 101 1.92 is NORMAL_G= gspa -c tmscode < $< > $*.c && \ 102 1.91 aymeric ${CC} -c ${CFLAGS} ${CPPFLAGS} ${PROF} $*.c 103 1.29 jtc 104 1.1 mw %OBJS 105 1.1 mw 106 1.1 mw %CFILES 107 1.1 mw 108 1.35 mycroft %SFILES 109 1.35 mycroft 110 1.1 mw # load lines for config "xxx" will be emitted as: 111 1.1 mw # xxx: ${SYSTEM_DEP} swapxxx.o 112 1.1 mw # ${SYSTEM_LD_HEAD} 113 1.1 mw # ${SYSTEM_LD} swapxxx.o 114 1.1 mw # ${SYSTEM_LD_TAIL} 115 1.66 is SYSTEM_OBJ= locore.o ${FPSP} \ 116 1.77 drochner param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 117 1.1 mw SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 118 1.35 mycroft SYSTEM_LD_HEAD= @rm -f $@ 119 1.35 mycroft SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 120 1.35 mycroft ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 121 1.64 lukem SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 122 1.35 mycroft 123 1.35 mycroft DEBUG?= 124 1.35 mycroft .if ${DEBUG} == "-g" 125 1.35 mycroft LINKFLAGS+= -X 126 1.35 mycroft SYSTEM_LD_TAIL+=; \ 127 1.82 cgd echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 128 1.87 tsutsui echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 129 1.87 tsutsui ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 130 1.35 mycroft .else 131 1.46 mycroft LINKFLAGS+= -S 132 1.35 mycroft .endif 133 1.1 mw 134 1.1 mw %LOAD 135 1.3 mw 136 1.56 veego assym.h: ${AMIGA}/amiga/genassym.cf $S/kern/genassym.sh 137 1.56 veego sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 138 1.56 veego < ${AMIGA}/amiga/genassym.cf > assym.h.tmp && \ 139 1.56 veego mv -f assym.h.tmp assym.h 140 1.1 mw 141 1.35 mycroft param.c: $S/conf/param.c 142 1.35 mycroft rm -f param.c 143 1.35 mycroft cp $S/conf/param.c . 144 1.1 mw 145 1.35 mycroft param.o: param.c Makefile 146 1.48 mycroft ${NORMAL_C} 147 1.35 mycroft 148 1.35 mycroft ioconf.o: ioconf.c 149 1.35 mycroft ${NORMAL_C} 150 1.1 mw 151 1.35 mycroft newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 152 1.35 mycroft sh $S/conf/newvers.sh 153 1.35 mycroft ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 154 1.1 mw 155 1.63 christos __CLEANKERNEL: .USE 156 1.63 christos @echo "${.TARGET}ing the kernel objects" 157 1.63 christos rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 158 1.63 christos [Ee]rrs linterrs makelinks assym.h.tmp assym.h 159 1.63 christos 160 1.63 christos __CLEANDEPEND: .USE 161 1.63 christos rm -f .depend 162 1.1 mw 163 1.63 christos clean: __CLEANKERNEL 164 1.63 christos 165 1.76 lukem cleandir distclean: __CLEANKERNEL __CLEANDEPEND 166 1.1 mw 167 1.35 mycroft lint: 168 1.54 perry @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 169 1.61 mycroft ${CFILES} ioconf.c param.c | \ 170 1.35 mycroft grep -v 'static function .* unused' 171 1.1 mw 172 1.35 mycroft tags: 173 1.35 mycroft @echo "see $S/kern/Makefile for tags" 174 1.1 mw 175 1.1 mw links: 176 1.1 mw egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 177 1.1 mw sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 178 1.1 mw echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 179 1.1 mw sort -u | comm -23 - dontlink | \ 180 1.35 mycroft sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 181 1.1 mw sh makelinks && rm -f dontlink 182 1.1 mw 183 1.35 mycroft SRCS= ${AMIGA}/amiga/locore.s \ 184 1.39 cgd param.c ioconf.c ${CFILES} ${SFILES} 185 1.53 veego depend: .depend 186 1.39 cgd .depend: ${SRCS} assym.h param.c 187 1.46 mycroft ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${AMIGA}/amiga/locore.s 188 1.46 mycroft ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 189 1.46 mycroft ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 190 1.59 leo sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 191 1.59 leo ${CPPFLAGS} < ${AMIGA}/amiga/genassym.cf 192 1.59 leo @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 193 1.59 leo @rm -f assym.dep 194 1.59 leo 195 1.86 tron dependall: depend all 196 1.86 tron 197 1.35 mycroft 198 1.35 mycroft # depend on root or device configuration 199 1.35 mycroft autoconf.o conf.o: Makefile 200 1.35 mycroft 201 1.72 is # depend on network configuration 202 1.72 is uipc_proto.o: Makefile 203 1.35 mycroft 204 1.35 mycroft # depend on maxusers 205 1.56 veego machdep.o: Makefile 206 1.1 mw 207 1.35 mycroft # depend on CPU configuration 208 1.74 is amiga_init.o locore.o pmap.o sys_machdep.o: Makefile 209 1.74 is bzsc.o bztzsc.o cbiisc.o cbsc.o flsc.o sbic.o: Makefile 210 1.60 is 211 1.60 is # depends on defined(DRACO) 212 1.60 is a2kbbc.o: Makefile 213 1.1 mw 214 1.35 mycroft locore.o: ${AMIGA}/amiga/locore.s assym.h 215 1.35 mycroft ${NORMAL_S} 216 1.89 hubertf 217 1.89 hubertf # The install target can be redefined by putting a 218 1.89 hubertf # install-kernel-${MACHINE_NAME} target into /etc/mk.conf 219 1.89 hubertf MACHINE_NAME!= uname -n 220 1.89 hubertf install: install-kernel-${MACHINE_NAME} 221 1.89 hubertf .if !target(install-kernel-${MACHINE_NAME}}) 222 1.89 hubertf install-kernel-${MACHINE_NAME}: 223 1.89 hubertf rm -f /onetbsd 224 1.89 hubertf ln /netbsd /onetbsd 225 1.89 hubertf cp netbsd /nnetbsd 226 1.89 hubertf mv /nnetbsd /netbsd 227 1.89 hubertf .endif 228 1.1 mw 229 1.1 mw %RULES 230