Makefile.sparc64 revision 1.84
11.84Schristos# 	$NetBSD: Makefile.sparc64,v 1.84 2017/12/10 14:29:47 christos 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.82SmartinUSE_SSP?=	yes
471.82Smartin
481.44Satatat##
491.44Satatat## (1) port identification
501.44Satatat##
511.1SeehSPARC64=	$S/arch/sparc64
521.56SchristosGENASSYM_CONF=	${SPARC64}/sparc64/genassym.cf
531.1Seeh
541.44Satatat##
551.44Satatat## (2) compile settings
561.44Satatat##
571.45SeehCPPFLAGS+=	-Dsparc64 -D__sparc64__
581.40Sthorpej.if ${LP64} == "yes"
591.45Seeh# 64-bit kernels
601.45SeehCPPFLAGS+=	-D_LP64 -Wa,-Av9a
611.81SjoergCPPFLAGS+=	${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
621.45SeehAFLAGS+=	-Wa,-Av9a
631.30Seeh.if defined(PROF)
641.45Seeh# Profiling is only supported in the medium low memory model.
651.74SjoergCFLAGS+=	${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :}
661.74SjoergCFLAGS+=	${${ACTIVE_CC} == "clang":? -mcmodel=small :}
671.45Seeh.else
681.45Seeh# Since the kernel resides in the lower 32 bits, use medium low for now anyway.
691.74SjoergCFLAGS+=	${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :}
701.74SjoergCFLAGS+=	${${ACTIVE_CC} == "clang":? -mcmodel=small :}
711.30Seeh.endif
721.45Seeh.else
731.45Seeh# 32-bit kernels
741.45SeehCPPFLAGS+=	-m32 -Wa,-Av8plusa -mcpu=ultrasparc
751.81SjoergCPPFLAGS+=	${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
761.45SeehAFLAGS+=	-Wa,-Av8plusa
771.81SjoergAFLAGS+=	${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
781.45Seeh.endif
791.81SjoergCFLAGS+=	${${ACTIVE_CC} == "gcc":? -mno-fpu :}
801.80SmartinAFLAGS+=	-x assembler-with-cpp
811.44Satatat
821.44Satatat##
831.44Satatat## (3) libkern and compat
841.44Satatat##
851.72SchristosOPT_MODULAR=	%MODULAR%
861.72Schristos.if !empty(OPT_MODULAR)
871.72SchristosKERN_AS=	obj
881.72Schristos.else
891.72SchristosKERN_AS=	library
901.72Schristos.endif
911.44Satatat
921.44Satatat##
931.44Satatat## (4) local objects, compile rules, and dependencies
941.44Satatat##
951.69SmartinMD_OBJS=	locore.o copy.o mp_subr.o
961.44SatatatMD_CFILES=
971.69SmartinMD_SFILES=	${SPARC64}/sparc64/locore.s ${SPARC64}/sparc64/copy.S \
981.69Smartin	 ${SPARC64}/sparc64/mp_subr.S
991.31Seeh
1001.44Satatatlocore.o: ${SPARC64}/sparc64/locore.s assym.h
1011.44Satatat	${NORMAL_S}
1021.51Schristos
1031.69Smartincopy.o:	${SPARC64}/sparc64/copy.S assym.h
1041.69Smartin	${NORMAL_S}
1051.69Smartin
1061.69Smartinmp_subr.o:	${SPARC64}/sparc64/mp_subr.S assym.h
1071.69Smartin	${NORMAL_S}
1081.69Smartin
1091.73Schristos# Our libkern needs stuff from assym.h for memcpy and memset.
1101.73Schristosdependkernlib:	assym.h
1111.73Schristos
1121.44Satatat##
1131.44Satatat## (5) link settings
1141.44Satatat##
1151.44SatatatTEXTADDR?=	01000000
1161.40Sthorpej.if ${LP64} == "yes"
1171.77SuebayasiKERNLDSCRIPT?= ${SPARC64}/conf/kern.ldscript
1181.35Smrg.else
1191.77SuebayasiKERNLDSCRIPT?= ${SPARC64}/conf/kern32.ldscript
1201.35Smrg.endif
1211.31Seeh
1221.44Satatat##
1231.44Satatat## (6) port specific target dependencies
1241.44Satatat##
1251.10Smrg
1261.44Satatat# depend on CPU configuration
1271.44Satatatbwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
1281.44Satatatms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
1291.44Satatatmachdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
1301.44Satatat
1311.66Sjoergcpu_in_cksum.o lock_stubs.o: assym.h
1321.66Sjoerg
1331.44Satatat##
1341.44Satatat## (7) misc settings
1351.44Satatat##
1361.48Sjdolecek
1371.48Sjdolecek# define .MAIN _before_ the make() check, so that implicit target
1381.48Sjdolecek# would be defined
1391.48Sjdolecek.MAIN: all
1401.47Smrg
1411.84Schristos.if !make(obj) && !make(clean) && !make(cleandir)
1421.84Schristos.BEGIN::
1431.84Schristos	-@rm -f sparc && \
1441.47Smrg		ln -s $S/arch/sparc/include sparc
1451.47Smrg.endif
1461.44Satatat
1471.44Satatat##
1481.44Satatat## (8) config(8) generated machinery
1491.44Satatat##
1501.10Smrg%INCLUDES
1511.1Seeh
1521.1Seeh%OBJS
1531.1Seeh
1541.1Seeh%CFILES
1551.1Seeh
1561.1Seeh%SFILES
1571.1Seeh
1581.1Seeh%LOAD
1591.2Smrg
1601.44Satatat%RULES
1611.1Seeh
1621.44Satatat##
1631.44Satatat## (9) port independent kernel machinery
1641.44Satatat##
1651.83Smartin_SKIP_DTS=yes
1661.44Satatat.include "$S/conf/Makefile.kern.inc"
1671.55Sthorpej
1681.55Sthorpej##
1691.55Sthorpej## (10) Appending make options.
1701.55Sthorpej##
1711.55Sthorpej%MAKEOPTIONSAPPEND
172