Makefile.powerpc revision 1.45 1 # $NetBSD: Makefile.powerpc,v 1.45 2011/06/04 17:51:09 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
20 MACHINE_ARCH=powerpc
21 USETOOLS?= no
22 NEED_OWN_INSTALL_TARGET?=no
23 .include <bsd.own.mk>
24
25 ##
26 ## (1) port identification
27 ##
28 THISPPC= $S/arch/${MACHINE}
29 POWERPC= $S/arch/powerpc
30 .if exists(${THISPPC}/${MACHINE}/genassym.cf)
31 GENASSYM_CONF= ${THISPPC}/${MACHINE}/genassym.cf
32 .else
33 GENASSYM_CONF= ${POWERPC}/${PPCDIR}/genassym.cf
34 .endif
35 .-include "${THISPPC}/conf/Makefile.${MACHINE}.inc"
36
37 ##
38 ## (2) compile settings
39 ##
40 CPPFLAGS+= -D${MACHINE}=${MACHINE}
41 CWARNFLAGS+= -Wreturn-type
42 .if ${PPCDIR} == "oea"
43 CFLAGS+= -mno-strict-align
44 CFLAGS+= -Wa,-maltivec
45 .endif
46 CFLAGS+= -msdata=none
47 CFLAGS+= -msoft-float ${CCPUOPTS}
48 AFLAGS+= ${AOPTS} -D_NOREGNAMES
49
50 ##
51 ## (3) libkern and compat
52 ##
53 OPT_MODULAR= %MODULAR%
54 .if !empty(OPT_MODULAR)
55 KERN_AS= obj
56 .endif
57
58 ##
59 ## (4) local objects, compile rules, and dependencies
60 ##
61 .if !defined(SYSTEM_FIRST_OBJ)
62 SYSTEM_FIRST_OBJ= locore.o
63 .endif
64 .if !defined(SYSTEM_FIRST_SFILE)
65 SYSTEM_FIRST_SFILE= ${THISPPC}/${MACHINE}/locore.S
66 .endif
67 MD_OBJS= ${SYSTEM_FIRST_OBJ}
68 MD_CFILES=
69 MD_SFILES= ${SYSTEM_FIRST_SFILE}
70
71 ${SYSTEM_FIRST_OBJ}: ${SYSTEM_FIRST_SFILE} assym.h
72 ${NORMAL_S}
73
74 ##
75 ## (5) link settings
76 ##
77 KERNLDSCRIPT?= ${POWERPC}/conf/kern.ldscript
78 TEXTADDR?= 0x100000
79 LINKFORMAT= -N -T ${KERNLDSCRIPT}
80
81 ENTRYPOINT= __start
82
83 .if defined(NEED_SREC)
84 SYSTEM_LD_TAIL_EXTRA+=; \
85 echo ${OBJCOPY} -O srec $@ $@.srec; \
86 ${OBJCOPY} -O srec $@ $@.srec
87 .endif
88
89 .if defined(NEED_BINARY)
90 SYSTEM_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
100 locore.o machdep.o: Makefile
101
102 lock_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