Makefile.sun3 revision 1.74
11.74Sthorpej# $NetBSD: Makefile.sun3,v 1.74 1999/01/15 23:21:27 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.67Sgwr.if ${MACHTYPE} == "sun3x" 501.67SgwrTEXTADDR=F8004000 511.67Sgwr.else 521.67SgwrTEXTADDR=0E004000 531.67Sgwr.endif 541.67Sgwr 551.45Sgwr# Override CPP defaults entirely, so cross-compilation works. 561.53Sgwr# Keep -nostdinc before all -I flags, similar for -undef ... 571.68StvHAVE_GCC28!= ${CC} --version | egrep "^(2\.8|egcs)" ; echo 581.53SgwrINCLUDES= -nostdinc -I. -I$S/arch -I$S 591.47SmycroftXDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 601.74SthorpejDEFINES= -D_KERNEL -Dsun3 611.53SgwrCPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 621.53Sgwr# Make it easy to override this on the command line... 631.73SaugustssCWARNFLAGS?= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 641.73Saugustss -Wpointer-arith 651.68Stv.if (${HAVE_GCC28} != "") 661.68StvCWARNFLAGS+= -Wno-main 671.68Stv.endif 681.53SgwrCFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 691.53Sgwr# No, we may NOT assume that the compiler does -x whatever... 701.53SgwrAPPFLAGS= -P -traditional ${CPPFLAGS} -D_LOCORE 711.67SgwrAFLAGS= 721.67SgwrLINKFLAGS= -N -Ttext ${TEXTADDR} -e start 731.51SmycroftSTRIPFLAGS= -d 741.51Smycroft 751.47Smycroft### find out what to use for libkern 761.71SdrochnerKERN_AS= obj 771.47Smycroft.include "$S/lib/libkern/Makefile.inc" 781.31Sgwr.ifndef PROF 791.47SmycroftLIBKERN= ${KERNLIB} 801.31Sgwr.else 811.47SmycroftLIBKERN= ${KERNLIB_PROF} 821.31Sgwr.endif 831.1Sglass 841.47Smycroft### find out what to use for libcompat 851.47Smycroft.include "$S/compat/common/Makefile.inc" 861.47Smycroft.ifndef PROF 871.47SmycroftLIBCOMPAT= ${COMPATLIB} 881.47Smycroft.else 891.47SmycroftLIBCOMPAT= ${COMPATLIB_PROF} 901.47Smycroft.endif 911.32Schristos 921.57Sgwr# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is 931.57Sgwr# the file suffix, capitalized (e.g. C for a .c file). 941.1Sglass 951.38SmycroftNORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 961.69SthorpejNOPROF_C= ${CC} ${CFLAGS} ${CPPFLAGS} -c $< 971.1Sglass 981.53Sgwr# Do NOT assume the compiler does "-x funny_format" (gcc-specific) 991.53Sgwr# This needs an intermediate file. The original file is always 1001.53Sgwr# safe in some far away directory, so just use the base name. 1011.53SgwrNORMAL_S= ${CPP} ${APPFLAGS} $< > $*.s ;\ 1021.58Sgwr ${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s 1031.53Sgwr 1041.53Sgwr# These comments help identify sections in the generated Makefile. 1051.53Sgwr# OBJS, CFILES, SFILES follow: 1061.48Smycroft 1071.1Sglass%OBJS 1081.1Sglass 1091.1Sglass%CFILES 1101.1Sglass 1111.38Smycroft%SFILES 1121.38Smycroft 1131.53Sgwr# OBJS, CFILES, SFILES done. 1141.53Sgwr 1151.1Sglass# load lines for config "xxx" will be emitted as: 1161.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o 1171.1Sglass# ${SYSTEM_LD_HEAD} 1181.1Sglass# ${SYSTEM_LD} swapxxx.o 1191.1Sglass# ${SYSTEM_LD_TAIL} 1201.38SmycroftSYSTEM_OBJ= locore.o \ 1211.71Sdrochner param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 1221.38SmycroftSYSTEM_DEP= Makefile ${SYSTEM_OBJ} 1231.38SmycroftSYSTEM_LD_HEAD= @rm -f $@ 1241.38SmycroftSYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 1251.38Smycroft ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 1261.62SlukemSYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 1271.38Smycroft 1281.38SmycroftDEBUG?= 1291.11Sderaadt.if ${DEBUG} == "-g" 1301.38SmycroftLINKFLAGS+= -X 1311.38SmycroftSYSTEM_LD_TAIL+=; \ 1321.53Sgwr mv -f $@ $@.gdb; cp -p $@.gdb $@; \ 1331.53Sgwr ${STRIP} ${STRIPFLAGS} $@ 1341.11Sderaadt.else 1351.41SgwrLINKFLAGS+= -S 1361.11Sderaadt.endif 1371.1Sglass 1381.53Sgwr# LOAD+ 1391.53Sgwr 1401.1Sglass%LOAD 1411.1Sglass 1421.53Sgwr# LOAD- 1431.53Sgwr 1441.57Sgwr# Use awk to cross-build assym.h from the genassym.s file. 1451.63Sgwrassym.h: genassym.o $S/kern/genassym.awk 1461.64Sgwr awk -f $S/kern/genassym.awk < genassym.s > assym.h.tmp 1471.64Sgwr mv -f assym.h.tmp $@ 1481.57Sgwr 1491.57Sgwr# The above rule lists genassym.o as a prerequisite so that the 1501.58Sgwr# generated .depend rule is effective, even though we actually 1511.58Sgwr# use genassym.s instead. This always creates both. 1521.67Sgwrgenassym.o: ${SUN3}/${MACHTYPE}/genassym.c 1531.58Sgwr ${CC} ${CPPFLAGS} -S $< 1541.57Sgwr ${CC} -c $*.s 1551.1Sglass 1561.38Smycroftparam.c: $S/conf/param.c 1571.38Smycroft rm -f param.c 1581.38Smycroft cp $S/conf/param.c . 1591.17Sgwr 1601.38Smycroftparam.o: param.c Makefile 1611.49Smycroft ${NORMAL_C} 1621.21Sgwr 1631.38Smycroftioconf.o: ioconf.c 1641.38Smycroft ${NORMAL_C} 1651.1Sglass 1661.38Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 1671.38Smycroft sh $S/conf/newvers.sh 1681.38Smycroft ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 1691.38Smycroft 1701.61Schristos__CLEANKERNEL: .USE 1711.61Schristos @echo "${.TARGET}ing the kernel objects" 1721.61Schristos rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 1731.61Schristos [Ee]rrs linterrs makelinks assym.h.tmp assym.h 1741.61Schristos 1751.61Schristos__CLEANDEPEND: .USE 1761.61Schristos rm -f .depend 1771.38Smycroft 1781.61Schristosclean: __CLEANKERNEL 1791.61Schristos 1801.70Slukemcleandir distclean: __CLEANKERNEL __CLEANDEPEND 1811.1Sglass 1821.38Smycroftlint: 1831.54Sperry @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 1841.60Smycroft ${CFILES} ioconf.c param.c | \ 1851.38Smycroft grep -v 'static function .* unused' 1861.1Sglass 1871.38Smycrofttags: 1881.38Smycroft @echo "see $S/kern/Makefile for tags" 1891.1Sglass 1901.1Sglasslinks: 1911.1Sglass egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 1921.1Sglass sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 1931.1Sglass echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 1941.1Sglass sort -u | comm -23 - dontlink | \ 1951.38Smycroft sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 1961.1Sglass sh makelinks && rm -f dontlink 1971.1Sglass 1981.67SgwrSRCS= ${SUN3}/${MACHTYPE}/locore.s \ 1991.43Scgd param.c ioconf.c ${CFILES} ${SFILES} 2001.53Sgwr 2011.56Sgwrdepend: .depend 2021.47Smycroft.depend: ${SRCS} assym.h param.c 2031.53Sgwr ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 2041.67Sgwr ${MKDEP} -a ${CPPFLAGS} ${SUN3}/${MACHTYPE}/genassym.c 2051.38Smycroft 2061.45Sgwr# XXX - see below 2071.67Sgwr# ${MKDEP} -a ${APPFLAGS} ${SUN3}/${MACHTYPE}/locore.s 2081.45Sgwr# ${MKDEP} -a ${APPFLAGS} ${SFILES} 2091.45Sgwr# 2101.45Sgwr# For cross-compilation, the "gcc -M" mkdep script is convenient, 2111.45Sgwr# but that does not correctly make rules from *.s files. The 2121.59Sgwr# easiest work-around is to just list those dependencies here. 2131.59Sgwrlocore.o: assym.h m68k/asm.h m68k/trap.h 2141.59Sgwrcopy.o: assym.h m68k/asm.h $S/sys/errno.h 2151.59Sgwrbcopy.o: assym.h m68k/asm.h 2161.59Sgwrcopypage.o: assym.h m68k/asm.h 2171.1Sglass 2181.38Smycroft# depend on root or device configuration 2191.59Sgwrconf.o: Makefile 2201.38Smycroft 2211.38Smycroft# depend on network or filesystem configuration 2221.38Smycroftuipc_proto.o vfs_conf.o: Makefile 2231.1Sglass 2241.38Smycroft# depend on maxusers 2251.59Sgwrmachdep.o: Makefile 2261.1Sglass 2271.38Smycroft# depend on CPU configuration 2281.38Smycroftdb_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile 2291.58Sgwr 2301.58Sgwr# depends on KGDBDEV, KGDBRATE 2311.58Sgwrkgdb_stub.o: Makefile 2321.64Sgwr 2331.64Sgwr# depends on DDB, etc. 2341.64Sgwrstub.o: Makefile 2351.1Sglass 2361.67Sgwrlocore.o: ${SUN3}/${MACHTYPE}/locore.s 2371.53Sgwr ${NORMAL_S} 2381.47Smycroft 2391.53Sgwr# Generated rules follow: 2401.1Sglass 2411.1Sglass%RULES 242