1 1.60 pk # $NetBSD: Makefile.sparc,v 1.60 1999/06/28 21:03:23 pk 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.1 deraadt # N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 16 1.1 deraadt # IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 17 1.1 deraadt # 18 1.1 deraadt # -DTRACE compile in kernel tracing hooks 19 1.1 deraadt # -DQUOTA compile in file system quotas 20 1.1 deraadt 21 1.56 christos .include <bsd.own.mk> 22 1.56 christos 23 1.1 deraadt # DEBUG is set to -g if debugging. 24 1.1 deraadt # PROF is set to -pg if profiling. 25 1.1 deraadt 26 1.50 thorpej AR?= ar 27 1.50 thorpej AS?= as 28 1.28 mycroft CC?= cc 29 1.50 thorpej CPP?= cpp 30 1.28 mycroft LD?= ld 31 1.49 thorpej LORDER?=lorder 32 1.33 mycroft MKDEP?= mkdep 33 1.49 thorpej NM?= nm 34 1.50 thorpej RANLIB?=ranlib 35 1.48 lukem SIZE?= size 36 1.37 mycroft STRIP?= strip 37 1.49 thorpej TSORT?= tsort -q 38 1.50 thorpej 39 1.48 lukem COPTS?= -O2 40 1.1 deraadt 41 1.1 deraadt # source tree is located via $S relative to the compilation directory 42 1.36 mycroft .ifndef S 43 1.33 mycroft S!= cd ../../../..; pwd 44 1.36 mycroft .endif 45 1.33 mycroft SPARC= $S/arch/sparc 46 1.1 deraadt 47 1.51 tv HAVE_GCC28!= ${CC} --version | egrep "^(2\.8|egcs)" ; echo 48 1.34 mycroft INCLUDES= -I. -I$S/arch -I$S -nostdinc 49 1.35 mycroft CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL 50 1.55 augustss CWARNFLAGS?= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 51 1.55 augustss -Wpointer-arith 52 1.51 tv .if (${HAVE_GCC28} != "") 53 1.51 tv CWARNFLAGS+= -Wno-main 54 1.51 tv .endif 55 1.38 jonathan CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} 56 1.42 pk # add `-mno-fpu' to work around gcc (last noticed in v2.7.2) bug 57 1.42 pk CFLAGS+= -mno-fpu 58 1.27 mycroft AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 59 1.56 christos LINKFLAGS= -Ttext F0004000 -e start 60 1.56 christos .if ${OBJECT_FMT} != "ELF" 61 1.56 christos LINKFLAGS+= -N -p 62 1.58 christos .else 63 1.58 christos LINKFLAGS+= -n 64 1.56 christos .endif 65 1.37 mycroft STRIPFLAGS= -d 66 1.37 mycroft 67 1.5 deraadt ### find out what to use for libkern 68 1.54 drochner KERN_AS= obj 69 1.5 deraadt .include "$S/lib/libkern/Makefile.inc" 70 1.5 deraadt .ifndef PROF 71 1.5 deraadt LIBKERN= ${KERNLIB} 72 1.5 deraadt .else 73 1.5 deraadt LIBKERN= ${KERNLIB_PROF} 74 1.5 deraadt .endif 75 1.5 deraadt 76 1.21 christos ### find out what to use for libcompat 77 1.21 christos .include "$S/compat/common/Makefile.inc" 78 1.21 christos .ifndef PROF 79 1.21 christos LIBCOMPAT= ${COMPATLIB} 80 1.21 christos .else 81 1.21 christos LIBCOMPAT= ${COMPATLIB_PROF} 82 1.21 christos .endif 83 1.21 christos 84 1.35 mycroft # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 85 1.43 christos # HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 86 1.1 deraadt 87 1.25 mycroft NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 88 1.52 thorpej NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 89 1.27 mycroft NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 90 1.1 deraadt 91 1.1 deraadt %OBJS 92 1.1 deraadt 93 1.1 deraadt %CFILES 94 1.1 deraadt 95 1.25 mycroft %SFILES 96 1.25 mycroft 97 1.1 deraadt # load lines for config "xxx" will be emitted as: 98 1.1 deraadt # xxx: ${SYSTEM_DEP} swapxxx.o 99 1.1 deraadt # ${SYSTEM_LD_HEAD} 100 1.1 deraadt # ${SYSTEM_LD} swapxxx.o 101 1.1 deraadt # ${SYSTEM_LD_TAIL} 102 1.25 mycroft SYSTEM_OBJ= locore.o \ 103 1.54 drochner param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 104 1.25 mycroft SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 105 1.25 mycroft SYSTEM_LD_HEAD= @rm -f $@ 106 1.25 mycroft SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 107 1.25 mycroft ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 108 1.48 lukem SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 109 1.25 mycroft 110 1.1 deraadt DEBUG?= 111 1.1 deraadt .if ${DEBUG} == "-g" 112 1.25 mycroft LINKFLAGS+= -X 113 1.25 mycroft SYSTEM_LD_TAIL+=; \ 114 1.25 mycroft echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 115 1.37 mycroft echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 116 1.1 deraadt .else 117 1.57 mrg LINKFLAGS+= -X 118 1.1 deraadt .endif 119 1.1 deraadt 120 1.1 deraadt %LOAD 121 1.1 deraadt 122 1.44 mycroft assym.h: $S/kern/genassym.sh ${SPARC}/sparc/genassym.cf 123 1.44 mycroft sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 124 1.44 mycroft < ${SPARC}/sparc/genassym.cf > assym.h.tmp && \ 125 1.44 mycroft mv -f assym.h.tmp assym.h 126 1.25 mycroft 127 1.25 mycroft param.c: $S/conf/param.c 128 1.25 mycroft rm -f param.c 129 1.25 mycroft cp $S/conf/param.c . 130 1.1 deraadt 131 1.25 mycroft param.o: param.c Makefile 132 1.35 mycroft ${NORMAL_C} 133 1.1 deraadt 134 1.25 mycroft ioconf.o: ioconf.c 135 1.25 mycroft ${NORMAL_C} 136 1.1 deraadt 137 1.25 mycroft newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 138 1.25 mycroft sh $S/conf/newvers.sh 139 1.25 mycroft ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 140 1.1 deraadt 141 1.47 christos __CLEANKERNEL: .USE 142 1.47 christos @echo "${.TARGET}ing the kernel objects" 143 1.29 cgd rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 144 1.44 mycroft [Ee]rrs linterrs makelinks assym.h.tmp assym.h 145 1.47 christos 146 1.47 christos __CLEANDEPEND: .USE 147 1.47 christos rm -f .depend 148 1.47 christos 149 1.47 christos clean: __CLEANKERNEL 150 1.47 christos 151 1.53 lukem cleandir distclean: __CLEANKERNEL __CLEANDEPEND 152 1.1 deraadt 153 1.25 mycroft lint: 154 1.40 perry @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 155 1.41 perry ${SPARC}/sparc/Locore.c ${CFILES} \ 156 1.25 mycroft ioconf.c param.c | \ 157 1.25 mycroft grep -v 'static function .* unused' 158 1.1 deraadt 159 1.25 mycroft tags: 160 1.25 mycroft @echo "see $S/kern/Makefile for tags" 161 1.1 deraadt 162 1.1 deraadt links: 163 1.1 deraadt egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 164 1.1 deraadt sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 165 1.1 deraadt echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 166 1.1 deraadt sort -u | comm -23 - dontlink | \ 167 1.25 mycroft sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 168 1.1 deraadt sh makelinks && rm -f dontlink 169 1.1 deraadt 170 1.25 mycroft SRCS= ${SPARC}/sparc/locore.s \ 171 1.29 cgd param.c ioconf.c ${CFILES} ${SFILES} 172 1.39 pk depend: .depend 173 1.29 cgd .depend: ${SRCS} assym.h param.c 174 1.33 mycroft ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC}/sparc/locore.s 175 1.33 mycroft ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 176 1.60 pk .if !empty(SFILES) 177 1.33 mycroft ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 178 1.60 pk .endif 179 1.45 leo sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 180 1.45 leo ${CPPFLAGS} < ${SPARC}/sparc/genassym.cf 181 1.45 leo @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 182 1.45 leo @rm -f assym.dep 183 1.1 deraadt 184 1.25 mycroft # depend on root or device configuration 185 1.25 mycroft autoconf.o conf.o: Makefile 186 1.25 mycroft 187 1.25 mycroft # depend on network or filesystem configuration 188 1.25 mycroft uipc_proto.o vfs_conf.o: Makefile 189 1.1 deraadt 190 1.25 mycroft # depend on maxusers 191 1.43 christos machdep.o: Makefile 192 1.11 pk 193 1.25 mycroft # depend on CPU configuration 194 1.25 mycroft bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile 195 1.25 mycroft ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile 196 1.25 mycroft machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile 197 1.1 deraadt 198 1.5 deraadt 199 1.25 mycroft locore.o: ${SPARC}/sparc/locore.s assym.h 200 1.25 mycroft ${NORMAL_S} 201 1.5 deraadt 202 1.25 mycroft %RULES 203