Makefile.sun3 revision 1.65
11.65Sthorpej# $NetBSD: Makefile.sun3,v 1.65 1997/11/12 22:26:35 thorpej 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.65SthorpejLORDER?=lorder 331.45SgwrMKDEP?= mkdep 341.65SthorpejNM?= nm 351.62SlukemSIZE?= size 361.51SmycroftSTRIP?= strip 371.65SthorpejTSORT?= tsort -q 381.58SgwrCOPTS?= -O2 -fno-defer-pop 391.53Sgwr 401.1Sglass# source tree is located via $S relative to the compilation directory 411.50Smycroft.ifndef S 421.47SmycroftS!= cd ../../../..; pwd 431.50Smycroft.endif 441.47SmycroftSUN3= $S/arch/sun3 451.1Sglass 461.45Sgwr# Override CPP defaults entirely, so cross-compilation works. 471.53Sgwr# Keep -nostdinc before all -I flags, similar for -undef ... 481.53SgwrINCLUDES= -nostdinc -I. -I$S/arch -I$S 491.47SmycroftXDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 501.53SgwrDEFINES= -D_KERNEL -Dmc68020 -Dsun3 511.53SgwrCPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 521.53Sgwr# Make it easy to override this on the command line... 531.58SgwrCWARNFLAGS= -Wall -Wstrict-prototypes # -Wmissing-prototypes -Werror 541.53SgwrCFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 551.53Sgwr# No, we may NOT assume that the compiler does -x whatever... 561.53SgwrAPPFLAGS= -P -traditional ${CPPFLAGS} -D_LOCORE 571.58SgwrAFLAGS= -m68020 581.38SmycroftLINKFLAGS= -N -Ttext 0E004000 -e start 591.51SmycroftSTRIPFLAGS= -d 601.51Smycroft 611.47Smycroft### find out what to use for libkern 621.47Smycroft.include "$S/lib/libkern/Makefile.inc" 631.31Sgwr.ifndef PROF 641.47SmycroftLIBKERN= ${KERNLIB} 651.31Sgwr.else 661.47SmycroftLIBKERN= ${KERNLIB_PROF} 671.31Sgwr.endif 681.1Sglass 691.47Smycroft### find out what to use for libcompat 701.47Smycroft.include "$S/compat/common/Makefile.inc" 711.47Smycroft.ifndef PROF 721.47SmycroftLIBCOMPAT= ${COMPATLIB} 731.47Smycroft.else 741.47SmycroftLIBCOMPAT= ${COMPATLIB_PROF} 751.47Smycroft.endif 761.32Schristos 771.57Sgwr# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is 781.57Sgwr# the file suffix, capitalized (e.g. C for a .c file). 791.1Sglass 801.38SmycroftNORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 811.1Sglass 821.53Sgwr# Do NOT assume the compiler does "-x funny_format" (gcc-specific) 831.53Sgwr# This needs an intermediate file. The original file is always 841.53Sgwr# safe in some far away directory, so just use the base name. 851.53SgwrNORMAL_S= ${CPP} ${APPFLAGS} $< > $*.s ;\ 861.58Sgwr ${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s 871.53Sgwr 881.53Sgwr# These comments help identify sections in the generated Makefile. 891.53Sgwr# OBJS, CFILES, SFILES follow: 901.48Smycroft 911.1Sglass%OBJS 921.1Sglass 931.1Sglass%CFILES 941.1Sglass 951.38Smycroft%SFILES 961.38Smycroft 971.53Sgwr# OBJS, CFILES, SFILES done. 981.53Sgwr 991.1Sglass# load lines for config "xxx" will be emitted as: 1001.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o 1011.1Sglass# ${SYSTEM_LD_HEAD} 1021.1Sglass# ${SYSTEM_LD} swapxxx.o 1031.1Sglass# ${SYSTEM_LD_TAIL} 1041.38SmycroftSYSTEM_OBJ= locore.o \ 1051.43Scgd param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 1061.38SmycroftSYSTEM_DEP= Makefile ${SYSTEM_OBJ} 1071.38SmycroftSYSTEM_LD_HEAD= @rm -f $@ 1081.38SmycroftSYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 1091.38Smycroft ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 1101.62SlukemSYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 1111.38Smycroft 1121.38SmycroftDEBUG?= 1131.11Sderaadt.if ${DEBUG} == "-g" 1141.38SmycroftLINKFLAGS+= -X 1151.38SmycroftSYSTEM_LD_TAIL+=; \ 1161.53Sgwr mv -f $@ $@.gdb; cp -p $@.gdb $@; \ 1171.53Sgwr ${STRIP} ${STRIPFLAGS} $@ 1181.11Sderaadt.else 1191.41SgwrLINKFLAGS+= -S 1201.11Sderaadt.endif 1211.1Sglass 1221.53Sgwr# LOAD+ 1231.53Sgwr 1241.1Sglass%LOAD 1251.1Sglass 1261.53Sgwr# LOAD- 1271.53Sgwr 1281.57Sgwr# Use awk to cross-build assym.h from the genassym.s file. 1291.63Sgwrassym.h: genassym.o $S/kern/genassym.awk 1301.64Sgwr awk -f $S/kern/genassym.awk < genassym.s > assym.h.tmp 1311.64Sgwr mv -f assym.h.tmp $@ 1321.57Sgwr 1331.57Sgwr# The above rule lists genassym.o as a prerequisite so that the 1341.58Sgwr# generated .depend rule is effective, even though we actually 1351.58Sgwr# use genassym.s instead. This always creates both. 1361.58Sgwrgenassym.o: ${SUN3}/sun3/genassym.c 1371.58Sgwr ${CC} ${CPPFLAGS} -S $< 1381.57Sgwr ${CC} -c $*.s 1391.1Sglass 1401.38Smycroftparam.c: $S/conf/param.c 1411.38Smycroft rm -f param.c 1421.38Smycroft cp $S/conf/param.c . 1431.17Sgwr 1441.38Smycroftparam.o: param.c Makefile 1451.49Smycroft ${NORMAL_C} 1461.21Sgwr 1471.38Smycroftioconf.o: ioconf.c 1481.38Smycroft ${NORMAL_C} 1491.1Sglass 1501.38Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 1511.38Smycroft sh $S/conf/newvers.sh 1521.38Smycroft ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 1531.38Smycroft 1541.61Schristos__CLEANKERNEL: .USE 1551.61Schristos @echo "${.TARGET}ing the kernel objects" 1561.61Schristos rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 1571.61Schristos [Ee]rrs linterrs makelinks assym.h.tmp assym.h 1581.61Schristos 1591.61Schristos__CLEANDEPEND: .USE 1601.61Schristos rm -f .depend 1611.38Smycroft 1621.61Schristosclean: __CLEANKERNEL 1631.61Schristos 1641.61Schristoscleandir: __CLEANKERNEL __CLEANDEPEND 1651.1Sglass 1661.38Smycroftlint: 1671.54Sperry @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 1681.60Smycroft ${CFILES} ioconf.c param.c | \ 1691.38Smycroft grep -v 'static function .* unused' 1701.1Sglass 1711.38Smycrofttags: 1721.38Smycroft @echo "see $S/kern/Makefile for tags" 1731.1Sglass 1741.1Sglasslinks: 1751.1Sglass egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 1761.1Sglass sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 1771.1Sglass echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 1781.1Sglass sort -u | comm -23 - dontlink | \ 1791.38Smycroft sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 1801.1Sglass sh makelinks && rm -f dontlink 1811.1Sglass 1821.38SmycroftSRCS= ${SUN3}/sun3/locore.s \ 1831.43Scgd param.c ioconf.c ${CFILES} ${SFILES} 1841.53Sgwr 1851.56Sgwrdepend: .depend 1861.47Smycroft.depend: ${SRCS} assym.h param.c 1871.53Sgwr ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 1881.53Sgwr ${MKDEP} -a ${CPPFLAGS} ${SUN3}/sun3/genassym.c 1891.38Smycroft 1901.45Sgwr# XXX - see below 1911.45Sgwr# ${MKDEP} -a ${APPFLAGS} ${SUN3}/sun3/locore.s 1921.45Sgwr# ${MKDEP} -a ${APPFLAGS} ${SFILES} 1931.45Sgwr# 1941.45Sgwr# For cross-compilation, the "gcc -M" mkdep script is convenient, 1951.45Sgwr# but that does not correctly make rules from *.s files. The 1961.59Sgwr# easiest work-around is to just list those dependencies here. 1971.59Sgwrlocore.o: assym.h m68k/asm.h m68k/trap.h 1981.59Sgwrcopy.o: assym.h m68k/asm.h $S/sys/errno.h 1991.59Sgwrbcopy.o: assym.h m68k/asm.h 2001.59Sgwrcopypage.o: assym.h m68k/asm.h 2011.1Sglass 2021.38Smycroft# depend on root or device configuration 2031.59Sgwrconf.o: Makefile 2041.38Smycroft 2051.38Smycroft# depend on network or filesystem configuration 2061.38Smycroftuipc_proto.o vfs_conf.o: Makefile 2071.1Sglass 2081.38Smycroft# depend on maxusers 2091.59Sgwrmachdep.o: Makefile 2101.1Sglass 2111.38Smycroft# depend on CPU configuration 2121.38Smycroftdb_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile 2131.58Sgwr 2141.58Sgwr# depends on KGDBDEV, KGDBRATE 2151.58Sgwrkgdb_stub.o: Makefile 2161.64Sgwr 2171.64Sgwr# depends on DDB, etc. 2181.64Sgwrstub.o: Makefile 2191.1Sglass 2201.53Sgwrlocore.o: ${SUN3}/sun3/locore.s 2211.53Sgwr ${NORMAL_S} 2221.47Smycroft 2231.53Sgwr# Generated rules follow: 2241.1Sglass 2251.1Sglass%RULES 226