Makefile.sun2 revision 1.8
1# $NetBSD: Makefile.sun2,v 1.8 2001/11/20 08:43:38 lukem 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/sun2/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/sun2/conf/Makefile.sun2 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 21MACHINE_ARCH=m68000 22USETOOLS?= no 23 24.include <bsd.own.mk> 25 26# DEBUG is set to -g if debugging. 27# PROF is set to -pg if profiling. 28 29AR?= ar 30AS?= as 31CC?= cc 32CPP?= cpp 33LD?= ld 34LORDER?=lorder 35MKDEP?= mkdep 36NM?= nm 37RANLIB?=ranlib 38SIZE?= size 39STRIP?= strip 40TSORT?= tsort -q 41 42COPTS?= -O2 -fno-defer-pop 43 44# source tree is located via $S relative to the compilation directory 45.ifndef S 46S!= cd ../../../..; pwd 47.endif 48SUN2= $S/arch/sun2 49 50TEXTADDR=00006000 51 52# Override CPP defaults entirely, so cross-compilation works. 53# Keep -nostdinc before all -I flags, similar for -undef ... 54HAVE_EGCS!= ${CC} --version | egrep "^(2\.[89]|egcs)" ; echo 55INCLUDES= -nostdinc -I. -I$S/arch -I$S 56XDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 -D__ELF__ -D__SVR4_ABI__ 57DEFINES= -D_KERNEL -D_KERNEL_OPT -Dsun2 58CPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 59# Make it easy to override this on the command line... 60CWARNFLAGS?= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 61 -Wpointer-arith 62# XXX Delete -Wuninitialized for now, since the compiler doesn't 63# XXX always get it right. --thorpej 64CWARNFLAGS+= -Wno-uninitialized 65.if (${HAVE_EGCS} != "") 66CWARNFLAGS+= -Wno-main 67.endif 68CFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 69APPFLAGS= -x assembler-with-cpp -P -traditional ${CPPFLAGS} -D_LOCORE 70AFLAGS= 71LINKFLAGS= -N -Ttext ${TEXTADDR} -e start 72STRIPFLAGS= -g 73 74%INCLUDES 75 76### find out what to use for libkern 77KERN_AS= obj 78# XXX lib/libkern/arch/m68k/Makefile.inc needs to know that 79# XXX our MACHINE_ARCH is m68000, and not m68k. --fredette 80KERNMISCMAKEFLAGS= MACHINE_ARCH=${MACHINE_ARCH} 81.include "$S/lib/libkern/Makefile.inc" 82.ifndef PROF 83LIBKERN= ${KERNLIB} 84.else 85LIBKERN= ${KERNLIB_PROF} 86.endif 87 88### find out what to use for libcompat 89.include "$S/compat/common/Makefile.inc" 90.ifndef PROF 91LIBCOMPAT= ${COMPATLIB} 92.else 93LIBCOMPAT= ${COMPATLIB_PROF} 94.endif 95 96# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is 97# the file suffix, capitalized (e.g. C for a .c file). 98 99NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 100NOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 101 102# Do NOT assume the compiler does "-x funny_format" (gcc-specific) 103# This needs an intermediate file. The original file is always 104# safe in some far away directory, so just use the base name. 105NORMAL_S= ${CPP} ${APPFLAGS} $< > $*.s ;\ 106 ${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s 107 108# These comments help identify sections in the generated Makefile. 109# OBJS, CFILES, SFILES follow: 110 111%OBJS 112 113%CFILES 114 115%SFILES 116 117# OBJS, CFILES, SFILES done. 118 119# load lines for config "xxx" will be emitted as: 120# xxx: ${SYSTEM_DEP} swapxxx.o 121# ${SYSTEM_LD_HEAD} 122# ${SYSTEM_LD} swapxxx.o 123# ${SYSTEM_LD_TAIL} 124SYSTEM_OBJ= locore.o \ 125 param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 126SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 127SYSTEM_LD_HEAD= @rm -f $@ 128SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 129 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 130SYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 131 132DEBUG?= 133.if ${DEBUG} == "-g" 134LINKFLAGS+= -X 135SYSTEM_LD_TAIL+=; \ 136 echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 137 echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 138 ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 139.else 140LINKFLAGS+= -S 141.endif 142 143# LOAD+ 144 145%LOAD 146 147# LOAD- 148 149# Use awk to cross-build assym.h from the genassym.s file. 150assym.h: genassym.o $S/kern/genassym.awk 151 awk -f $S/kern/genassym.awk < genassym.s > assym.h.tmp 152 mv -f assym.h.tmp $@ 153 154# The above rule lists genassym.o as a prerequisite so that the 155# generated .depend rule is effective, even though we actually 156# use genassym.s instead. This always creates both. 157genassym.o: ${SUN2}/sun2/genassym.c 158 ${CC} ${CPPFLAGS} -S $< 159 ${CC} -c $*.s 160 161param.c: $S/conf/param.c 162 rm -f param.c 163 cp $S/conf/param.c . 164 165param.o: param.c Makefile 166 ${NORMAL_C} 167 168ioconf.o: ioconf.c 169 ${NORMAL_C} 170 171newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 172 sh $S/conf/newvers.sh 173 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 174 175__CLEANKERNEL: .USE 176 @echo "${.TARGET}ing the kernel objects" 177 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 178 [Ee]rrs linterrs makelinks assym.h.tmp assym.h 179 180__CLEANDEPEND: .USE 181 rm -f .depend 182 183clean: __CLEANKERNEL 184 185cleandir distclean: __CLEANKERNEL __CLEANDEPEND 186 187lint: 188 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 189 ${CFILES} ioconf.c param.c | \ 190 grep -v 'static function .* unused' 191 192tags: 193 @echo "see $S/kern/Makefile for tags" 194 195links: 196 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 197 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 198 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 199 sort -u | comm -23 - dontlink | \ 200 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 201 sh makelinks && rm -f dontlink 202 203SRCS= ${SUN2}/sun2/locore.s \ 204 param.c ioconf.c ${CFILES} ${SFILES} 205 206depend: .depend 207.depend: ${SRCS} assym.h param.c 208 ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 209 ${MKDEP} -a ${CPPFLAGS} ${SUN2}/sun2/genassym.c 210 211dependall: depend all 212 213 214# XXX - see below 215# ${MKDEP} -a ${APPFLAGS} ${SUN2}/sun2/locore.s 216# ${MKDEP} -a ${APPFLAGS} ${SFILES} 217# 218# For cross-compilation, the "gcc -M" mkdep script is convenient, 219# but that does not correctly make rules from *.s files. The 220# easiest work-around is to just list those dependencies here. 221locore.o: assym.h m68k/asm.h m68k/trap.h 222copy.o: assym.h m68k/asm.h $S/sys/errno.h 223bcopy.o: assym.h m68k/asm.h 224copypage.o: assym.h m68k/asm.h 225 226# depend on root or device configuration 227conf.o: Makefile 228 229# depend on network or filesystem configuration 230uipc_proto.o vfs_conf.o: Makefile 231 232# depend on maxusers 233machdep.o: Makefile 234 235# depend on CPU configuration 236db_machdep.o dvma.o machdep.o pmap.o sun2_startup.o vm_machdep.o: Makefile 237 238# depends on DDB, etc. 239stub.o: Makefile 240 241locore.o: ${SUN2}/sun2/locore.s 242 ${NORMAL_S} 243 244# Generated rules follow: 245 246# The install target can be redefined by putting a 247# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 248MACHINE_NAME!= uname -n 249install: install-kernel-${MACHINE_NAME} 250.if !target(install-kernel-${MACHINE_NAME}}) 251install-kernel-${MACHINE_NAME}: 252 rm -f /onetbsd 253 ln /netbsd /onetbsd 254 cp netbsd /nnetbsd 255 mv /nnetbsd /netbsd 256.endif 257 258%RULES 259