Makefile.amd64 revision 1.7
1#	$NetBSD: Makefile.amd64,v 1.7 2005/07/12 20:22:45 sekiya 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 microtime.o spl.o
49MD_CFILES=
50MD_SFILES=	${AMD64}/amd64/locore.S ${AMD64}/amd64/vector.S \
51		${AMD64}/amd64/copy.S ${AMD64}/amd64/microtime.S \
52		${AMD64}/amd64/spl.S
53
54locore.o: ${AMD64}/amd64/locore.S assym.h
55	${NORMAL_S}
56
57vector.o: ${AMD64}/amd64/vector.S assym.h
58	${NORMAL_S}
59
60copy.o: ${AMD64}/amd64/copy.S assym.h
61	${NORMAL_S}
62
63microtime.o: ${AMD64}/amd64/microtime.S assym.h
64	${NORMAL_S}
65
66spl.o: ${AMD64}/amd64/spl.S assym.h
67	${NORMAL_S}
68
69##
70## (5) link settings
71##
72TEXTADDR?=	0xffffffff80100000
73LINKFLAGS_NORMAL=	-X
74KERN_LDSCRIPT?= kern.ldscript
75LINKFORMAT=	-T ${AMD64}/conf/${KERN_LDSCRIPT}
76
77##
78## (6) port specific target dependencies
79##
80
81# depend on CPU configuration
82locore.o machdep.o: Makefile
83
84mptramp.o netbsd32_sigcode.o: assym.h
85clock.o: config_time.h
86
87##
88## (7) misc settings
89##
90
91##
92## (8) config(8) generated machinery
93##
94%INCLUDES
95
96%OBJS
97
98%CFILES
99
100%SFILES
101
102%LOAD
103
104%RULES
105
106# XXX -	Ugly, but make doesn't easily handle .o.uue (assumes it's a suffix)
107# XXX -	Also, config has no simple was to just add foo.o to the Makefile.
108#	It needs a pathname of some sort for "object"
109.if !empty(OBJS:M\/athhal-x86_64-elf.hal.o)
110OBJS:=${OBJS:C/\/athhal-x86_64-elf.hal.o/athhal-x86_64-elf.hal.o/}
111
112.PATH: $S/contrib/arch/amd64/dev
113ATH_UUDEC?=	@${_MKSHMSG} "uudecode ${.CURDIR:T}/${.TARGET}"; \
114		${_MKSHECHO}\
115		${UUDECODE} -p $> \> ${.TARGET}; \
116		rm -f ${.TARGET}; \
117		${UUDECODE} -p $> > ${.TARGET}
118athhal-x86_64-elf.hal.o: athhal-x86_64-elf.hal.o.uue
119	${ATH_UUDEC}
120all depend:	opt_ah.h
121opt_ah.h:	athhal-x86_64-elf.opt_ah.h
122	ln -s ${.ALLSRC} ${.TARGET}
123.endif
124
125##
126## (9) port independent kernel machinery
127##
128.include "$S/conf/Makefile.kern.inc"
129
130##
131## (10) Appending make options.
132##
133%MAKEOPTIONSAPPEND
134