xref: /netbsd-src/sys/arch/mips/conf/Makefile.mips (revision 93bf6008f8b7982c1d1a9486e4a4a0e687fe36eb)
1#	$NetBSD: Makefile.mips,v 1.54 2009/02/15 01:58:01 cube 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 ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
51CFLAGS+=	-msym32
52.endif
53AFLAGS+=	-mno-abicalls -x assembler-with-cpp -traditional-cpp ${AOPTS}
54
55##
56## (3) libkern and compat
57##
58OPT_MODULAR=	%MODULAR%
59.if !empty(OPT_MODULAR)
60KERN_AS=	obj
61.endif
62
63##
64## (4) local objects, compile rules, and dependencies
65##
66MD_OBJS=	locore.o locore_machdep.o
67MD_CFILES=
68MD_SFILES=	${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S
69
70locore.o: ${MIPS}/mips/locore.S assym.h
71	${NORMAL_S}
72
73locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h
74	${NORMAL_S}
75
76##
77## (5) link settings
78##
79.if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
80TEXTADDR?=              ${DEFTEXTADDR:C/0x8/0xFFFFFFFF8/}
81.else
82TEXTADDR?=		${DEFTEXTADDR}
83.endif
84KERNLDSCRIPT?=		${MIPS}/conf/kern.ldscript
85# some mips ports specify a "magic" format
86LINKFORMAT+=		-T ${KERNLDSCRIPT}
87EXTRA_LINKFLAGS=	${GP} ${LDOPTS}
88LINKFLAGS_NORMAL=	-X
89STRIPFLAGS=		-g -X
90
91##
92## (6) port specific target dependencies
93##
94
95# depend on CPU configuration
96machdep.o mainbus.o trap.o: Makefile
97
98# depend on System V IPC/shmem options
99mips_machdep.o pmap.o: Makefile
100
101# various assembly files that depend on assym.h
102copy.o fp.o locore.o locore_mips1.o locore_mips3.o: assym.h
103lock_stubs.o mips32_subr.o mips3_subr.o mips5900_subr.o: assym.h
104mips64_subr.o mipsX_subr.o sigcode.o: assym.h
105
106
107##
108## (7) misc settings
109##
110
111##
112## (8) config(8) generated machinery
113##
114%INCLUDES
115
116%OBJS
117
118%CFILES
119
120%SFILES
121
122%LOAD
123
124%RULES
125
126##
127## (9) port independent kernel machinery
128##
129.include "$S/conf/Makefile.kern.inc"
130
131##
132## (10) Appending make options.
133##
134%MAKEOPTIONSAPPEND
135