Makefile.sun3 revision 1.54
1# $NetBSD: Makefile.sun3,v 1.54 1997/02/04 04:32:21 perry 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/sun3/conf/``machineid'' 9# after which you should do 10# config machineid 11# Machine generic makefile changes should be made in 12# /sys/arch/sun3/conf/Makefile.sun3 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# XXX - Make cross-build work... 25MACHINE_ARCH=m68k 26MACHINE=sun3 27 28AS?= as 29CC?= cc 30CPP?= cpp 31LD?= ld 32MKDEP?= mkdep 33STRIP?= strip 34COPTS?= -O2 35 36# Need to override this for cross compilation. 37HOSTED_CC?= ${CC} 38 39# source tree is located via $S relative to the compilation directory 40.ifndef S 41S!= cd ../../../..; pwd 42.endif 43SUN3= $S/arch/sun3 44 45# Override CPP defaults entirely, so cross-compilation works. 46# Keep -nostdinc before all -I flags, similar for -undef ... 47INCLUDES= -nostdinc -I. -I$S/arch -I$S 48XDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 49DEFINES= -D_KERNEL -Dmc68020 -Dsun3 50CPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 51# Make it easy to override this on the command line... 52CWARNFLAGS= -Werror -Wall -Wstrict-prototypes # -Wmissing-prototypes 53CFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 54# No, we may NOT assume that the compiler does -x whatever... 55APPFLAGS= -P -traditional ${CPPFLAGS} -D_LOCORE 56LINKFLAGS= -N -Ttext 0E004000 -e start 57STRIPFLAGS= -d 58 59### find out what to use for libkern 60.include "$S/lib/libkern/Makefile.inc" 61.ifndef PROF 62LIBKERN= ${KERNLIB} 63.else 64LIBKERN= ${KERNLIB_PROF} 65.endif 66 67### find out what to use for libcompat 68.include "$S/compat/common/Makefile.inc" 69.ifndef PROF 70LIBCOMPAT= ${COMPATLIB} 71.else 72LIBCOMPAT= ${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 78NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 79 80# Do NOT assume the compiler does "-x funny_format" (gcc-specific) 81# This needs an intermediate file. The original file is always 82# safe in some far away directory, so just use the base name. 83NORMAL_S= ${CPP} ${APPFLAGS} $< > $*.s ;\ 84 ${AS} -o $@ $*.s ; rm $*.s 85 86# These comments help identify sections in the generated Makefile. 87# OBJS, CFILES, SFILES follow: 88 89%OBJS 90 91%CFILES 92 93%SFILES 94 95# OBJS, CFILES, SFILES done. 96 97# load lines for config "xxx" will be emitted as: 98# xxx: ${SYSTEM_DEP} swapxxx.o 99# ${SYSTEM_LD_HEAD} 100# ${SYSTEM_LD} swapxxx.o 101# ${SYSTEM_LD_TAIL} 102SYSTEM_OBJ= locore.o \ 103 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 104SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 105SYSTEM_LD_HEAD= @rm -f $@ 106SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 107 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 108SYSTEM_LD_TAIL= size $@; chmod 755 $@ 109 110DEBUG?= 111.if ${DEBUG} == "-g" 112LINKFLAGS+= -X 113SYSTEM_LD_TAIL+=; \ 114 mv -f $@ $@.gdb; cp -p $@.gdb $@; \ 115 ${STRIP} ${STRIPFLAGS} $@ 116.else 117LINKFLAGS+= -S 118.endif 119 120# LOAD+ 121 122%LOAD 123 124# LOAD- 125 126assym.h: genassym 127 ./genassym >assym.h 128 129# Doing a cross-build of this is very tricky, and very dependent 130# on compatibility of things like structure member alignment in 131# the compiler used as HOSTED_CC (must match the native compiler). 132# Often this is not possible at all, and you just have to build 133# the assym.h file by hand on some other machine. -gwr 134genassym: ${SUN3}/sun3/genassym.c 135 ${CC} ${CPPFLAGS} -E $< > $@.i 136 ${HOSTED_CC} -o $@ $@.i 137 138param.c: $S/conf/param.c 139 rm -f param.c 140 cp $S/conf/param.c . 141 142param.o: param.c Makefile 143 ${NORMAL_C} 144 145ioconf.o: ioconf.c 146 ${NORMAL_C} 147 148newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 149 sh $S/conf/newvers.sh 150 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 151 152 153clean:: 154 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 155 [Ee]rrs linterrs makelinks genassym genassym.o assym.h 156 157lint: 158 @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 159 ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \ 160 ioconf.c param.c | \ 161 grep -v 'static function .* unused' 162 163tags: 164 @echo "see $S/kern/Makefile for tags" 165 166links: 167 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 168 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 169 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 170 sort -u | comm -23 - dontlink | \ 171 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 172 sh makelinks && rm -f dontlink 173 174SRCS= ${SUN3}/sun3/locore.s \ 175 param.c ioconf.c ${CFILES} ${SFILES} 176 177depend:: .depend 178.depend: ${SRCS} assym.h param.c 179 ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 180 ${MKDEP} -a ${CPPFLAGS} ${SUN3}/sun3/genassym.c 181 182# XXX - see below 183# ${MKDEP} -a ${APPFLAGS} ${SUN3}/sun3/locore.s 184# ${MKDEP} -a ${APPFLAGS} ${SFILES} 185# 186# For cross-compilation, the "gcc -M" mkdep script is convenient, 187# but that does not correctly make rules from *.s files. The 188# easiest compromise is to just list those dependencies here. 189locore.o: assym.h machine/trap.h m68k/trap.h 190copy.o: assym.h $S/sys/errno.h 191 192# depend on root or device configuration 193autoconf.o conf.o: Makefile 194 195# depend on network or filesystem configuration 196uipc_proto.o vfs_conf.o: Makefile 197 198# depend on maxusers 199genassym.o machdep.o: Makefile 200 201# depend on CPU configuration 202db_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile 203 204locore.o: ${SUN3}/sun3/locore.s 205 ${NORMAL_S} 206 207# Generated rules follow: 208 209%RULES 210