Makefile.sun3 revision 1.67
11.67Sgwr# $NetBSD: Makefile.sun3,v 1.67 1998/02/05 04:56:30 gwr 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.53SgwrINCLUDES= -nostdinc -I. -I$S/arch -I$S 581.47SmycroftXDEFS= -undef -D__NetBSD__ -Dm68k -Dmc68000 591.53SgwrDEFINES= -D_KERNEL -Dmc68020 -Dsun3 601.53SgwrCPPFLAGS= ${INCLUDES} ${XDEFS} ${DEFINES} ${IDENT} ${PARAM} 611.53Sgwr# Make it easy to override this on the command line... 621.58SgwrCWARNFLAGS= -Wall -Wstrict-prototypes # -Wmissing-prototypes -Werror 631.53SgwrCFLAGS= ${DEBUG} ${COPTS} -msoft-float ${CWARNFLAGS} 641.53Sgwr# No, we may NOT assume that the compiler does -x whatever... 651.53SgwrAPPFLAGS= -P -traditional ${CPPFLAGS} -D_LOCORE 661.67SgwrAFLAGS= 671.67SgwrLINKFLAGS= -N -Ttext ${TEXTADDR} -e start 681.51SmycroftSTRIPFLAGS= -d 691.51Smycroft 701.47Smycroft### find out what to use for libkern 711.47Smycroft.include "$S/lib/libkern/Makefile.inc" 721.31Sgwr.ifndef PROF 731.47SmycroftLIBKERN= ${KERNLIB} 741.31Sgwr.else 751.47SmycroftLIBKERN= ${KERNLIB_PROF} 761.31Sgwr.endif 771.1Sglass 781.47Smycroft### find out what to use for libcompat 791.47Smycroft.include "$S/compat/common/Makefile.inc" 801.47Smycroft.ifndef PROF 811.47SmycroftLIBCOMPAT= ${COMPATLIB} 821.47Smycroft.else 831.47SmycroftLIBCOMPAT= ${COMPATLIB_PROF} 841.47Smycroft.endif 851.32Schristos 861.57Sgwr# compile rules: rules are named NORMAL_${SUFFIX} where SUFFIX is 871.57Sgwr# the file suffix, capitalized (e.g. C for a .c file). 881.1Sglass 891.38SmycroftNORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 901.1Sglass 911.53Sgwr# Do NOT assume the compiler does "-x funny_format" (gcc-specific) 921.53Sgwr# This needs an intermediate file. The original file is always 931.53Sgwr# safe in some far away directory, so just use the base name. 941.53SgwrNORMAL_S= ${CPP} ${APPFLAGS} $< > $*.s ;\ 951.58Sgwr ${AS} ${AFLAGS} -o $@ $*.s ; rm $*.s 961.53Sgwr 971.53Sgwr# These comments help identify sections in the generated Makefile. 981.53Sgwr# OBJS, CFILES, SFILES follow: 991.48Smycroft 1001.1Sglass%OBJS 1011.1Sglass 1021.1Sglass%CFILES 1031.1Sglass 1041.38Smycroft%SFILES 1051.38Smycroft 1061.53Sgwr# OBJS, CFILES, SFILES done. 1071.53Sgwr 1081.1Sglass# load lines for config "xxx" will be emitted as: 1091.1Sglass# xxx: ${SYSTEM_DEP} swapxxx.o 1101.1Sglass# ${SYSTEM_LD_HEAD} 1111.1Sglass# ${SYSTEM_LD} swapxxx.o 1121.1Sglass# ${SYSTEM_LD_TAIL} 1131.38SmycroftSYSTEM_OBJ= locore.o \ 1141.43Scgd param.o ioconf.o ${OBJS} ${LIBKERN} ${LIBCOMPAT} 1151.38SmycroftSYSTEM_DEP= Makefile ${SYSTEM_OBJ} 1161.38SmycroftSYSTEM_LD_HEAD= @rm -f $@ 1171.38SmycroftSYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 1181.38Smycroft ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 1191.62SlukemSYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 1201.38Smycroft 1211.38SmycroftDEBUG?= 1221.11Sderaadt.if ${DEBUG} == "-g" 1231.38SmycroftLINKFLAGS+= -X 1241.38SmycroftSYSTEM_LD_TAIL+=; \ 1251.53Sgwr mv -f $@ $@.gdb; cp -p $@.gdb $@; \ 1261.53Sgwr ${STRIP} ${STRIPFLAGS} $@ 1271.11Sderaadt.else 1281.41SgwrLINKFLAGS+= -S 1291.11Sderaadt.endif 1301.1Sglass 1311.53Sgwr# LOAD+ 1321.53Sgwr 1331.1Sglass%LOAD 1341.1Sglass 1351.53Sgwr# LOAD- 1361.53Sgwr 1371.57Sgwr# Use awk to cross-build assym.h from the genassym.s file. 1381.63Sgwrassym.h: genassym.o $S/kern/genassym.awk 1391.64Sgwr awk -f $S/kern/genassym.awk < genassym.s > assym.h.tmp 1401.64Sgwr mv -f assym.h.tmp $@ 1411.57Sgwr 1421.57Sgwr# The above rule lists genassym.o as a prerequisite so that the 1431.58Sgwr# generated .depend rule is effective, even though we actually 1441.58Sgwr# use genassym.s instead. This always creates both. 1451.67Sgwrgenassym.o: ${SUN3}/${MACHTYPE}/genassym.c 1461.58Sgwr ${CC} ${CPPFLAGS} -S $< 1471.57Sgwr ${CC} -c $*.s 1481.1Sglass 1491.38Smycroftparam.c: $S/conf/param.c 1501.38Smycroft rm -f param.c 1511.38Smycroft cp $S/conf/param.c . 1521.17Sgwr 1531.38Smycroftparam.o: param.c Makefile 1541.49Smycroft ${NORMAL_C} 1551.21Sgwr 1561.38Smycroftioconf.o: ioconf.c 1571.38Smycroft ${NORMAL_C} 1581.1Sglass 1591.38Smycroftnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 1601.38Smycroft sh $S/conf/newvers.sh 1611.38Smycroft ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 1621.38Smycroft 1631.61Schristos__CLEANKERNEL: .USE 1641.61Schristos @echo "${.TARGET}ing the kernel objects" 1651.61Schristos rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 1661.61Schristos [Ee]rrs linterrs makelinks assym.h.tmp assym.h 1671.61Schristos 1681.61Schristos__CLEANDEPEND: .USE 1691.61Schristos rm -f .depend 1701.38Smycroft 1711.61Schristosclean: __CLEANKERNEL 1721.61Schristos 1731.61Schristoscleandir: __CLEANKERNEL __CLEANDEPEND 1741.1Sglass 1751.38Smycroftlint: 1761.54Sperry @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 1771.60Smycroft ${CFILES} ioconf.c param.c | \ 1781.38Smycroft grep -v 'static function .* unused' 1791.1Sglass 1801.38Smycrofttags: 1811.38Smycroft @echo "see $S/kern/Makefile for tags" 1821.1Sglass 1831.1Sglasslinks: 1841.1Sglass egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 1851.1Sglass sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 1861.1Sglass echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 1871.1Sglass sort -u | comm -23 - dontlink | \ 1881.38Smycroft sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 1891.1Sglass sh makelinks && rm -f dontlink 1901.1Sglass 1911.67SgwrSRCS= ${SUN3}/${MACHTYPE}/locore.s \ 1921.43Scgd param.c ioconf.c ${CFILES} ${SFILES} 1931.53Sgwr 1941.56Sgwrdepend: .depend 1951.47Smycroft.depend: ${SRCS} assym.h param.c 1961.53Sgwr ${MKDEP} ${CPPFLAGS} param.c ioconf.c ${CFILES} 1971.67Sgwr ${MKDEP} -a ${CPPFLAGS} ${SUN3}/${MACHTYPE}/genassym.c 1981.38Smycroft 1991.45Sgwr# XXX - see below 2001.67Sgwr# ${MKDEP} -a ${APPFLAGS} ${SUN3}/${MACHTYPE}/locore.s 2011.45Sgwr# ${MKDEP} -a ${APPFLAGS} ${SFILES} 2021.45Sgwr# 2031.45Sgwr# For cross-compilation, the "gcc -M" mkdep script is convenient, 2041.45Sgwr# but that does not correctly make rules from *.s files. The 2051.59Sgwr# easiest work-around is to just list those dependencies here. 2061.59Sgwrlocore.o: assym.h m68k/asm.h m68k/trap.h 2071.59Sgwrcopy.o: assym.h m68k/asm.h $S/sys/errno.h 2081.59Sgwrbcopy.o: assym.h m68k/asm.h 2091.59Sgwrcopypage.o: assym.h m68k/asm.h 2101.1Sglass 2111.38Smycroft# depend on root or device configuration 2121.59Sgwrconf.o: Makefile 2131.38Smycroft 2141.38Smycroft# depend on network or filesystem configuration 2151.38Smycroftuipc_proto.o vfs_conf.o: Makefile 2161.1Sglass 2171.38Smycroft# depend on maxusers 2181.59Sgwrmachdep.o: Makefile 2191.1Sglass 2201.38Smycroft# depend on CPU configuration 2211.38Smycroftdb_machdep.o dvma.o machdep.o pmap.o sun3_startup.o vm_machdep.o: Makefile 2221.58Sgwr 2231.58Sgwr# depends on KGDBDEV, KGDBRATE 2241.58Sgwrkgdb_stub.o: Makefile 2251.64Sgwr 2261.64Sgwr# depends on DDB, etc. 2271.64Sgwrstub.o: Makefile 2281.1Sglass 2291.67Sgwrlocore.o: ${SUN3}/${MACHTYPE}/locore.s 2301.53Sgwr ${NORMAL_S} 2311.47Smycroft 2321.53Sgwr# Generated rules follow: 2331.1Sglass 2341.1Sglass%RULES 235