Makefile.sun3 revision 1.66
11.66Sthorpej# $NetBSD: Makefile.sun3,v 1.66 1997/11/12 23:12:32 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.66SthorpejAR?= ar 291.53SgwrAS?= as 301.42SmycroftCC?= cc 311.53SgwrCPP?= cpp 321.42SmycroftLD?= ld 331.65SthorpejLORDER?=lorder 341.45SgwrMKDEP?= mkdep 351.65SthorpejNM?= nm 361.66SthorpejRANLIB?=ranlib 371.62SlukemSIZE?= size 381.51SmycroftSTRIP?= strip 391.65SthorpejTSORT?= tsort -q 401.66Sthorpej 411.58SgwrCOPTS?= -O2 -fno-defer-pop 421.53Sgwr 431.1Sglass# source tree is located via $S relative to the compilation directory 441.50Smycroft.ifndef S 451.47SmycroftS!= cd ../../../..; pwd 461.50Smycroft.endif 471.47SmycroftSUN3= $S/arch/sun3 481.1Sglass 491.45Sgwr# Override CPP defaults entirely, so cross-compilation works. 501.53Sgwr# Keep -nostdinc before all -I flags, similar for -undef ... 511.53SgwrINCLUDES= -nostdinc -I. -I$S/arch -I$S 521.47SmycroftXDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 531.53SgwrDEFINES= -D_KERNEL -Dmc68020 -Dsun3 541.53SgwrCPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 551.53Sgwr# Make it easy to override this on the command line... 561.58SgwrCWARNFLAGS= -Wall -Wstrict-prototypes # -Wmissing-prototypes -Werror 571.53SgwrCFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 581.53Sgwr# No, we may NOT assume that the compiler does -x whatever... 591.53SgwrAPPFLAGS= -P -traditional ${CPPFLAGS} -D_LOCORE 601.58SgwrAFLAGS= -m68020 611.38SmycroftLINKFLAGS= -N -Ttext 0E004000 -e start 621.51SmycroftSTRIPFLAGS= -d 631.51Smycroft 641.47Smycroft### find out what to use for libkern 651.47Smycroft.include "$S/lib/libkern/Makefile.inc" 661.31Sgwr.ifndef PROF 671.47SmycroftLIBKERN= ${KERNLIB} 681.31Sgwr.else 691.47SmycroftLIBKERN= ${KERNLIB_PROF} 701.31Sgwr.endif 711.1Sglass 721.47Smycroft### find out what to use for libcompat 731.47Smycroft.include "$S/compat/common/Makefile.inc" 741.47Smycroft.ifndef PROF 751.47SmycroftLIBCOMPAT= ${COMPATLIB} 761.47Smycroft.else 771.47SmycroftLIBCOMPAT= ${COMPATLIB_PROF} 781.47Smycroft.endif 791.32Schristos 801.57Sgwr# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is 811.57Sgwr# the file suffix, capitalized (e.g. C for a .c file). 821.1Sglass 831.38SmycroftNORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 841.1Sglass 851.53Sgwr# Do NOT assume the compiler does "-x funny_format" (gcc-specific) 861.53Sgwr# This needs an intermediate file. The original file is always 871.53Sgwr# safe in some far away directory, so just use the base name. 881.53SgwrNORMAL_S= ${CPP} ${APPFLAGS} $< > $*.s ;\ 891.58Sgwr ${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s 901.53Sgwr 911.53Sgwr# These comments help identify sections in the generated Makefile. 921.53Sgwr# OBJS, CFILES, SFILES follow: 931.48Smycroft 941.1Sglass%OBJS 951.1Sglass 961.1Sglass%CFILES 971.1Sglass 981.38Smycroft%SFILES 991.38Smycroft 1001.53Sgwr# OBJS, CFILES, SFILES done. 1011.53Sgwr 1021.1Sglass# load lines for config "xxx" will be emitted as: 1031.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o 1041.1Sglass# ${SYSTEM_LD_HEAD} 1051.1Sglass# ${SYSTEM_LD} swapxxx.o 1061.1Sglass# ${SYSTEM_LD_TAIL} 1071.38SmycroftSYSTEM_OBJ= locore.o \ 1081.43Scgd param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 1091.38SmycroftSYSTEM_DEP= Makefile ${SYSTEM_OBJ} 1101.38SmycroftSYSTEM_LD_HEAD= @rm -f $@ 1111.38SmycroftSYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 1121.38Smycroft ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 1131.62SlukemSYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 1141.38Smycroft 1151.38SmycroftDEBUG?= 1161.11Sderaadt.if ${DEBUG} == "-g" 1171.38SmycroftLINKFLAGS+= -X 1181.38SmycroftSYSTEM_LD_TAIL+=; \ 1191.53Sgwr mv -f $@ $@.gdb; cp -p $@.gdb $@; \ 1201.53Sgwr ${STRIP} ${STRIPFLAGS} $@ 1211.11Sderaadt.else 1221.41SgwrLINKFLAGS+= -S 1231.11Sderaadt.endif 1241.1Sglass 1251.53Sgwr# LOAD+ 1261.53Sgwr 1271.1Sglass%LOAD 1281.1Sglass 1291.53Sgwr# LOAD- 1301.53Sgwr 1311.57Sgwr# Use awk to cross-build assym.h from the genassym.s file. 1321.63Sgwrassym.h: genassym.o $S/kern/genassym.awk 1331.64Sgwr awk -f $S/kern/genassym.awk < genassym.s > assym.h.tmp 1341.64Sgwr mv -f assym.h.tmp $@ 1351.57Sgwr 1361.57Sgwr# The above rule lists genassym.o as a prerequisite so that the 1371.58Sgwr# generated .depend rule is effective, even though we actually 1381.58Sgwr# use genassym.s instead. This always creates both. 1391.58Sgwrgenassym.o: ${SUN3}/sun3/genassym.c 1401.58Sgwr ${CC} ${CPPFLAGS} -S $< 1411.57Sgwr ${CC} -c $*.s 1421.1Sglass 1431.38Smycroftparam.c: $S/conf/param.c 1441.38Smycroft rm -f param.c 1451.38Smycroft cp $S/conf/param.c . 1461.17Sgwr 1471.38Smycroftparam.o: param.c Makefile 1481.49Smycroft ${NORMAL_C} 1491.21Sgwr 1501.38Smycroftioconf.o: ioconf.c 1511.38Smycroft ${NORMAL_C} 1521.1Sglass 1531.38Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 1541.38Smycroft sh $S/conf/newvers.sh 1551.38Smycroft ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 1561.38Smycroft 1571.61Schristos__CLEANKERNEL: .USE 1581.61Schristos @echo "${.TARGET}ing the kernel objects" 1591.61Schristos rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 1601.61Schristos [Ee]rrs linterrs makelinks assym.h.tmp assym.h 1611.61Schristos 1621.61Schristos__CLEANDEPEND: .USE 1631.61Schristos rm -f .depend 1641.38Smycroft 1651.61Schristosclean: __CLEANKERNEL 1661.61Schristos 1671.61Schristoscleandir: __CLEANKERNEL __CLEANDEPEND 1681.1Sglass 1691.38Smycroftlint: 1701.54Sperry @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 1711.60Smycroft ${CFILES} ioconf.c param.c | \ 1721.38Smycroft grep -v 'static function .* unused' 1731.1Sglass 1741.38Smycrofttags: 1751.38Smycroft @echo "see $S/kern/Makefile for tags" 1761.1Sglass 1771.1Sglasslinks: 1781.1Sglass egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 1791.1Sglass sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 1801.1Sglass echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 1811.1Sglass sort -u | comm -23 - dontlink | \ 1821.38Smycroft sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 1831.1Sglass sh makelinks && rm -f dontlink 1841.1Sglass 1851.38SmycroftSRCS= ${SUN3}/sun3/locore.s \ 1861.43Scgd param.c ioconf.c ${CFILES} ${SFILES} 1871.53Sgwr 1881.56Sgwrdepend: .depend 1891.47Smycroft.depend: ${SRCS} assym.h param.c 1901.53Sgwr ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 1911.53Sgwr ${MKDEP} -a ${CPPFLAGS} ${SUN3}/sun3/genassym.c 1921.38Smycroft 1931.45Sgwr# XXX - see below 1941.45Sgwr# ${MKDEP} -a ${APPFLAGS} ${SUN3}/sun3/locore.s 1951.45Sgwr# ${MKDEP} -a ${APPFLAGS} ${SFILES} 1961.45Sgwr# 1971.45Sgwr# For cross-compilation, the "gcc -M" mkdep script is convenient, 1981.45Sgwr# but that does not correctly make rules from *.s files. The 1991.59Sgwr# easiest work-around is to just list those dependencies here. 2001.59Sgwrlocore.o: assym.h m68k/asm.h m68k/trap.h 2011.59Sgwrcopy.o: assym.h m68k/asm.h $S/sys/errno.h 2021.59Sgwrbcopy.o: assym.h m68k/asm.h 2031.59Sgwrcopypage.o: assym.h m68k/asm.h 2041.1Sglass 2051.38Smycroft# depend on root or device configuration 2061.59Sgwrconf.o: Makefile 2071.38Smycroft 2081.38Smycroft# depend on network or filesystem configuration 2091.38Smycroftuipc_proto.o vfs_conf.o: Makefile 2101.1Sglass 2111.38Smycroft# depend on maxusers 2121.59Sgwrmachdep.o: Makefile 2131.1Sglass 2141.38Smycroft# depend on CPU configuration 2151.38Smycroftdb_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile 2161.58Sgwr 2171.58Sgwr# depends on KGDBDEV, KGDBRATE 2181.58Sgwrkgdb_stub.o: Makefile 2191.64Sgwr 2201.64Sgwr# depends on DDB, etc. 2211.64Sgwrstub.o: Makefile 2221.1Sglass 2231.53Sgwrlocore.o: ${SUN3}/sun3/locore.s 2241.53Sgwr ${NORMAL_S} 2251.47Smycroft 2261.53Sgwr# Generated rules follow: 2271.1Sglass 2281.1Sglass%RULES 229