NetBSD-5.0.2/sys/arch/sparc64/conf/Makefile.sparc64

# 	$NetBSD: Makefile.sparc64,v 1.67 2008/08/30 13:23:55 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
CC_NOOPT=	${NORMAL_C}
.if defined(PROF)
# Profiling is only supported in the medium low memory model.
CFLAGS+=	-mcmodel=medlow
.else
# Since the kernel resides in the lower 32 bits, use medium low for now anyway.
CFLAGS+=	-mcmodel=medlow
.endif
.else
# 32-bit kernels
CPPFLAGS+=	-m32 -Wa,-Av8plusa -mcpu=ultrasparc
AFLAGS+=	-Wa,-Av8plusa
# XXX
# The sparc gcc version 3.3.3 (NetBSD nb1 20040301) does not compile this
# file properly with higher optimizations
CC_NOOPT=	${NORMAL_C:C/-O./-O0/}
.endif
CFLAGS+=	-mno-fpu
AFLAGS+=	-x assembler-with-cpp -traditional-cpp

##
## (3) libkern and compat
##
# KERN_AS=	obj	# memcpy, memset, etc. are in locore.s

##
## (4) local objects, compile rules, and dependencies
##
MD_OBJS=	locore.o
MD_CFILES=
MD_SFILES=	${SPARC64}/sparc64/locore.s

locore.o: ${SPARC64}/sparc64/locore.s assym.h
	${NORMAL_S}

##
## (5) link settings
##
TEXTADDR?=	01000000
LINKFORMAT=	-T ${SPARC64}/conf/${KERN_LDSCRIPT}
.if ${LP64} == "yes"
KERN_LDSCRIPT?= kern.ldscript
.else
KERN_LDSCRIPT?= 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

## Include rules for Atheros WLAN
.include "$S/contrib/dev/ath/netbsd/Makefile.ath.inc"

##
## (9) port independent kernel machinery
##
.include "$S/conf/Makefile.kern.inc"

##
## (10) Appending make options.
##
%MAKEOPTIONSAPPEND