Makefile.sun3 revision 1.52
1# $NetBSD: Makefile.sun3,v 1.52 1996/12/01 06:12:38 jonathan 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 24CC?= cc 25LD?= ld 26MKDEP?= mkdep 27STRIP?= strip 28COPTS?= -O2 29 30# source tree is located via $S relative to the compilation directory 31.ifndef S 32S!= cd ../../../..; pwd 33.endif 34SUN3= $S/arch/sun3 35 36# Override CPP defaults entirely, so cross-compilation works. 37INCLUDES= -I. -I$S/arch -I$S -nostdinc 38XDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 39CPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL \ 40 -Dmc68020 -Dsun3 ${XDEFS} 41CWARNFLAGS= -Werror # -Wall -Wstrict-prototypes -Wmissing-prototypes 42CFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -msoft-float 43AFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE 44LINKFLAGS= -N -Ttext 0E004000 -e start 45STRIPFLAGS= -d 46 47HOSTED_CC= ${CC} 48HOSTED_CPPFLAGS=${CPPFLAGS:S/^-nostdinc$//} 49HOSTED_CFLAGS= ${CFLAGS} 50 51### find out what to use for libkern 52.include "$S/lib/libkern/Makefile.inc" 53.ifndef PROF 54LIBKERN= ${KERNLIB} 55.else 56LIBKERN= ${KERNLIB_PROF} 57.endif 58 59### find out what to use for libcompat 60.include "$S/compat/common/Makefile.inc" 61.ifndef PROF 62LIBCOMPAT= ${COMPATLIB} 63.else 64LIBCOMPAT= ${COMPATLIB_PROF} 65.endif 66 67# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 68# HOSTED}, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 69 70NORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 71NORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 72 73HOSTED_C= ${HOSTED_CC} ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} -c $< 74 75%OBJS 76 77%CFILES 78 79%SFILES 80 81# load lines for config "xxx" will be emitted as: 82# xxx: ${SYSTEM_DEP} swapxxx.o 83# ${SYSTEM_LD_HEAD} 84# ${SYSTEM_LD} swapxxx.o 85# ${SYSTEM_LD_TAIL} 86SYSTEM_OBJ= locore.o \ 87 param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 88SYSTEM_DEP= Makefile ${SYSTEM_OBJ} 89SYSTEM_LD_HEAD= @rm -f $@ 90SYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 91 ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 92SYSTEM_LD_TAIL= @size $@; chmod 755 $@ 93 94DEBUG?= 95.if ${DEBUG} == "-g" 96LINKFLAGS+= -X 97SYSTEM_LD_TAIL+=; \ 98 echo cp $@ $@.gdb; rm -f $@.gdb; cp $@ $@.gdb; \ 99 echo ${STRIP} ${STRIPFLAGS} $@; ${STRIP} ${STRIPFLAGS} $@ 100.else 101LINKFLAGS+= -S 102.endif 103 104%LOAD 105 106assym.h: genassym 107 ./genassym >assym.h 108 109genassym: genassym.o 110 ${CC} -o $@ genassym.o 111 112genassym.o: ${SUN3}/sun3/genassym.c 113 ${HOSTED_C} 114 115param.c: $S/conf/param.c 116 rm -f param.c 117 cp $S/conf/param.c . 118 119param.o: param.c Makefile 120 ${NORMAL_C} 121 122ioconf.o: ioconf.c 123 ${NORMAL_C} 124 125newvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 126 sh $S/conf/newvers.sh 127 ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 128 129 130clean:: 131 rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 132 [Ee]rrs linterrs makelinks genassym genassym.o assym.h 133 134lint: 135 @lint -hbxncez -DGENERIC -Dvolatile= ${CPPFLAGS} -UKGDB \ 136 ${SUN3}/sun3/Locore.c ${CFILES} ${SUN3}/sun3/swapgeneric.c \ 137 ioconf.c param.c | \ 138 grep -v 'static function .* unused' 139 140tags: 141 @echo "see $S/kern/Makefile for tags" 142 143links: 144 egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 145 sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 146 echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 147 sort -u | comm -23 - dontlink | \ 148 sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 149 sh makelinks && rm -f dontlink 150 151SRCS= ${SUN3}/sun3/locore.s \ 152 param.c ioconf.c ${CFILES} ${SFILES} 153depend:: .depend 154.depend: ${SRCS} assym.h param.c 155 ${MKDEP} ${AFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 156 ${MKDEP} -a ${HOSTED_CFLAGS} ${HOSTED_CPPFLAGS} \ 157 ${SUN3}/sun3/genassym.c 158 159# XXX - see below 160# ${MKDEP} -a ${APPFLAGS} ${SUN3}/sun3/locore.s 161# ${MKDEP} -a ${APPFLAGS} ${SFILES} 162# 163# For cross-compilation, the "gcc -M" mkdep script is convenient, 164# but that does not correctly make rules from *.s files. The 165# easiest compromise is to just list those dependencies here. 166locore.o: assym.h machine/trap.h m68k/trap.h 167copy.o: assym.h $S/sys/errno.h 168 169 170# depend on root or device configuration 171autoconf.o conf.o: Makefile 172 173# depend on network or filesystem configuration 174uipc_proto.o vfs_conf.o: Makefile 175 176# depend on maxusers 177genassym.o machdep.o: Makefile 178 179# depend on CPU configuration 180db_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile 181 182 183locore.o: ${SUN3}/sun3/locore.s assym.h 184 ${NORMAL_S} 185 186%RULES 187