xref: /netbsd/sys/arch/mips/conf/Makefile.mips (revision bf9ec67e)
1#	$NetBSD: Makefile.mips,v 1.26 2002/03/05 14:28:31 simonb 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
24AR?=		${CROSSDIR}ar
25AS?=		${CROSSDIR}as
26CC?=		${CROSSDIR}cc
27LD?=		${CROSSDIR}ld
28NM?=		${CROSSDIR}nm
29RANLIB?=	${CROSSDIR}ranlib
30SIZE?=		${CROSSDIR}size
31STRIP?=		${CROSSDIR}strip
32TSORT?=		${CROSSDIR}tsort -q
33OBJCOPY?=	${CROSSDIR}objcopy
34
35##
36## (1) port identification
37##
38.if ${MACHINE_ARCH} == "mipsel"
39ENDIAN=-EL
40.elif ${MACHINE_ARCH} == "mipseb"
41ENDIAN=-EB
42.else
43.BEGIN:
44	@echo "MACHINE_ARCH ${MACHINE_ARCH} is invalid"
45	@false
46.endif
47.ifndef S
48S=		../../../..
49.endif
50THISMIPS=	$S/arch/${MACHINE}
51MIPS=		$S/arch/mips
52GENASSYM=	${MIPS}/mips/genassym.cf
53.-include "${THISMIPS}/conf/Makefile.${MACHINE}.inc"
54
55##
56## (2) compile settings
57##
58CPPFLAGS+=	-D${MACHINE}
59DEFGP?=		-G 0
60GP?=		${DEFGP}
61CFLAGS+=	${ENDIAN} ${GP} -mno-abicalls -mno-half-pic
62AFLAGS+=	${ENDIAN} -x assembler-with-cpp -traditional-cpp
63
64##
65## (3) libkern and compat
66##
67
68##
69## (4) local objects, compile rules, and dependencies
70##
71MD_OBJS=	locore.o locore_machdep.o
72MD_CFILES=
73MD_SFILES=	${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S
74
75locore.o: ${MIPS}/mips/locore.S assym.h
76	${NORMAL_S}
77
78locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h
79	${NORMAL_S}
80
81##
82## (5) link settings
83##
84TEXTADDR?=	${DEFTEXTADDR}
85KERNLDSCRIPT?=	${MIPS}/conf/kern.ldscript
86# some mips ports specify a "magic" format
87LINKFORMAT+=	-T ${KERNLDSCRIPT}
88EXTRA_LINKFLAGS=	${ENDIAN} ${GP}
89.if (${ENDIAN} == "-EB")
90EXTRA_LINKFLAGS+=	--oformat elf32-bigmips
91.else
92EXTRA_LINKFLAGS+=	--oformat elf32-littlemips
93.endif
94LINKFLAGS_NORMAL=	-x
95STRIPFLAGS=	-g -X -x
96
97##
98## (6) port specific target dependencies
99##
100
101# depend on CPU configuration
102machdep.o mainbus.o trap.o: Makefile
103
104# depend on System V IPC/shmem options
105mips_machdep.o pmap.o: Makefile
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