# $NetBSD: Makefile.sparc64,v 1.85 2018/09/22 12:24:03 rin Exp $
#=========================================================================
#
# ***** WARNING ******
#
# ANYONE WHO CHANGES THIS MAKEFILE AND DOES NOT TEST BOTH A 32-BIT
# AND 64-BIT KERNEL WILL BE SHOT.
#
#=========================================================================
# Makefile for NetBSD
#
# This makefile is constructed from a machine description:
# config machineid
# Most changes should be made in the machine description
# /sys/arch/sparc64/conf/``machineid''
# after which you should do
# config machineid
# Machine generic makefile changes should be made in
# /sys/arch/sparc64/conf/Makefile.sparc64
# after which config should be rerun for all machines of that type.
#
# To specify debugging, add the config line: makeoptions DEBUG="-g"
# A better way is to specify -g only for a few files.
#
# makeoptions DEBUGLIST="uvm* trap if_*"
# Default to 32-bit. Set the MACHINE_ARCH accordingly.
#
# You must also be using the correct toolchain or the kernel build
# will fail.
#
LP64?= no
if ${LP64} == "yes"
MACHINE_ARCH=sparc64
else
MACHINE_ARCH=sparc
endif
USETOOLS?= no
NEED_OWN_INSTALL_TARGET?=no
include <bsd.own.mk>
USE_SSP?= yes
##
## (1) port identification
##
SPARC64= $S/arch/sparc64
GENASSYM_CONF= ${SPARC64}/sparc64/genassym.cf
##
## (2) compile settings
##
CPPFLAGS+= -Dsparc64 -D__sparc64__
if ${LP64} == "yes"
# 64-bit kernels
CPPFLAGS+= -D_LP64 -Wa,-Av9a
CPPFLAGS+= ${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
AFLAGS+= -Wa,-Av9a
if defined(PROF)
# Profiling is only supported in the medium low memory model.
CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :}
CFLAGS+= ${${ACTIVE_CC} == "clang":? -mcmodel=small :}
else
# Since the kernel resides in the lower 32 bits, use medium low for now anyway.
CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mcmodel=medlow :}
CFLAGS+= ${${ACTIVE_CC} == "clang":? -mcmodel=small :}
endif
else
# 32-bit kernels
CPPFLAGS+= -m32 -Wa,-Av8plusa -mcpu=ultrasparc
CPPFLAGS+= ${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
AFLAGS+= -Wa,-Av8plusa
AFLAGS+= ${${ACTIVE_CC} == "clang":? -Qunused-arguments :}
endif
CFLAGS+= ${${ACTIVE_CC} == "gcc":? -mno-fpu :}
AFLAGS+= -x assembler-with-cpp
##
## (3) libkern and compat
##
OPT_MODULAR= %MODULAR%
##
## (4) local objects, compile rules, and dependencies
##
MD_OBJS= locore.o copy.o mp_subr.o
MD_CFILES=
MD_SFILES= ${SPARC64}/sparc64/locore.s ${SPARC64}/sparc64/copy.S \
${SPARC64}/sparc64/mp_subr.S