Makefile.mips revision 1.73 1 1.73 rin # $NetBSD: Makefile.mips,v 1.73 2023/07/26 03:41:57 rin Exp $
2 1.1 matt
3 1.1 matt # Makefile for NetBSD
4 1.1 matt #
5 1.1 matt # This makefile is constructed from a machine description:
6 1.1 matt # config machineid
7 1.1 matt # Most changes should be made in the machine description
8 1.1 matt # /sys/arch/<machine>/conf/``machineid''
9 1.1 matt # after which you should do
10 1.1 matt # config machineid
11 1.1 matt # Machine generic makefile changes should be made in
12 1.1 matt # /sys/arch/mips/conf/Makefile.mips
13 1.1 matt # after which config should be rerun for all machines of that type.
14 1.25 atatat #
15 1.25 atatat # To specify debugging, add the config line: makeoptions DEBUG="-g"
16 1.25 atatat # A better way is to specify -g only for a few files.
17 1.25 atatat #
18 1.25 atatat # makeoptions DEBUGLIST="uvm* trap if_*"
19 1.23 jmc
20 1.23 jmc USETOOLS?= no
21 1.25 atatat NEED_OWN_INSTALL_TARGET?=no
22 1.13 hubertf .include <bsd.own.mk>
23 1.34 tsutsui
24 1.34 tsutsui ##
25 1.34 tsutsui ## (0) toolchain settings for things that aren't part of the standard
26 1.34 tsutsui ## toolchain
27 1.34 tsutsui ##
28 1.70 christos MIPS_ELF2ECOFF?= elf2ecoff
29 1.1 matt
30 1.25 atatat ##
31 1.25 atatat ## (1) port identification
32 1.25 atatat ##
33 1.1 matt .ifndef S
34 1.25 atatat S= ../../../..
35 1.1 matt .endif
36 1.21 thorpej THISMIPS= $S/arch/${MACHINE}
37 1.1 matt MIPS= $S/arch/mips
38 1.39 christos GENASSYM_CONF= ${MIPS}/mips/genassym.cf
39 1.25 atatat .-include "${THISMIPS}/conf/Makefile.${MACHINE}.inc"
40 1.1 matt
41 1.25 atatat ##
42 1.25 atatat ## (2) compile settings
43 1.25 atatat ##
44 1.45 yamt ## Note: -ffixed-?? must be kept in sync with cpu.h.
45 1.45 yamt ##
46 1.25 atatat CPPFLAGS+= -D${MACHINE}
47 1.25 atatat DEFGP?= -G 0
48 1.8 matt GP?= ${DEFGP}
49 1.63 macallan
50 1.67 maya .if ${ACTIVE_CC} == "gcc"
51 1.67 maya COPTS.mips_fpu.c+= -mhard-float -Wa,-mhard-float
52 1.67 maya AFLAGS.fp.S+= -Wa,-mhard-float
53 1.67 maya .endif
54 1.67 maya
55 1.58 matt CFLAGS+= ${GP} -mno-abicalls -msoft-float -ffixed-24
56 1.55 matt .if defined(LP64) && ${LP64} == "yes"
57 1.71 christos .if ${MACHINE_MIPS64}
58 1.55 matt CFLAGS+= -msym32 -mabi=64
59 1.55 matt AFLAGS+= -msym32 -mabi=64
60 1.44 matt .endif
61 1.72 christos .if !empty(MACHINE_ARCH:Mmips*64eb)
62 1.68 christos LDFLAGS+= -Wl,-m,elf64btsmip
63 1.55 matt LINKFORMAT+= -m elf64btsmip
64 1.55 matt SYSTEM_LD_TAIL_EXTRA+= \
65 1.57 matt ;echo ${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32; \
66 1.57 matt ${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32
67 1.55 matt .endif
68 1.71 christos .if !empty(MACHINE_ARCH:Mmips*64el)
69 1.68 christos LDFLAGS+= -Wl,-m,elf64ltsmip
70 1.55 matt LINKFORMAT+= -m elf64ltsmip
71 1.55 matt SYSTEM_LD_TAIL_EXTRA+= \
72 1.57 matt ;echo ${OBJCOPY} -O elf32-ntradlittlemips $@ $@.elf32; \
73 1.57 matt ${OBJCOPY} -O elf32-ntradlittlemips $@ $@.elf32
74 1.55 matt .endif
75 1.55 matt .endif # LP64=yes
76 1.56 joerg AFLAGS+= -mno-abicalls -x assembler-with-cpp ${AOPTS}
77 1.1 matt
78 1.25 atatat ##
79 1.25 atatat ## (3) libkern and compat
80 1.25 atatat ##
81 1.54 cube OPT_MODULAR= %MODULAR%
82 1.25 atatat
83 1.25 atatat ##
84 1.25 atatat ## (4) local objects, compile rules, and dependencies
85 1.25 atatat ##
86 1.25 atatat MD_OBJS= locore.o locore_machdep.o
87 1.25 atatat MD_CFILES=
88 1.25 atatat MD_SFILES= ${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S
89 1.1 matt
90 1.25 atatat locore.o: ${MIPS}/mips/locore.S assym.h
91 1.25 atatat ${NORMAL_S}
92 1.1 matt
93 1.25 atatat locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h
94 1.25 atatat ${NORMAL_S}
95 1.1 matt
96 1.25 atatat ##
97 1.25 atatat ## (5) link settings
98 1.25 atatat ##
99 1.71 christos .if ${MACHINE_MIPS64}
100 1.43 matt TEXTADDR?= ${DEFTEXTADDR:C/0x8/0xFFFFFFFF8/}
101 1.43 matt .else
102 1.32 simonb TEXTADDR?= ${DEFTEXTADDR}
103 1.43 matt .endif
104 1.32 simonb KERNLDSCRIPT?= ${MIPS}/conf/kern.ldscript
105 1.25 atatat # some mips ports specify a "magic" format
106 1.36 sekiya EXTRA_LINKFLAGS= ${GP} ${LDOPTS}
107 1.46 tsutsui LINKFLAGS_NORMAL= -X
108 1.73 rin OBJCOPY_STRIPFLAGS= -g -X
109 1.1 matt
110 1.25 atatat ##
111 1.25 atatat ## (6) port specific target dependencies
112 1.25 atatat ##
113 1.1 matt
114 1.1 matt # depend on CPU configuration
115 1.1 matt machdep.o mainbus.o trap.o: Makefile
116 1.1 matt
117 1.1 matt # depend on System V IPC/shmem options
118 1.1 matt mips_machdep.o pmap.o: Makefile
119 1.33 simonb
120 1.33 simonb # various assembly files that depend on assym.h
121 1.48 joerg copy.o fp.o locore.o locore_mips1.o locore_mips3.o: assym.h
122 1.58 matt lock_stubs.o mips32_subr.o mips3_subr.o: assym.h
123 1.50 tsutsui mips64_subr.o mipsX_subr.o sigcode.o: assym.h
124 1.33 simonb
125 1.1 matt
126 1.25 atatat ##
127 1.25 atatat ## (7) misc settings
128 1.25 atatat ##
129 1.25 atatat
130 1.25 atatat ##
131 1.25 atatat ## (8) config(8) generated machinery
132 1.25 atatat ##
133 1.25 atatat %INCLUDES
134 1.1 matt
135 1.25 atatat %OBJS
136 1.1 matt
137 1.25 atatat %CFILES
138 1.20 uch
139 1.25 atatat %SFILES
140 1.20 uch
141 1.25 atatat %LOAD
142 1.1 matt
143 1.25 atatat %RULES
144 1.1 matt
145 1.25 atatat ##
146 1.25 atatat ## (9) port independent kernel machinery
147 1.25 atatat ##
148 1.25 atatat .include "$S/conf/Makefile.kern.inc"
149 1.35 thorpej
150 1.35 thorpej ##
151 1.35 thorpej ## (10) Appending make options.
152 1.35 thorpej ##
153 1.35 thorpej %MAKEOPTIONSAPPEND
154