Makefile.sparc64 revision 1.58
11.58Smartin# 	$NetBSD: Makefile.sparc64,v 1.58 2006/03/02 10:44:33 martin Exp $
21.45Seeh
31.45Seeh#=========================================================================
41.45Seeh#
51.45Seeh#			***** WARNING ******
61.45Seeh#
71.45Seeh# ANYONE WHO CHANGES THIS MAKEFILE AND DOES NOT TEST BOTH A 32-BIT
81.45Seeh# AND 64-BIT KERNEL WILL BE SHOT.
91.45Seeh#
101.45Seeh#=========================================================================
111.45Seeh
121.1Seeh
131.1Seeh# Makefile for NetBSD
141.1Seeh#
151.1Seeh# This makefile is constructed from a machine description:
161.1Seeh#	config machineid
171.1Seeh# Most changes should be made in the machine description
181.1Seeh#	/sys/arch/sparc64/conf/``machineid''
191.1Seeh# after which you should do
201.1Seeh#	config machineid
211.1Seeh# Machine generic makefile changes should be made in
221.1Seeh#	/sys/arch/sparc64/conf/Makefile.sparc64
231.1Seeh# after which config should be rerun for all machines of that type.
241.44Satatat#
251.44Satatat# To specify debugging, add the config line: makeoptions DEBUG="-g"
261.44Satatat# A better way is to specify -g only for a few files.
271.44Satatat#
281.44Satatat#	makeoptions DEBUGLIST="uvm* trap if_*"
291.1Seeh
301.45Seeh# Default to 32-bit.  Set the MACHINE_ARCH accordingly.
311.45Seeh#
321.45Seeh# You must also be using the correct toolchain or the kernel build
331.45Seeh# will fail.
341.45Seeh#
351.41SthorpejLP64?=	no
361.41Sthorpej.if ${LP64} == "yes"
371.40SthorpejMACHINE_ARCH=sparc64
381.41Sthorpej.else
391.41SthorpejMACHINE_ARCH=sparc
401.41Sthorpej.endif
411.42Sjmc
421.42SjmcUSETOOLS?=	no
431.44SatatatNEED_OWN_INSTALL_TARGET?=no
441.39Sthorpej.include <bsd.own.mk>
451.39Sthorpej
461.44Satatat##
471.44Satatat## (1) port identification
481.44Satatat##
491.1SeehSPARC64=	$S/arch/sparc64
501.56SchristosGENASSYM_CONF=	${SPARC64}/sparc64/genassym.cf
511.1Seeh
521.44Satatat##
531.44Satatat## (2) compile settings
541.44Satatat##
551.45SeehCPPFLAGS+=	-Dsparc64 -D__sparc64__
561.40Sthorpej.if ${LP64} == "yes"
571.45Seeh# 64-bit kernels
581.45SeehCPPFLAGS+=	-D_LP64 -Wa,-Av9a
591.45SeehAFLAGS+=	-Wa,-Av9a
601.54SmartinCC_NOOPT=	${NORMAL_C}
611.30Seeh.if defined(PROF)
621.45Seeh# Profiling is only supported in the medium low memory model.
631.45SeehCFLAGS+=	-mcmodel=medlow
641.45Seeh.else
651.45Seeh# Since the kernel resides in the lower 32 bits, use medium low for now anyway.
661.40SthorpejCFLAGS+=	-mcmodel=medlow
671.30Seeh.endif
681.45Seeh.else
691.45Seeh# 32-bit kernels
701.45SeehCPPFLAGS+=	-m32 -Wa,-Av8plusa -mcpu=ultrasparc
711.45SeehAFLAGS+=	-Wa,-Av8plusa
721.53Smartin# XXX
731.53Smartin# The sparc gcc version 3.3.3 (NetBSD nb1 20040301) does not compile this
741.53Smartin# file properly with higher optimizations
751.54SmartinCC_NOOPT=	${NORMAL_C:C/-O./-O0/}
761.45Seeh.endif
771.45SeehCFLAGS+=	-mno-fpu
781.45SeehAFLAGS+=	-x assembler-with-cpp -traditional-cpp
791.44Satatat
801.44Satatat##
811.44Satatat## (3) libkern and compat
821.44Satatat##
831.52Smartin# KERN_AS=	obj	# memcpy, memset, etc. are in locore.s
841.44Satatat
851.44Satatat##
861.44Satatat## (4) local objects, compile rules, and dependencies
871.44Satatat##
881.44SatatatMD_OBJS=	locore.o
891.44SatatatMD_CFILES=
901.44SatatatMD_SFILES=	${SPARC64}/sparc64/locore.s
911.31Seeh
921.44Satatatlocore.o: ${SPARC64}/sparc64/locore.s assym.h
931.44Satatat	${NORMAL_S}
941.51Schristos
951.51Schristosin_cksum.o: assym.h
961.34Smrg
971.44Satatat##
981.44Satatat## (5) link settings
991.44Satatat##
1001.44SatatatTEXTADDR?=	01000000
1011.44SatatatDATAADDR?=	01800000
1021.44SatatatLINKFORMAT=	-n -T ${SPARC64}/conf/${KERN_LDSCRIPT}
1031.40Sthorpej.if ${LP64} == "yes"
1041.34SmrgKERN_LDSCRIPT?= kern.ldscript
1051.35Smrg.else
1061.35SmrgKERN_LDSCRIPT?= kern32.ldscript
1071.35Smrg.endif
1081.31Seeh
1091.44Satatat##
1101.44Satatat## (6) port specific target dependencies
1111.44Satatat##
1121.10Smrg
1131.44Satatat# depend on CPU configuration
1141.44Satatatbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
1151.44Satatatms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
1161.44Satatatmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
1171.44Satatat
1181.44Satatat##
1191.44Satatat## (7) misc settings
1201.44Satatat##
1211.48Sjdolecek
1221.48Sjdolecek# define .MAIN _before_ the make() check, so that implicit target
1231.48Sjdolecek# would be defined
1241.48Sjdolecek.MAIN: all
1251.47Smrg
1261.47Smrg.if make(depend) || make(all) || make(dependall)
1271.47Smrg.BEGIN:
1281.47Smrg	@rm -f sparc && \
1291.47Smrg		ln -s $S/arch/sparc/include sparc
1301.47Smrg.endif
1311.44Satatat
1321.44Satatat##
1331.44Satatat## (8) config(8) generated machinery
1341.44Satatat##
1351.10Smrg%INCLUDES
1361.1Seeh
1371.1Seeh%OBJS
1381.1Seeh
1391.1Seeh%CFILES
1401.1Seeh
1411.1Seeh%SFILES
1421.1Seeh
1431.1Seeh%LOAD
1441.2Smrg
1451.44Satatat%RULES
1461.1Seeh
1471.58Smartin# XXX - Ugly, but make doesn't easily handle .o.uue (assumes it's a suffix)
1481.58Smartin# XXX - Also, config has no simple was to just add foo.o to the Makefile. 
1491.58Smartin#       It needs a pathname of some sort for "object"        
1501.58Smartin.if !empty(OBJS:M\/athhal-sparc64-be-elf.hal.o)
1511.58SmartinOBJS:=${OBJS:C/\/athhal-sparc64-be-elf.hal.o/athhal-sparc64-be-elf.hal.o/}
1521.58Smartin 
1531.58Smartin.PATH: $S/contrib/arch/sparc64/dev
1541.58SmartinATH_UUDEC?=	@${_MKSHMSG} "uudecode ${.CURDIR:T}/${.TARGET}"; \
1551.58Smartin		${_MKSHECHO}\
1561.58Smartin		${UUDECODE} -p $> \> ${.TARGET}; \
1571.58Smartin		rm -f ${.TARGET}; \
1581.58Smartin		${UUDECODE} -p $> > ${.TARGET}
1591.58Smartinathhal-sparc64-be-elf.hal.o: athhal-sparc64-be-elf.hal.o.uue
1601.58Smartin	${ATH_UUDEC}
1611.58Smartinall depend:	opt_ah.h
1621.58Smartinopt_ah.h:	athhal-sparc64-be-elf.opt_ah.h
1631.58Smartin	ln -s ${.ALLSRC} ${.TARGET}
1641.58Smartin.endif
1651.58Smartin
1661.44Satatat##
1671.44Satatat## (9) port independent kernel machinery
1681.44Satatat##
1691.44Satatat.include "$S/conf/Makefile.kern.inc"
1701.55Sthorpej
1711.55Sthorpej##
1721.55Sthorpej## (10) Appending make options.
1731.55Sthorpej##
1741.55Sthorpej%MAKEOPTIONSAPPEND
175