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