1 # $NetBSD: Makefile.mips,v 1.54 2009/02/15 01:58:01 cube Exp $
5 # This makefile is constructed from a machine description:
7 # Most changes should be made in the machine description
8 # /sys/arch/<machine>/conf/``machineid''
9 # after which you should do
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.
15 # To specify debugging, add the config line: makeoptions DEBUG="-g"
16 # A better way is to specify -g only for a few files.
18 # makeoptions DEBUGLIST="uvm* trap if_*"
21 NEED_OWN_INSTALL_TARGET?=no
25 ## (0) toolchain settings for things that aren't part of the standard
31 ## (1) port identification
36 THISMIPS= $S/arch/${MACHINE}
38 GENASSYM_CONF= ${MIPS}/mips/genassym.cf
39 .-include "${THISMIPS}/conf/Makefile.${MACHINE}.inc"
42 ## (2) compile settings
44 ## Note: -ffixed-?? must be kept in sync with cpu.h.
46 CPPFLAGS+= -D${MACHINE}
49 CFLAGS+= ${GP} -mno-abicalls -msoft-float -ffixed-23
50 .if defined(LP64) && ${LP64} == "yes"
51 .if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
52 CFLAGS+= -msym32 -mabi=64
53 AFLAGS+= -msym32 -mabi=64
55 .if ${MACHINE_ARCH} == "mips64eb"
56 LDFLAGS+= -m elf64btsmip
57 LINKFORMAT+= -m elf64btsmip
58 SYSTEM_LD_TAIL_EXTRA+= \
59 ;echo ${OBJCOPY} -O elf32-nbigmips $@ $@.elf32; \
60 ${OBJCOPY} -O elf32-nbigmips $@ $@.elf32
62 .if ${MACHINE_ARCH} == "mips64el"
63 LDFLAGS+= -m elf64ltsmip
64 LINKFORMAT+= -m elf64ltsmip
65 SYSTEM_LD_TAIL_EXTRA+= \
66 ;echo ${OBJCOPY} -O elf32-nlittlemips $@ $@.elf32; \
67 ${OBJCOPY} -O elf32-nlittlemips $@ $@.elf32
70 AFLAGS+= -mno-abicalls -x assembler-with-cpp -traditional-cpp ${AOPTS}
73 ## (3) libkern and compat
75 OPT_MODULAR= %MODULAR%
76 .if !empty(OPT_MODULAR)
81 ## (4) local objects, compile rules, and dependencies
83 MD_OBJS= locore.o locore_machdep.o
85 MD_SFILES= ${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S
87 locore.o: ${MIPS}/mips/locore.S assym.h
90 locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h
96 .if ${MACHINE_ARCH} == "mips64eb" || ${MACHINE_ARCH} == "mips64el"
97 TEXTADDR?= ${DEFTEXTADDR:C/0x8/0xFFFFFFFF8/}
99 TEXTADDR?= ${DEFTEXTADDR}
101 KERNLDSCRIPT?= ${MIPS}/conf/kern.ldscript
102 # some mips ports specify a "magic" format
103 LINKFORMAT+= -T ${KERNLDSCRIPT}
104 EXTRA_LINKFLAGS= ${GP} ${LDOPTS}
109 ## (6) port specific target dependencies
112 # depend on CPU configuration
113 machdep.o mainbus.o trap.o: Makefile
115 # depend on System V IPC/shmem options
116 mips_machdep.o pmap.o: Makefile
118 # various assembly files that depend on assym.h
119 copy.o fp.o locore.o locore_mips1.o locore_mips3.o: assym.h
120 lock_stubs.o mips32_subr.o mips3_subr.o mips5900_subr.o: assym.h
121 mips64_subr.o mipsX_subr.o sigcode.o: assym.h
129 ## (8) config(8) generated machinery
144 ## (9) port independent kernel machinery
146 .include "$S/conf/Makefile.kern.inc"
149 ## (10) Appending make options.