netbsd/sys/arch/sparc64/conf/Makefile.sparc64
2015-10-15 10:25:28 +02:00

166 lines
3.5 KiB
Makefile

# $NetBSD: Makefile.sparc64,v 1.80 2015/08/31 08:00:44 martin 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>
##
## (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
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
AFLAGS+= -Wa,-Av8plusa
.endif
CFLAGS+= -mno-fpu
AFLAGS+= -x assembler-with-cpp
##
## (3) libkern and compat
##
OPT_MODULAR= %MODULAR%
.if !empty(OPT_MODULAR)
KERN_AS= obj
.else
KERN_AS= library
.endif
##
## (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
locore.o: ${SPARC64}/sparc64/locore.s assym.h
${NORMAL_S}
copy.o: ${SPARC64}/sparc64/copy.S assym.h
${NORMAL_S}
mp_subr.o: ${SPARC64}/sparc64/mp_subr.S assym.h
${NORMAL_S}
# Our libkern needs stuff from assym.h for memcpy and memset.
dependkernlib: assym.h
##
## (5) link settings
##
TEXTADDR?= 01000000
.if ${LP64} == "yes"
KERNLDSCRIPT?= ${SPARC64}/conf/kern.ldscript
.else
KERNLDSCRIPT?= ${SPARC64}/conf/kern32.ldscript
.endif
##
## (6) port specific target dependencies
##
# depend on CPU configuration
bwtwo.o cgsix.o cgthree.o cgtwo.o cons.o dma.o esp.o fb.o if_ie.o: Makefile
ms.c obio.o zs.c autoconf.o clock.o cpu.o disksubr.o locore.o: Makefile
machdep.o mem.o openprom.o pmap.o vm_machdep.o: Makefile
cpu_in_cksum.o lock_stubs.o: assym.h
##
## (7) misc settings
##
# define .MAIN _before_ the make() check, so that implicit target
# would be defined
.MAIN: all
.if make(depend) || make(all) || make(dependall)
.BEGIN:
@rm -f sparc && \
ln -s $S/arch/sparc/include sparc
.endif
##
## (8) config(8) generated machinery
##
%INCLUDES
%OBJS
%CFILES
%SFILES
%LOAD
%RULES
##
## (9) port independent kernel machinery
##
.include "$S/conf/Makefile.kern.inc"
##
## (10) Appending make options.
##
%MAKEOPTIONSAPPEND