summaryrefslogtreecommitdiff
path: root/sys/arch/mips/conf/Makefile.mips
blob: 2fa35cfdd9af551f22c67d78e4f3e0a062a3f44c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
#	$NetBSD: Makefile.mips,v 1.72 2021/04/26 00:28:01 christos Exp $

# Makefile for NetBSD
#
# This makefile is constructed from a machine description:
#	config machineid
# Most changes should be made in the machine description
#	/sys/arch/<machine>/conf/``machineid''
# after which you should do
#	config machineid
# Machine generic makefile changes should be made in
#	/sys/arch/mips/conf/Makefile.mips
# after which config should be rerun for all machines of that type.
#
# To specify debugging, add the config line: makeoptions DEBUG="-g"
# A better way is to specify -g only for a few files.
#
#	makeoptions DEBUGLIST="uvm* trap if_*"

USETOOLS?=	no
NEED_OWN_INSTALL_TARGET?=no
.include <bsd.own.mk>

##
## (0) toolchain settings for things that aren't part of the standard
## toolchain
##
MIPS_ELF2ECOFF?=	elf2ecoff

##
## (1) port identification
##
.ifndef S
S=		../../../..
.endif
THISMIPS=	$S/arch/${MACHINE}
MIPS=		$S/arch/mips
GENASSYM_CONF=	${MIPS}/mips/genassym.cf
.-include "${THISMIPS}/conf/Makefile.${MACHINE}.inc"

##
## (2) compile settings
##
## Note: -ffixed-?? must be kept in sync with cpu.h.
##
CPPFLAGS+=	-D${MACHINE}
DEFGP?=		-G 0
GP?=		${DEFGP}

.if ${ACTIVE_CC} == "gcc"
COPTS.mips_fpu.c+=	-mhard-float -Wa,-mhard-float
AFLAGS.fp.S+=		-Wa,-mhard-float
.endif

CFLAGS+=	${GP} -mno-abicalls -msoft-float -ffixed-24
.if defined(LP64) && ${LP64} == "yes"
.if ${MACHINE_MIPS64}
CFLAGS+=	-msym32 -mabi=64
AFLAGS+=	-msym32 -mabi=64
.endif
.if !empty(MACHINE_ARCH:Mmips*64eb)
LDFLAGS+=	-Wl,-m,elf64btsmip
LINKFORMAT+=	-m elf64btsmip
SYSTEM_LD_TAIL_EXTRA+= \
		;echo ${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32; \
		${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32
.endif
.if !empty(MACHINE_ARCH:Mmips*64el)
LDFLAGS+=	-Wl,-m,elf64ltsmip
LINKFORMAT+=	-m elf64ltsmip
SYSTEM_LD_TAIL_EXTRA+= \
		;echo ${OBJCOPY} -O elf32-ntradlittlemips $@ $@.elf32; \
		${OBJCOPY} -O elf32-ntradlittlemips $@ $@.elf32
.endif
.endif # LP64=yes
AFLAGS+=	-mno-abicalls -x assembler-with-cpp ${AOPTS}

##
## (3) libkern and compat
##
OPT_MODULAR=	%MODULAR%

##
## (4) local objects, compile rules, and dependencies
##
MD_OBJS=	locore.o locore_machdep.o
MD_CFILES=
MD_SFILES=	${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S	

locore.o: ${MIPS}/mips/locore.S assym.h
	${NORMAL_S}

locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h
	${NORMAL_S}

##
## (5) link settings
##
.if ${MACHINE_MIPS64}
TEXTADDR?=              ${DEFTEXTADDR:C/0x8/0xFFFFFFFF8/}
.else   
TEXTADDR?=		${DEFTEXTADDR}
.endif
KERNLDSCRIPT?=		${MIPS}/conf/kern.ldscript
# some mips ports specify a "magic" format
EXTRA_LINKFLAGS=	${GP} ${LDOPTS}
LINKFLAGS_NORMAL=	-X
STRIPFLAGS=		-g -X

##
## (6) port specific target dependencies
##

# depend on CPU configuration
machdep.o mainbus.o trap.o: Makefile

# depend on System V IPC/shmem options
mips_machdep.o pmap.o: Makefile

# various assembly files that depend on assym.h
copy.o fp.o locore.o locore_mips1.o locore_mips3.o: assym.h
lock_stubs.o mips32_subr.o mips3_subr.o: assym.h
mips64_subr.o mipsX_subr.o sigcode.o: assym.h


##
## (7) misc settings
##

##
## (8) config(8) generated machinery
##
%INCLUDES

%OBJS

%CFILES

%SFILES

%LOAD

%RULES

##
## (9) port independent kernel machinery
##
.include "$S/conf/Makefile.kern.inc"

##
## (10) Appending make options.
##
%MAKEOPTIONSAPPEND