1 # $NetBSD: Makefile.hp300,v 1.62 1998/04/12 23:47:43 tv 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/hp300/conf/``machineid'' 9 # after which you should do 10 # config machineid 11 # Machine generic makefile changes should be made in 12 # /sys/arch/hp300/conf/Makefile.hp300 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 HP300= $S/arch/hp300 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 -Dmc68020 -Dhp300 49 CWARNFLAGS?= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes 50 .if (${HAVE_GCC28} != "") 51 CWARNFLAGS+= -Wno-main 52 .endif 53 CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float 54 AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 55 LINKFLAGS= -n -Ttext 0 -e start 56 STRIPFLAGS= -d 57 58 HOSTED_CC= ${CC} 59 HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 60 HOSTED_CFLAGS= ${CFLAGS} 61 62 ### find out what to use for libkern 63 .include "$S/lib/libkern/Makefile.inc" 64 .ifndef PROF 65 LIBKERN= ${KERNLIB} 66 .else 67 LIBKERN= ${KERNLIB_PROF} 68 .endif 69 70 ### find out what to use for libcompat 71 .include "$S/compat/common/Makefile.inc" 72 .ifndef PROF 73 LIBCOMPAT= ${COMPATLIB} 74 .else 75 LIBCOMPAT= ${COMPATLIB_PROF} 76 .endif 77 78 ### for the Motorola 68040 Floating Point Software Product 79 .include "$S/arch/m68k/fpsp/Makefile.inc" 80 81 # compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 82 # HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 83 84 NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 85 NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 86 87 HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 88 89 %OBJS 90 91 %CFILES 92 93 #%SFILES 94 95 # load lines for config "xxx" will be emitted as: 96 # xxx: ${SYSTEM_DEP} swapxxx.o 97 # ${SYSTEM_LD_HEAD} 98 # ${SYSTEM_LD} swapxxx.o 99 # ${SYSTEM_LD_TAIL} 100 SYSTEM_OBJ= locore.o ${FPSP} \ 101 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 102 SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 103 SYSTEM_LD_HEAD= @rm -f $@ 104 SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 105 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 106 SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 107 108 DEBUG?= 109 .if ${DEBUG} == "-g" 110 LINKFLAGS+= -X 111 SYSTEM_LD_TAIL+=; \ 112 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 113 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 114 .else 115 LINKFLAGS+= -S 116 .endif 117 118 %LOAD 119 120 assym.h: $S/kern/genassym.sh ${HP300}/hp300/genassym.cf 121 sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 122 < ${HP300}/hp300/genassym.cf > assym.h.tmp && \ 123 mv -f assym.h.tmp assym.h 124 125 param.c: $S/conf/param.c 126 rm -f param.c 127 cp $S/conf/param.c . 128 129 param.o: param.c Makefile 130 ${NORMAL_C} 131 132 ioconf.o: ioconf.c 133 ${NORMAL_C} 134 135 newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 136 sh $S/conf/newvers.sh 137 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 138 139 __CLEANKERNEL: .USE 140 @echo "${.TARGET}ing the kernel objects" 141 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 142 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 143 144 __CLEANDEPEND: .USE 145 rm -f .depend 146 147 clean: __CLEANKERNEL 148 149 cleandir: __CLEANKERNEL __CLEANDEPEND 150 151 lint: 152 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 153 ${CFILES} ioconf.c param.c | \ 154 grep -v 'static function .* unused' 155 156 tags: 157 @echo "see $S/kern/Makefile for tags" 158 159 links: 160 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 161 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 162 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 163 sort -u | comm -23 - dontlink | \ 164 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 165 sh makelinks && rm -f dontlink 166 167 SRCS= ${HP300}/hp300/locore.s \ 168 param.c ioconf.c ${CFILES} ${SFILES} 169 depend: .depend 170 .depend: ${SRCS} assym.h param.c 171 ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${HP300}/hp300/locore.s 172 ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 173 -if test -n "${SFILES}"; then \ 174 ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES}; \ 175 fi 176 sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${CFLAGS} \ 177 ${CPPFLAGS} < ${HP300}/hp300/genassym.cf 178 @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 179 @rm -f assym.dep 180 181 182 # depend on root or device configuration 183 autoconf.o conf.o: Makefile 184 185 # depend on network or filesystem configuration 186 uipc_proto.o vfs_conf.o: Makefile 187 188 # depend on maxusers 189 machdep.o: Makefile 190 191 # depend on CPU configuration 192 dma.o hpux_machdep.o locore.o machdep.o pmap.o pmap_boostrap.o sys_machdep.o trap.o: Makefile 193 194 195 locore.o: ${HP300}/hp300/locore.s assym.h 196 ${NORMAL_S} 197 198 %RULES 199