Makefile.amd64 revision 1.18
1#	$NetBSD: Makefile.amd64,v 1.18 2007/12/09 20:27:43 jmcneill Exp $
2
3# Makefile for NetBSD
4#
5# This makefile is constructed from a machine description:
6#	config machineid
7# Most changes should be made in the machine description
8#	/sys/arch/amd64/conf/``machineid''
9# after which you should do
10#	config machineid
11# Machine generic makefile changes should be made in
12#	/sys/arch/amd64/conf/Makefile.amd64
13# after which config should be rerun for all machines of that type.
14#
15# To specify debugging, add the config line: makeoptions DEBUG="-g"
16# A better way is to specify -g only for a few files.
17#
18#	makeoptions DEBUGLIST="uvm* trap if_*"
19
20MACHINE_ARCH=x86_64
21USETOOLS?=	no
22NEED_OWN_INSTALL_TARGET?=no
23.include <bsd.own.mk>
24
25##
26## (1) port identification
27##
28AMD64=		$S/arch/amd64
29GENASSYM_CONF=	${AMD64}/amd64/genassym.cf
30
31##
32## (2) compile settings
33##
34DEFCOPTS=	-O2
35CPPFLAGS+=	-Damd64 -Dx86_64
36CFLAGS+=	-mcmodel=kernel
37CFLAGS+=	-mno-red-zone
38AFLAGS+=	-x assembler-with-cpp -traditional-cpp
39
40##
41## (3) libkern and compat
42##
43KERN_AS=	obj
44
45##
46## (4) local objects, compile rules, and dependencies
47##
48MD_OBJS=	locore.o vector.o copy.o spl.o
49MD_CFILES=
50MD_SFILES=	${AMD64}/amd64/locore.S ${AMD64}/amd64/vector.S \
51		${AMD64}/amd64/copy.S ${AMD64}/amd64/spl.S
52
53locore.o: ${AMD64}/amd64/locore.S assym.h
54	${NORMAL_S}
55
56vector.o: ${AMD64}/amd64/vector.S assym.h
57	${NORMAL_S}
58
59copy.o: ${AMD64}/amd64/copy.S assym.h
60	${NORMAL_S}
61
62spl.o: ${AMD64}/amd64/spl.S assym.h
63	${NORMAL_S}
64
65##
66## (5) link settings
67##
68TEXTADDR?=	0xffffffff80100000
69LINKFLAGS_NORMAL=	-X
70KERN_LDSCRIPT?= kern.ldscript
71LINKFORMAT=	-T ${AMD64}/conf/${KERN_LDSCRIPT}
72
73##
74## (6) port specific target dependencies
75##
76
77# depend on CPU configuration
78locore.o machdep.o: Makefile
79
80acpi_wakeup_low.o busfunc.o cpufunc.o mptramp.o netbsd32_sigcode.o: assym.h
81clock.o: config_time.h
82
83##
84## (7) misc settings
85##
86
87##
88## (8) config(8) generated machinery
89##
90%INCLUDES
91
92%OBJS
93
94%CFILES
95
96%SFILES
97
98%LOAD
99
100%RULES
101## Include rules for Atheros WLAN
102.include "$S/contrib/dev/ath/netbsd/Makefile.ath.inc"
103.include "$S/arch/x86/acpi/Makefile.wakecode.inc"
104
105# XXX -	Ugly, but make doesn't easily handle .o.uu (assumes it's a suffix)
106# XXX -	Also, config has no simple was to just add foo.o to the Makefile.
107#	It needs a pathname of some sort for "object"
108.if !empty(OBJS:M\/athhal.o)
109OBJS:=${OBJS:C/\/athhal.o/athhal.o/}
110
111.PATH: $S/contrib/dev/ath/public
112ATH_UUDEC?=	@${_MKSHMSG} "uudecode ${.CURDIR:T}/${.TARGET}"; \
113		${_MKSHECHO}\
114		${UUDECODE} -p $> \> ${.TARGET}; \
115		rm -f ${.TARGET}; \
116		${UUDECODE} -p $> > ${.TARGET}
117
118athhal.o: x86_64-elf.hal.o.uu
119	${ATH_UUDEC}
120.if defined(COPTS) && !empty(COPTS:M-fno-asynchronous-unwind-tables)
121	${_MKSHECHO}\
122	${OBJCOPY} -R .eh_frame $@
123	${OBJCOPY} -R .eh_frame $@
124.endif
125.endif
126
127##
128## (9) port independent kernel machinery
129##
130.include "$S/conf/Makefile.kern.inc"
131
132##
133## (10) Appending make options.
134##
135%MAKEOPTIONSAPPEND
136