1 1.73 mrg # $NetBSD: Makefile.sparc,v 1.73 2001/05/29 02:20:26 mrg Exp $ 2 1.15 deraadt 3 1.25 mycroft # Makefile for NetBSD 4 1.1 deraadt # 5 1.1 deraadt # This makefile is constructed from a machine description: 6 1.1 deraadt # config machineid 7 1.1 deraadt # Most changes should be made in the machine description 8 1.25 mycroft # /sys/arch/sparc/conf/``machineid'' 9 1.1 deraadt # after which you should do 10 1.25 mycroft # config machineid 11 1.1 deraadt # Machine generic makefile changes should be made in 12 1.25 mycroft # /sys/arch/sparc/conf/Makefile.sparc 13 1.1 deraadt # after which config should be rerun for all machines of that type. 14 1.1 deraadt 15 1.56 christos .include <bsd.own.mk> 16 1.56 christos 17 1.1 deraadt # DEBUG is set to -g if debugging. 18 1.1 deraadt # PROF is set to -pg if profiling. 19 1.1 deraadt 20 1.50 thorpej AR?= ar 21 1.50 thorpej AS?= as 22 1.28 mycroft CC?= cc 23 1.50 thorpej CPP?= cpp 24 1.28 mycroft LD?= ld 25 1.49 thorpej LORDER?=lorder 26 1.33 mycroft MKDEP?= mkdep 27 1.49 thorpej NM?= nm 28 1.50 thorpej RANLIB?=ranlib 29 1.48 lukem SIZE?= size 30 1.67 tsutsui STRIP?= strip 31 1.49 thorpej TSORT?= tsort -q 32 1.50 thorpej 33 1.48 lukem COPTS?= -O2 34 1.1 deraadt 35 1.1 deraadt # source tree is located via $S relative to the compilation directory 36 1.36 mycroft .ifndef S 37 1.33 mycroft S!= cd ../../../..; pwd 38 1.36 mycroft .endif 39 1.33 mycroft SPARC= $S/arch/sparc 40 1.1 deraadt 41 1.68 thorpej HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 42 1.34 mycroft INCLUDES= -I. -I$S/arch -I$S -nostdinc 43 1.73 mrg CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT 44 1.55 augustss CWARNFLAGS?= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 45 1.55 augustss -Wpointer-arith 46 1.68 thorpej # XXX Delete -Wuninitialized for now, since the compiler doesn't 47 1.68 thorpej # XXX always get it right. --thorpej 48 1.68 thorpej CWARNFLAGS+= -Wno-uninitialized 49 1.68 thorpej .if (${HAVE_EGCS} != "") 50 1.51 tv CWARNFLAGS+= -Wno-main 51 1.51 tv .endif 52 1.38 jonathan CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} 53 1.71 pk # work around GCC (egcs-2.91.66) bug which is liable 54 1.71 pk # to use FPU registers as temporaries: 55 1.71 pk CFLAGS+= -mno-fpu 56 1.27 mycroft AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 57 1.56 christos LINKFLAGS= -Ttext F0004000 -e start 58 1.56 christos .if ${OBJECT_FMT} != "ELF" 59 1.56 christos LINKFLAGS+= -N -p 60 1.58 christos .else 61 1.72 pk KERN_LDSCRIPT?= kern.ldscript 62 1.72 pk LINKFLAGS+= -n -T ${SPARC}/conf/${KERN_LDSCRIPT} 63 1.56 christos .endif 64 1.64 tsutsui STRIPFLAGS= -g 65 1.61 mrg 66 1.61 mrg %INCLUDES 67 1.37 mycroft 68 1.5 deraadt ### find out what to use for libkern 69 1.54 drochner KERN_AS= obj 70 1.5 deraadt .include "$S/lib/libkern/Makefile.inc" 71 1.5 deraadt .ifndef PROF 72 1.5 deraadt LIBKERN= ${KERNLIB} 73 1.5 deraadt .else 74 1.5 deraadt LIBKERN= ${KERNLIB_PROF} 75 1.5 deraadt .endif 76 1.5 deraadt 77 1.21 christos ### find out what to use for libcompat 78 1.21 christos .include "$S/compat/common/Makefile.inc" 79 1.21 christos .ifndef PROF 80 1.21 christos LIBCOMPAT= ${COMPATLIB} 81 1.21 christos .else 82 1.21 christos LIBCOMPAT= ${COMPATLIB_PROF} 83 1.21 christos .endif 84 1.21 christos 85 1.35 mycroft # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 86 1.43 christos # HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 87 1.1 deraadt 88 1.25 mycroft NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 89 1.52 thorpej NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 90 1.27 mycroft NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 91 1.1 deraadt 92 1.1 deraadt %OBJS 93 1.1 deraadt 94 1.1 deraadt %CFILES 95 1.1 deraadt 96 1.25 mycroft %SFILES 97 1.25 mycroft 98 1.1 deraadt # load lines for config "xxx" will be emitted as: 99 1.1 deraadt # xxx: ${SYSTEM_DEP} swapxxx.o 100 1.1 deraadt # ${SYSTEM_LD_HEAD} 101 1.1 deraadt # ${SYSTEM_LD} swapxxx.o 102 1.1 deraadt # ${SYSTEM_LD_TAIL} 103 1.25 mycroft SYSTEM_OBJ= locore.o \ 104 1.54 drochner param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 105 1.25 mycroft SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 106 1.25 mycroft SYSTEM_LD_HEAD= @rm -f $@ 107 1.25 mycroft SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 108 1.25 mycroft ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 109 1.48 lukem SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 110 1.25 mycroft 111 1.1 deraadt DEBUG?= 112 1.1 deraadt .if ${DEBUG} == "-g" 113 1.25 mycroft LINKFLAGS+= -X 114 1.25 mycroft SYSTEM_LD_TAIL+=; \ 115 1.63 cgd echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 116 1.67 tsutsui echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 117 1.67 tsutsui ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 118 1.1 deraadt .else 119 1.57 mrg LINKFLAGS+= -X 120 1.1 deraadt .endif 121 1.1 deraadt 122 1.1 deraadt %LOAD 123 1.1 deraadt 124 1.44 mycroft assym.h: $S/kern/genassym.sh ${SPARC}/sparc/genassym.cf 125 1.44 mycroft sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 126 1.44 mycroft < ${SPARC}/sparc/genassym.cf > assym.h.tmp && \ 127 1.44 mycroft mv -f assym.h.tmp assym.h 128 1.25 mycroft 129 1.25 mycroft param.c: $S/conf/param.c 130 1.25 mycroft rm -f param.c 131 1.25 mycroft cp $S/conf/param.c . 132 1.1 deraadt 133 1.25 mycroft param.o: param.c Makefile 134 1.35 mycroft ${NORMAL_C} 135 1.1 deraadt 136 1.25 mycroft ioconf.o: ioconf.c 137 1.25 mycroft ${NORMAL_C} 138 1.1 deraadt 139 1.25 mycroft newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 140 1.25 mycroft sh $S/conf/newvers.sh 141 1.25 mycroft ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 142 1.1 deraadt 143 1.47 christos __CLEANKERNEL: .USE 144 1.47 christos @echo "${.TARGET}ing the kernel objects" 145 1.29 cgd rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 146 1.44 mycroft [Ee]rrs linterrs makelinks assym.h.tmp assym.h 147 1.47 christos 148 1.47 christos __CLEANDEPEND: .USE 149 1.47 christos rm -f .depend 150 1.47 christos 151 1.47 christos clean: __CLEANKERNEL 152 1.47 christos 153 1.53 lukem cleandir distclean: __CLEANKERNEL __CLEANDEPEND 154 1.1 deraadt 155 1.25 mycroft lint: 156 1.40 perry @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 157 1.41 perry ${SPARC}/sparc/Locore.c ${CFILES} \ 158 1.25 mycroft ioconf.c param.c | \ 159 1.25 mycroft grep -v 'static function .* unused' 160 1.1 deraadt 161 1.25 mycroft tags: 162 1.25 mycroft @echo "see $S/kern/Makefile for tags" 163 1.1 deraadt 164 1.1 deraadt links: 165 1.1 deraadt egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 166 1.1 deraadt sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 167 1.1 deraadt echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 168 1.1 deraadt sort -u | comm -23 - dontlink | \ 169 1.25 mycroft sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 170 1.1 deraadt sh makelinks && rm -f dontlink 171 1.1 deraadt 172 1.25 mycroft SRCS= ${SPARC}/sparc/locore.s \ 173 1.29 cgd param.c ioconf.c ${CFILES} ${SFILES} 174 1.39 pk depend: .depend 175 1.29 cgd .depend: ${SRCS} assym.h param.c 176 1.33 mycroft ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC}/sparc/locore.s 177 1.33 mycroft ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 178 1.60 pk .if !empty(SFILES) 179 1.33 mycroft ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 180 1.60 pk .endif 181 1.45 leo sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 182 1.45 leo ${CPPFLAGS} < ${SPARC}/sparc/genassym.cf 183 1.45 leo @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 184 1.45 leo @rm -f assym.dep 185 1.66 tron 186 1.66 tron dependall: depend all 187 1.66 tron 188 1.1 deraadt 189 1.25 mycroft # depend on root or device configuration 190 1.25 mycroft autoconf.o conf.o: Makefile 191 1.25 mycroft 192 1.25 mycroft # depend on network or filesystem configuration 193 1.25 mycroft uipc_proto.o vfs_conf.o: Makefile 194 1.1 deraadt 195 1.25 mycroft # depend on maxusers 196 1.43 christos machdep.o: Makefile 197 1.11 pk 198 1.25 mycroft # depend on CPU configuration 199 1.25 mycroft bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile 200 1.25 mycroft ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile 201 1.25 mycroft machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile 202 1.1 deraadt 203 1.5 deraadt 204 1.25 mycroft locore.o: ${SPARC}/sparc/locore.s assym.h 205 1.25 mycroft ${NORMAL_S} 206 1.69 hubertf 207 1.69 hubertf # The install target can be redefined by putting a 208 1.69 hubertf # install-kernel-${MACHINE_NAME} target into /etc/mk.conf 209 1.69 hubertf MACHINE_NAME!= uname -n 210 1.69 hubertf install: install-kernel-${MACHINE_NAME} 211 1.69 hubertf .if !target(install-kernel-${MACHINE_NAME}}) 212 1.69 hubertf install-kernel-${MACHINE_NAME}: 213 1.69 hubertf rm -f /onetbsd 214 1.69 hubertf ln /netbsd /onetbsd 215 1.69 hubertf cp netbsd /nnetbsd 216 1.69 hubertf mv /nnetbsd /netbsd 217 1.69 hubertf .endif 218 1.5 deraadt 219 1.25 mycroft %RULES 220