Makefile.mips revision 1.55
1#	$NetBSD: Makefile.mips,v 1.55 2009/12/14 00:46:04 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/<machine>/conf/``machineid''
9# after which you should do
10#	config machineid
11# Machine generic makefile changes should be made in
12#	/sys/arch/mips/conf/Makefile.mips
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
20USETOOLS?=	no
21NEED_OWN_INSTALL_TARGET?=no
22.include <bsd.own.mk>
23
24##
25## (0) toolchain settings for things that aren't part of the standard
26## toolchain
27##
28ELF2ECOFF?=	elf2ecoff
29
30##
31## (1) port identification
32##
33.ifndef S
34S=		../../../..
35.endif
36THISMIPS=	$S/arch/${MACHINE}
37MIPS=		$S/arch/mips
38GENASSYM_CONF=	${MIPS}/mips/genassym.cf
39.-include "${THISMIPS}/conf/Makefile.${MACHINE}.inc"
40
41##
42## (2) compile settings
43##
44## Note: -ffixed-?? must be kept in sync with cpu.h.
45##
46CPPFLAGS+=	-D${MACHINE}
47DEFGP?=		-G 0
48GP?=		${DEFGP}
49CFLAGS+=	${GP} -mno-abicalls -msoft-float -ffixed-23
50.if defined(LP64) && ${LP64} == "yes"
51.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
52CFLAGS+=	-msym32 -mabi=64
53AFLAGS+=	-msym32 -mabi=64
54.endif
55.if ${MACHINE_ARCH} == "mips64eb"
56LDFLAGS+=	-m elf64btsmip
57LINKFORMAT+=	-m elf64btsmip
58SYSTEM_LD_TAIL_EXTRA+= \
59		;echo ${OBJCOPY} -O elf32-nbigmips $@ $@.elf32; \
60		${OBJCOPY} -O elf32-nbigmips $@ $@.elf32
61.endif
62.if ${MACHINE_ARCH} == "mips64el"
63LDFLAGS+=	-m elf64ltsmip
64LINKFORMAT+=	-m elf64ltsmip
65SYSTEM_LD_TAIL_EXTRA+= \
66		;echo ${OBJCOPY} -O elf32-nlittlemips $@ $@.elf32; \
67		${OBJCOPY} -O elf32-nlittlemips $@ $@.elf32
68.endif
69.endif # LP64=yes
70AFLAGS+=	-mno-abicalls -x assembler-with-cpp -traditional-cpp ${AOPTS}
71
72##
73## (3) libkern and compat
74##
75OPT_MODULAR=	%MODULAR%
76.if !empty(OPT_MODULAR)
77KERN_AS=	obj
78.endif
79
80##
81## (4) local objects, compile rules, and dependencies
82##
83MD_OBJS=	locore.o locore_machdep.o
84MD_CFILES=
85MD_SFILES=	${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S	
86
87locore.o: ${MIPS}/mips/locore.S assym.h
88	${NORMAL_S}
89
90locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h
91	${NORMAL_S}
92
93##
94## (5) link settings
95##
96.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
97TEXTADDR?=              ${DEFTEXTADDR:C/0x8/0xFFFFFFFF8/}
98.else   
99TEXTADDR?=		${DEFTEXTADDR}
100.endif
101KERNLDSCRIPT?=		${MIPS}/conf/kern.ldscript
102# some mips ports specify a "magic" format
103LINKFORMAT+=		-T ${KERNLDSCRIPT}
104EXTRA_LINKFLAGS=	${GP} ${LDOPTS}
105LINKFLAGS_NORMAL=	-X
106STRIPFLAGS=		-g -X
107
108##
109## (6) port specific target dependencies
110##
111
112# depend on CPU configuration
113machdep.o mainbus.o trap.o: Makefile
114
115# depend on System V IPC/shmem options
116mips_machdep.o pmap.o: Makefile
117
118# various assembly files that depend on assym.h
119copy.o fp.o locore.o locore_mips1.o locore_mips3.o: assym.h
120lock_stubs.o mips32_subr.o mips3_subr.o mips5900_subr.o: assym.h
121mips64_subr.o mipsX_subr.o sigcode.o: assym.h
122
123
124##
125## (7) misc settings
126##
127
128##
129## (8) config(8) generated machinery
130##
131%INCLUDES
132
133%OBJS
134
135%CFILES
136
137%SFILES
138
139%LOAD
140
141%RULES
142
143##
144## (9) port independent kernel machinery
145##
146.include "$S/conf/Makefile.kern.inc"
147
148##
149## (10) Appending make options.
150##
151%MAKEOPTIONSAPPEND
152