Makefile.sun3 revision 1.61
11.61Schristos# $NetBSD: Makefile.sun3,v 1.61 1997/09/30 23:04:28 christos Exp $ 21.23Scgd 31.24Sgwr# Makefile for NetBSD 41.1Sglass# 51.1Sglass# This makefile is constructed from a machine description: 61.1Sglass# config machineid 71.1Sglass# Most changes should be made in the machine description 81.35Sgwr# /sys/arch/sun3/conf/``machineid'' 91.1Sglass# after which you should do 101.38Smycroft# config machineid 111.1Sglass# Machine generic makefile changes should be made in 121.35Sgwr# /sys/arch/sun3/conf/Makefile.sun3 131.1Sglass# after which config should be rerun for all machines of that type. 141.1Sglass# 151.1Sglass# N.B.: NO DEPENDENCIES ON FOLLOWING FLAGS ARE VISIBLE TO MAKEFILE 161.1Sglass# IF YOU CHANGE THE DEFINITION OF ANY OF THESE RECOMPILE EVERYTHING 171.1Sglass# 181.1Sglass# -DTRACE compile in kernel tracing hooks 191.1Sglass# -DQUOTA compile in file system quotas 201.1Sglass 211.38Smycroft# DEBUG is set to -g if debugging. 221.38Smycroft# PROF is set to -pg if profiling. 231.38Smycroft 241.53Sgwr# XXX - Make cross-build work... 251.53SgwrMACHINE_ARCH=m68k 261.53SgwrMACHINE=sun3 271.53Sgwr 281.53SgwrAS?= as 291.42SmycroftCC?= cc 301.53SgwrCPP?= cpp 311.42SmycroftLD?= ld 321.45SgwrMKDEP?= mkdep 331.51SmycroftSTRIP?= strip 341.58SgwrCOPTS?= -O2 -fno-defer-pop 351.53Sgwr 361.1Sglass# source tree is located via $S relative to the compilation directory 371.50Smycroft.ifndef S 381.47SmycroftS!= cd ../../../..; pwd 391.50Smycroft.endif 401.47SmycroftSUN3= $S/arch/sun3 411.1Sglass 421.45Sgwr# Override CPP defaults entirely, so cross-compilation works. 431.53Sgwr# Keep -nostdinc before all -I flags, similar for -undef ... 441.53SgwrINCLUDES= -nostdinc -I. -I$S/arch -I$S 451.47SmycroftXDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 461.53SgwrDEFINES= -D_KERNEL -Dmc68020 -Dsun3 471.53SgwrCPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 481.53Sgwr# Make it easy to override this on the command line... 491.58SgwrCWARNFLAGS= -Wall -Wstrict-prototypes # -Wmissing-prototypes -Werror 501.53SgwrCFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 511.53Sgwr# No, we may NOT assume that the compiler does -x whatever... 521.53SgwrAPPFLAGS= -P -traditional ${CPPFLAGS} -D_LOCORE 531.58SgwrAFLAGS= -m68020 541.38SmycroftLINKFLAGS= -N -Ttext 0E004000 -e start 551.51SmycroftSTRIPFLAGS= -d 561.51Smycroft 571.47Smycroft### find out what to use for libkern 581.47Smycroft.include "$S/lib/libkern/Makefile.inc" 591.31Sgwr.ifndef PROF 601.47SmycroftLIBKERN= ${KERNLIB} 611.31Sgwr.else 621.47SmycroftLIBKERN= ${KERNLIB_PROF} 631.31Sgwr.endif 641.1Sglass 651.47Smycroft### find out what to use for libcompat 661.47Smycroft.include "$S/compat/common/Makefile.inc" 671.47Smycroft.ifndef PROF 681.47SmycroftLIBCOMPAT= ${COMPATLIB} 691.47Smycroft.else 701.47SmycroftLIBCOMPAT= ${COMPATLIB_PROF} 711.47Smycroft.endif 721.32Schristos 731.57Sgwr# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is 741.57Sgwr# the file suffix, capitalized (e.g. C for a .c file). 751.1Sglass 761.38SmycroftNORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 771.1Sglass 781.53Sgwr# Do NOT assume the compiler does "-x funny_format" (gcc-specific) 791.53Sgwr# This needs an intermediate file. The original file is always 801.53Sgwr# safe in some far away directory, so just use the base name. 811.53SgwrNORMAL_S= ${CPP} ${APPFLAGS} $< > $*.s ;\ 821.58Sgwr ${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s 831.53Sgwr 841.53Sgwr# These comments help identify sections in the generated Makefile. 851.53Sgwr# OBJS, CFILES, SFILES follow: 861.48Smycroft 871.1Sglass%OBJS 881.1Sglass 891.1Sglass%CFILES 901.1Sglass 911.38Smycroft%SFILES 921.38Smycroft 931.53Sgwr# OBJS, CFILES, SFILES done. 941.53Sgwr 951.1Sglass# load lines for config "xxx" will be emitted as: 961.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o 971.1Sglass# ${SYSTEM_LD_HEAD} 981.1Sglass# ${SYSTEM_LD} swapxxx.o 991.1Sglass# ${SYSTEM_LD_TAIL} 1001.38SmycroftSYSTEM_OBJ= locore.o \ 1011.43Scgd param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 1021.38SmycroftSYSTEM_DEP= Makefile ${SYSTEM_OBJ} 1031.38SmycroftSYSTEM_LD_HEAD= @rm -f $@ 1041.38SmycroftSYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 1051.38Smycroft ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 1061.53SgwrSYSTEM_LD_TAIL= size $@; chmod 755 $@ 1071.38Smycroft 1081.38SmycroftDEBUG?= 1091.11Sderaadt.if ${DEBUG} == "-g" 1101.38SmycroftLINKFLAGS+= -X 1111.38SmycroftSYSTEM_LD_TAIL+=; \ 1121.53Sgwr mv -f $@ $@.gdb; cp -p $@.gdb $@; \ 1131.53Sgwr ${STRIP} ${STRIPFLAGS} $@ 1141.11Sderaadt.else 1151.41SgwrLINKFLAGS+= -S 1161.11Sderaadt.endif 1171.1Sglass 1181.53Sgwr# LOAD+ 1191.53Sgwr 1201.1Sglass%LOAD 1211.1Sglass 1221.53Sgwr# LOAD- 1231.53Sgwr 1241.57Sgwr# Use awk to cross-build assym.h from the genassym.s file. 1251.58Sgwrassym.h: genassym.o ${SUN3}/sun3/genassym.awk 1261.57Sgwr awk -f ${SUN3}/sun3/genassym.awk < genassym.s > $@ 1271.57Sgwr 1281.57Sgwr# The above rule lists genassym.o as a prerequisite so that the 1291.58Sgwr# generated .depend rule is effective, even though we actually 1301.58Sgwr# use genassym.s instead. This always creates both. 1311.58Sgwrgenassym.o: ${SUN3}/sun3/genassym.c 1321.58Sgwr ${CC} ${CPPFLAGS} -S $< 1331.57Sgwr ${CC} -c $*.s 1341.1Sglass 1351.38Smycroftparam.c: $S/conf/param.c 1361.38Smycroft rm -f param.c 1371.38Smycroft cp $S/conf/param.c . 1381.17Sgwr 1391.38Smycroftparam.o: param.c Makefile 1401.49Smycroft ${NORMAL_C} 1411.21Sgwr 1421.38Smycroftioconf.o: ioconf.c 1431.38Smycroft ${NORMAL_C} 1441.1Sglass 1451.38Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 1461.38Smycroft sh $S/conf/newvers.sh 1471.38Smycroft ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 1481.38Smycroft 1491.61Schristos__CLEANKERNEL: .USE 1501.61Schristos @echo "${.TARGET}ing the kernel objects" 1511.61Schristos rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 1521.61Schristos [Ee]rrs linterrs makelinks assym.h.tmp assym.h 1531.61Schristos 1541.61Schristos__CLEANDEPEND: .USE 1551.61Schristos rm -f .depend 1561.38Smycroft 1571.61Schristosclean: __CLEANKERNEL 1581.61Schristos 1591.61Schristoscleandir: __CLEANKERNEL __CLEANDEPEND 1601.1Sglass 1611.38Smycroftlint: 1621.54Sperry @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 1631.60Smycroft ${CFILES} ioconf.c param.c | \ 1641.38Smycroft grep -v 'static function .* unused' 1651.1Sglass 1661.38Smycrofttags: 1671.38Smycroft @echo "see $S/kern/Makefile for tags" 1681.1Sglass 1691.1Sglasslinks: 1701.1Sglass egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 1711.1Sglass sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 1721.1Sglass echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 1731.1Sglass sort -u | comm -23 - dontlink | \ 1741.38Smycroft sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 1751.1Sglass sh makelinks && rm -f dontlink 1761.1Sglass 1771.38SmycroftSRCS= ${SUN3}/sun3/locore.s \ 1781.43Scgd param.c ioconf.c ${CFILES} ${SFILES} 1791.53Sgwr 1801.56Sgwrdepend: .depend 1811.47Smycroft.depend: ${SRCS} assym.h param.c 1821.53Sgwr ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 1831.53Sgwr ${MKDEP} -a ${CPPFLAGS} ${SUN3}/sun3/genassym.c 1841.38Smycroft 1851.45Sgwr# XXX - see below 1861.45Sgwr# ${MKDEP} -a ${APPFLAGS} ${SUN3}/sun3/locore.s 1871.45Sgwr# ${MKDEP} -a ${APPFLAGS} ${SFILES} 1881.45Sgwr# 1891.45Sgwr# For cross-compilation, the "gcc -M" mkdep script is convenient, 1901.45Sgwr# but that does not correctly make rules from *.s files. The 1911.59Sgwr# easiest work-around is to just list those dependencies here. 1921.59Sgwrlocore.o: assym.h m68k/asm.h m68k/trap.h 1931.59Sgwrcopy.o: assym.h m68k/asm.h $S/sys/errno.h 1941.59Sgwrbcopy.o: assym.h m68k/asm.h 1951.59Sgwrcopypage.o: assym.h m68k/asm.h 1961.1Sglass 1971.38Smycroft# depend on root or device configuration 1981.59Sgwrconf.o: Makefile 1991.38Smycroft 2001.38Smycroft# depend on network or filesystem configuration 2011.38Smycroftuipc_proto.o vfs_conf.o: Makefile 2021.1Sglass 2031.38Smycroft# depend on maxusers 2041.59Sgwrmachdep.o: Makefile 2051.1Sglass 2061.38Smycroft# depend on CPU configuration 2071.38Smycroftdb_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile 2081.58Sgwr 2091.58Sgwr# depends on KGDBDEV, KGDBRATE 2101.58Sgwrkgdb_stub.o: Makefile 2111.1Sglass 2121.53Sgwrlocore.o: ${SUN3}/sun3/locore.s 2131.53Sgwr ${NORMAL_S} 2141.47Smycroft 2151.53Sgwr# Generated rules follow: 2161.1Sglass 2171.1Sglass%RULES 218