Makefile.sparc64 revision 1.40
11.40Sthorpej# $NetBSD: Makefile.sparc64,v 1.40 2001/10/24 18:49:39 thorpej Exp $ 21.1Seeh 31.1Seeh# Makefile for NetBSD 41.1Seeh# 51.1Seeh# This makefile is constructed from a machine description: 61.1Seeh# config machineid 71.1Seeh# Most changes should be made in the machine description 81.1Seeh# /sys/arch/sparc64/conf/``machineid'' 91.1Seeh# after which you should do 101.1Seeh# config machineid 111.1Seeh# Machine generic makefile changes should be made in 121.1Seeh# /sys/arch/sparc64/conf/Makefile.sparc64 131.1Seeh# after which config should be rerun for all machines of that type. 141.1Seeh 151.40Sthorpej# Always use sparc64 as the MACHINE_ARCH, so we select the correct 161.40Sthorpej# toolchain (i.e. need v9 instruction support in the assembler, etc.) 171.40Sthorpej# 32-bit vs. 64-bit will be selected based on compiler/assember options. 181.40SthorpejMACHINE_ARCH=sparc64 191.40Sthorpej 201.39Sthorpej.include <bsd.own.mk> 211.39Sthorpej 221.1Seeh# DEBUG is set to -g if debugging. 231.1Seeh# PROF is set to -pg if profiling. 241.1Seeh 251.39SthorpejAR?= ar 261.39SthorpejAS?= as 271.1SeehCC?= cc 281.39SthorpejCPP?= cpp 291.39SthorpejLD?= ld 301.39SthorpejLORDER?=lorder 311.1SeehMKDEP?= mkdep 321.39SthorpejNM?= nm 331.39SthorpejRANLIB?=ranlib 341.2SmrgSIZE?= size 351.39SthorpejSTRIP?= strip 361.39SthorpejTSORT?= tsort -q 371.39Sthorpej 381.1SeehCOPTS?= -O2 391.4Smrg 401.1Seeh# source tree is located via $S relative to the compilation directory 411.1Seeh.ifndef S 421.1SeehS!= cd ../../../..; pwd 431.1Seeh.endif 441.1SeehSPARC64= $S/arch/sparc64 451.1Seeh 461.1SeehINCLUDES= -I. -I$S/arch -I$S -nostdinc 471.39SthorpejCPPFLAGS= ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D_KERNEL_OPT -Dsparc64 481.39SthorpejCWARNFLAGS= -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \ 491.39Sthorpej -Wpointer-arith 501.39Sthorpej# XXX Delete -Wuninitialized for now, since the compiler doesn't 511.39Sthorpej# XXX always get it right. --thorpej 521.32SfvdlCWARNFLAGS+= -Wno-uninitialized 531.39SthorpejCWARNFLAGS+= -Wno-main 541.40Sthorpej 551.40Sthorpej# Select the compiler, assembler, and linker flags based on the 561.40Sthorpej# LP64 variable. 571.40SthorpejLP64?= no 581.40Sthorpej.if ${LP64} == "yes" 591.40SthorpejCC:= ${CC} -m64 601.40SthorpejAS:= ${AS} -64 611.40SthorpejLD:= ${LD} -m elf64_sparc 621.40SthorpejCPPFLAGS+= -D_LP64 631.40Sthorpej.else 641.40SthorpejCC:= ${CC} -m32 651.40SthorpejAS:= ${AS} -32 661.40SthorpejLD:= ${LD} -m elf32_sparc 671.40Sthorpej.endif 681.40Sthorpej 691.27SmycroftCFLAGS= ${DEBUG} ${COPTS} ${CWARNFLAGS} -Wa,-Av9a -mno-fpu 701.30Seeh.if defined(PROF) 711.30Seeh# We need to run the compiler in medlow memory model. 721.40SthorpejCFLAGS+= -mcmodel=medlow 731.30Seeh.endif 741.27SmycroftAFLAGS= -x assembler-with-cpp -traditional-cpp -D_LOCORE -Wa,-Av9a 751.31Seeh 761.31Seeh# 771.31Seeh# Gotta find a way to make kernel base tuneable. 781.31Seeh# 791.31Seeh 801.38SeehLINKFLAGS= -Ttext 01000000 -Tdata 01800000 -e start 811.34Smrg#LINKFLAGS= -Ttext f1000000 -Tdata f1400000 -e start 821.34Smrg 831.34SmrgLINKFLAGS+= -n -T ${SPARC64}/conf/${KERN_LDSCRIPT} 841.40Sthorpej.if ${LP64} == "yes" 851.34SmrgKERN_LDSCRIPT?= kern.ldscript 861.35Smrg.else 871.35SmrgKERN_LDSCRIPT?= kern32.ldscript 881.35Smrg.endif 891.31Seeh 901.15StsutsuiSTRIPFLAGS= -g 911.10Smrg 921.10Smrg%INCLUDES 931.1Seeh 941.1Seeh### find out what to use for libkern 951.14Seeh# KERN_AS= obj # bcopy, bzero, memcpy, memset, etc. are in locore.s 961.1Seeh.include "$S/lib/libkern/Makefile.inc" 971.1Seeh.ifndef PROF 981.1SeehLIBKERN= ${KERNLIB} 991.1Seeh.else 1001.1SeehLIBKERN= ${KERNLIB_PROF} 1011.1Seeh.endif 1021.1Seeh 1031.1Seeh### find out what to use for libcompat 1041.1Seeh.include "$S/compat/common/Makefile.inc" 1051.1Seeh.ifndef PROF 1061.1SeehLIBCOMPAT= ${COMPATLIB} 1071.1Seeh.else 1081.1SeehLIBCOMPAT= ${COMPATLIB_PROF} 1091.1Seeh.endif 1101.1Seeh 1111.1Seeh# compile rules: rules are named ${TYPE}_${SUFFIX} where TYPE is NORMAL or 1121.1Seeh# HOSTED, and SUFFIX is the file suffix, capitalized (e.g. C for a .c file). 1131.1Seeh 1141.27SmycroftNORMAL_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -c $< 1151.27SmycroftNOOPT_C= ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} -O0 -c $< 1161.1SeehNORMAL_S= ${CC} ${AFLAGS} ${CPPFLAGS} -c $< 1171.1Seeh 1181.1Seeh%OBJS 1191.1Seeh 1201.1Seeh%CFILES 1211.1Seeh 1221.1Seeh%SFILES 1231.1Seeh 1241.1Seeh# load lines for config "xxx" will be emitted as: 1251.1Seeh# xxx: ${SYSTEM_DEP} swapxxx.o 1261.1Seeh# ${SYSTEM_LD_HEAD} 1271.1Seeh# ${SYSTEM_LD} swapxxx.o 1281.1Seeh# ${SYSTEM_LD_TAIL} 1291.1SeehSYSTEM_OBJ= locore.o \ 1301.6Sdrochner param.o ioconf.o ${OBJS} ${LIBCOMPAT} ${LIBKERN} 1311.1SeehSYSTEM_DEP= Makefile ${SYSTEM_OBJ} 1321.27SmycroftSYSTEM_LD_HEAD= rm -f $@ 1331.1SeehSYSTEM_LD= @echo ${LD} ${LINKFLAGS} -o $@ '$${SYSTEM_OBJ}' vers.o; \ 1341.1Seeh ${LD} ${LINKFLAGS} -o $@ ${SYSTEM_OBJ} vers.o 1351.2SmrgSYSTEM_LD_TAIL= @${SIZE} $@; chmod 755 $@ 1361.1Seeh 1371.1SeehDEBUG?= 1381.1Seeh.if ${DEBUG} == "-g" 1391.1SeehLINKFLAGS+= -X 1401.1SeehSYSTEM_LD_TAIL+=; \ 1411.12Scgd echo mv -f $@ $@.gdb; mv -f $@ $@.gdb; \ 1421.19Seeh echo ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb; \ 1431.19Seeh ${STRIP} ${STRIPFLAGS} -o $@ $@.gdb 1441.1Seeh.else 1451.1SeehLINKFLAGS+= -S 1461.1Seeh.endif 1471.1Seeh 1481.1Seeh%LOAD 1491.2Smrg 1501.1Seehassym.h: $S/kern/genassym.sh ${SPARC64}/sparc64/genassym.cf 1511.27Smycroft sh $S/kern/genassym.sh ${CC} ${CFLAGS} ${CPPFLAGS} ${PROF} \ 1521.1Seeh < ${SPARC64}/sparc64/genassym.cf > assym.h.tmp && \ 1531.1Seeh mv -f assym.h.tmp assym.h 1541.1Seeh 1551.1Seehparam.c: $S/conf/param.c 1561.1Seeh rm -f param.c 1571.1Seeh cp $S/conf/param.c . 1581.1Seeh 1591.1Seehparam.o: param.c Makefile 1601.1Seeh ${NORMAL_C} 1611.1Seeh 1621.1Seehioconf.o: ioconf.c 1631.1Seeh ${NORMAL_C} 1641.1Seeh 1651.1Seehnewvers: ${SYSTEM_DEP} ${SYSTEM_SWAP_DEP} 1661.1Seeh sh $S/conf/newvers.sh 1671.25Seeh ${CC} ${COPTS} ${CFLAGS} ${CPPFLAGS} ${PROF} -c vers.c 1681.22Seeh 1691.1Seeh 1701.21Smrg__CLEANKERNEL: .USE 1711.21Smrg @echo "${.TARGET}ing the kernel objects" 1721.1Seeh rm -f eddep *netbsd netbsd.gdb tags *.[io] [a-z]*.s \ 1731.28Smycroft [Ee]rrs linterrs makelinks assym.h.tmp assym.h 1741.21Smrg 1751.21Smrg__CLEANDEPEND: .USE 1761.21Smrg rm -f .depend 1771.21Smrg 1781.21Smrgclean: __CLEANKERNEL 1791.21Smrg 1801.21Smrgcleandir distclean: __CLEANKERNEL __CLEANDEPEND 1811.1Seeh 1821.1Seehlint: 1831.1Seeh @lint -hbxncez -Dvolatile= ${CPPFLAGS} -UKGDB \ 1841.1Seeh ${SPARC64}/sparc64/Locore.c ${CFILES} \ 1851.1Seeh ioconf.c param.c | \ 1861.1Seeh grep -v 'static function .* unused' 1871.1Seeh 1881.1Seehtags: 1891.1Seeh @echo "see $S/kern/Makefile for tags" 1901.1Seeh 1911.1Seehlinks: 1921.1Seeh egrep '#if' ${CFILES} | sed -f $S/conf/defines | \ 1931.1Seeh sed -e 's/:.*//' -e 's/\.c/.o/' | sort -u > dontlink 1941.1Seeh echo ${CFILES} | tr -s ' ' '\12' | sed 's/\.c/.o/' | \ 1951.1Seeh sort -u | comm -23 - dontlink | \ 1961.1Seeh sed 's,../.*/\(.*.o\),rm -f \1; ln -s ../GENERIC/\1 \1,' > makelinks 1971.1Seeh sh makelinks && rm -f dontlink 1981.1Seeh 1991.1SeehSRCS= ${SPARC64}/sparc64/locore.s \ 2001.1Seeh param.c ioconf.c ${CFILES} ${SFILES} 2011.1Seehdepend: .depend 2021.1Seeh.depend: ${SRCS} assym.h param.c 2031.1Seeh ${MKDEP} ${AFLAGS} ${CPPFLAGS} ${SPARC64}/sparc64/locore.s 2041.1Seeh ${MKDEP} -a ${CFLAGS} ${CPPFLAGS} param.c ioconf.c ${CFILES} 2051.9Smrg.if (${SFILES} != "") 2061.1Seeh ${MKDEP} -a ${AFLAGS} ${CPPFLAGS} ${SFILES} 2071.9Smrg.endif 2081.25Seeh sh $S/kern/genassym.sh ${MKDEP} -f assym.dep ${COPTS} ${CFLAGS} \ 2091.1Seeh ${CPPFLAGS} < ${SPARC64}/sparc64/genassym.cf 2101.1Seeh @sed -e 's/.*\.o:.*\.c/assym.h:/' < assym.dep >> .depend 2111.1Seeh @rm -f assym.dep 2121.17Stron 2131.17Strondependall: depend all 2141.17Stron 2151.1Seeh 2161.1Seeh# depend on root or device configuration 2171.1Seehautoconf.o conf.o: Makefile 2181.2Smrg 2191.1Seeh# depend on network or filesystem configuration 2201.1Seehuipc_proto.o vfs_conf.o: Makefile 2211.1Seeh 2221.1Seeh# depend on maxusers 2231.1Seehmachdep.o: Makefile 2241.1Seeh 2251.1Seeh# depend on CPU configuration 2261.1Seehbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile 2271.1Seehms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile 2281.1Seehmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile 2291.1Seeh 2301.1Seeh 2311.1Seehlocore.o: ${SPARC64}/sparc64/locore.s assym.h 2321.1Seeh ${NORMAL_S} 2331.23Shubertf 2341.23Shubertf# The install target can be redefined by putting a 2351.23Shubertf# install-kernel-${MACHINE_NAME} target into /etc/mk.conf 2361.23ShubertfMACHINE_NAME!= uname -n 2371.23Shubertfinstall: install-kernel-${MACHINE_NAME} 2381.23Shubertf.if !target(install-kernel-${MACHINE_NAME}}) 2391.23Shubertfinstall-kernel-${MACHINE_NAME}: 2401.23Shubertf rm -f /onetbsd 2411.23Shubertf ln /netbsd /onetbsd 2421.23Shubertf cp netbsd /nnetbsd 2431.23Shubertf mv /nnetbsd /netbsd 2441.23Shubertf.endif 2451.1Seeh 2461.1Seeh%RULES 247