Makefile.powerpc revision 1.46
1#	$NetBSD: Makefile.powerpc,v 1.46 2011/06/18 21:17:29 matt 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/powerpc/conf/``machineid''
9# after which you should do
10#	config machineid
11# Machine generic makefile changes should be made in
12#	/sys/arch/powerpc/conf/Makefile.powerpc
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=powerpc
21USETOOLS?=	no
22NEED_OWN_INSTALL_TARGET?=no
23.include <bsd.own.mk>
24
25##
26## (1) port identification
27##
28THISPPC=	$S/arch/${MACHINE}
29POWERPC=	$S/arch/powerpc
30GENASSYM_CONF=	${POWERPC}/powerpc/genassym.cf
31GENASSYM_CONF+=	${POWERPC}/${PPCDIR}/genassym.cf
32.if exists(${THISPPC}/${MACHINE}/genassym.cf)
33GENASSYM_CONF+=	${THISPPC}/${MACHINE}/genassym.cf
34.endif
35.-include "${THISPPC}/conf/Makefile.${MACHINE}.inc"
36
37##
38## (2) compile settings
39##
40CPPFLAGS+=	-D${MACHINE}=${MACHINE}
41CWARNFLAGS+=	-Wreturn-type
42.if ${PPCDIR} == "oea"
43CFLAGS+=	-mno-strict-align
44CFLAGS+=	-Wa,-maltivec
45.endif
46CFLAGS+=	-msdata=none
47CFLAGS+=	-msoft-float ${CCPUOPTS}
48AFLAGS+=	${AOPTS} -D_NOREGNAMES
49
50##
51## (3) libkern and compat
52##
53OPT_MODULAR=	%MODULAR%
54.if !empty(OPT_MODULAR)
55KERN_AS=	obj
56.endif
57
58##
59## (4) local objects, compile rules, and dependencies
60##
61.if !defined(SYSTEM_FIRST_OBJ)
62SYSTEM_FIRST_OBJ= locore.o
63.endif
64.if !defined(SYSTEM_FIRST_SFILE)
65SYSTEM_FIRST_SFILE= ${THISPPC}/${MACHINE}/locore.S
66.endif
67MD_OBJS=	${SYSTEM_FIRST_OBJ}
68MD_CFILES=
69MD_SFILES=	${SYSTEM_FIRST_SFILE}
70
71${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h
72	${NORMAL_S}
73
74##
75## (5) link settings
76##
77KERNLDSCRIPT?=	${POWERPC}/conf/kern.ldscript
78TEXTADDR?=	0x100000
79LINKFORMAT=	-N -T ${KERNLDSCRIPT}
80
81ENTRYPOINT=	__start
82
83.if defined(NEED_SREC)
84SYSTEM_LD_TAIL_EXTRA+=; \
85		echo ${OBJCOPY} -O srec $@ $@.srec; \
86		${OBJCOPY} -O srec $@ $@.srec
87.endif
88
89.if defined(NEED_BINARY)
90SYSTEM_LD_TAIL_EXTRA+=; \
91		echo ${OBJCOPY} -O binary $@ $@.bin; \
92		${OBJCOPY} -O binary $@ $@.bin
93.endif
94
95##
96## (6) port specific target dependencies
97##
98
99# depend on CPU configuration
100locore.o machdep.o: Makefile
101
102lock_stubs.o setfault.o: assym.h
103
104##
105## (7) misc settings
106##
107
108##
109## (8) config(8) generated machinery
110##
111%INCLUDES
112
113%OBJS
114
115%CFILES
116
117%SFILES
118
119%LOAD
120
121%RULES
122
123##
124## (9) port independent kernel machinery
125##
126.include "$S/conf/Makefile.kern.inc"
127${KERNLIB} ${KERNLIB_PROF} ${KERNLIBLN}: assym.h
128
129##
130## (10) Appending make options.
131##
132%MAKEOPTIONSAPPEND
133