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

#	$NetBSD: Makefile.amd64,v 1.25 2008/10/30 20:07:01 joerg Exp $

# Makefile for NetBSD
#
# This makefile is constructed from a machine description:
#	config machineid
# Most changes should be made in the machine description
#	/sys/arch/amd64/conf/``machineid''
# after which you should do
#	config machineid
# Machine generic makefile changes should be made in
#	/sys/arch/amd64/conf/Makefile.amd64
# 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_*"

MACHINE_ARCH=x86_64
USETOOLS?=	no
NEED_OWN_INSTALL_TARGET?=no
.include <bsd.own.mk>

##
## (1) port identification
##
AMD64=		$S/arch/amd64
GENASSYM_CONF=	${AMD64}/amd64/genassym.cf

##
## (2) compile settings
##
DEFCOPTS=	-O2
CPPFLAGS+=	-Damd64 -Dx86_64
CFLAGS+=	-mcmodel=kernel
CFLAGS+=	-mno-red-zone
AFLAGS+=	-x assembler-with-cpp -traditional-cpp

##
## (3) libkern and compat
##
KERN_AS=	obj

##
## (4) local objects, compile rules, and dependencies
##
MD_OBJS=	locore.o vector.o copy.o spl.o
MD_CFILES=
MD_SFILES=	${AMD64}/amd64/locore.S ${AMD64}/amd64/vector.S \
		${AMD64}/amd64/copy.S ${AMD64}/amd64/spl.S

locore.o: ${AMD64}/amd64/locore.S assym.h
	${NORMAL_S}

vector.o: ${AMD64}/amd64/vector.S assym.h
	${NORMAL_S}

copy.o: ${AMD64}/amd64/copy.S assym.h
	${NORMAL_S}

spl.o: ${AMD64}/amd64/spl.S assym.h
	${NORMAL_S}

##
## (5) link settings
##
TEXTADDR?=	0xffffffff80100000
LINKFLAGS_NORMAL=	-X
KERN_LDSCRIPT?= kern.ldscript
LINKFORMAT=	-T ${AMD64}/conf/${KERN_LDSCRIPT}

##
## (6) port specific target dependencies
##

# depend on CPU configuration
locore.o machdep.o: Makefile

acpi_wakeup_low.o amd64func.o busfunc.o cpufunc.o cpu_in_cksum.o: assym.h
linux_support.o linux32_sigcode.o lock_stubs.o mptramp.o: assym.h
netbsd32_sigcode.o: assym.h

##
## (7) misc settings
##

##
## (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"
.include "$S/arch/x86/acpi/Makefile.wakecode.inc"

# XXX -	Ugly, but make doesn't easily handle .o.uu (assumes it's a suffix)
# XXX -	Also, config has no simple was to just add foo.o to the Makefile.
#	It needs a pathname of some sort for "object"
.if !empty(OBJS:M\/athhal.o)
OBJS:=${OBJS:C/\/athhal.o/athhal.o/}

.PATH: $S/contrib/dev/ath/public
ATH_UUDEC?=	@${_MKSHMSG} "uudecode ${.CURDIR:T}/${.TARGET}"; \
		${_MKSHECHO}\
		${UUDECODE} -p $> \> ${.TARGET}; \
		rm -f ${.TARGET}; \
		${UUDECODE} -p $> > ${.TARGET}

athhal.o: x86_64-elf.hal.o.uu
	${ATH_UUDEC}
.if defined(COPTS) && !empty(COPTS:M-fno-asynchronous-unwind-tables)
	${_MKSHECHO}\
	${OBJCOPY} -R .eh_frame $@
	${OBJCOPY} -R .eh_frame $@
.endif
.endif

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

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