Home | History | Annotate | Line # | Download | only in conf
      1 #	$NetBSD: Makefile.mips,v 1.73 2023/07/26 03:41:57 rin 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 
     20 USETOOLS?=	no
     21 NEED_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 ##
     28 MIPS_ELF2ECOFF?=	elf2ecoff
     29 
     30 ##
     31 ## (1) port identification
     32 ##
     33 .ifndef S
     34 S=		../../../..
     35 .endif
     36 THISMIPS=	$S/arch/${MACHINE}
     37 MIPS=		$S/arch/mips
     38 GENASSYM_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 ##
     46 CPPFLAGS+=	-D${MACHINE}
     47 DEFGP?=		-G 0
     48 GP?=		${DEFGP}
     49 
     50 .if ${ACTIVE_CC} == "gcc"
     51 COPTS.mips_fpu.c+=	-mhard-float -Wa,-mhard-float
     52 AFLAGS.fp.S+=		-Wa,-mhard-float
     53 .endif
     54 
     55 CFLAGS+=	${GP} -mno-abicalls -msoft-float -ffixed-24
     56 .if defined(LP64) && ${LP64} == "yes"
     57 .if ${MACHINE_MIPS64}
     58 CFLAGS+=	-msym32 -mabi=64
     59 AFLAGS+=	-msym32 -mabi=64
     60 .endif
     61 .if !empty(MACHINE_ARCH:Mmips*64eb)
     62 LDFLAGS+=	-Wl,-m,elf64btsmip
     63 LINKFORMAT+=	-m elf64btsmip
     64 SYSTEM_LD_TAIL_EXTRA+= \
     65 		;echo ${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32; \
     66 		${OBJCOPY} -O elf32-ntradbigmips $@ $@.elf32
     67 .endif
     68 .if !empty(MACHINE_ARCH:Mmips*64el)
     69 LDFLAGS+=	-Wl,-m,elf64ltsmip
     70 LINKFORMAT+=	-m elf64ltsmip
     71 SYSTEM_LD_TAIL_EXTRA+= \
     72 		;echo ${OBJCOPY} -O elf32-ntradlittlemips $@ $@.elf32; \
     73 		${OBJCOPY} -O elf32-ntradlittlemips $@ $@.elf32
     74 .endif
     75 .endif # LP64=yes
     76 AFLAGS+=	-mno-abicalls -x assembler-with-cpp ${AOPTS}
     77 
     78 ##
     79 ## (3) libkern and compat
     80 ##
     81 OPT_MODULAR=	%MODULAR%
     82 
     83 ##
     84 ## (4) local objects, compile rules, and dependencies
     85 ##
     86 MD_OBJS=	locore.o locore_machdep.o
     87 MD_CFILES=
     88 MD_SFILES=	${MIPS}/mips/locore.S ${THISMIPS}/${MACHINE}/locore_machdep.S	
     89 
     90 locore.o: ${MIPS}/mips/locore.S assym.h
     91 	${NORMAL_S}
     92 
     93 locore_machdep.o: ${THISMIPS}/${MACHINE}/locore_machdep.S assym.h
     94 	${NORMAL_S}
     95 
     96 ##
     97 ## (5) link settings
     98 ##
     99 .if ${MACHINE_MIPS64}
    100 TEXTADDR?=              ${DEFTEXTADDR:C/0x8/0xFFFFFFFF8/}
    101 .else   
    102 TEXTADDR?=		${DEFTEXTADDR}
    103 .endif
    104 KERNLDSCRIPT?=		${MIPS}/conf/kern.ldscript
    105 # some mips ports specify a "magic" format
    106 EXTRA_LINKFLAGS=	${GP} ${LDOPTS}
    107 LINKFLAGS_NORMAL=	-X
    108 OBJCOPY_STRIPFLAGS=	-g -X
    109 
    110 ##
    111 ## (6) port specific target dependencies
    112 ##
    113 
    114 # depend on CPU configuration
    115 machdep.o mainbus.o trap.o: Makefile
    116 
    117 # depend on System V IPC/shmem options
    118 mips_machdep.o pmap.o: Makefile
    119 
    120 # various assembly files that depend on assym.h
    121 copy.o fp.o locore.o locore_mips1.o locore_mips3.o: assym.h
    122 lock_stubs.o mips32_subr.o mips3_subr.o: assym.h
    123 mips64_subr.o mipsX_subr.o sigcode.o: assym.h
    124 
    125 
    126 ##
    127 ## (7) misc settings
    128 ##
    129 
    130 ##
    131 ## (8) config(8) generated machinery
    132 ##
    133 %INCLUDES
    134 
    135 %OBJS
    136 
    137 %CFILES
    138 
    139 %SFILES
    140 
    141 %LOAD
    142 
    143 %RULES
    144 
    145 ##
    146 ## (9) port independent kernel machinery
    147 ##
    148 .include "$S/conf/Makefile.kern.inc"
    149 
    150 ##
    151 ## (10) Appending make options.
    152 ##
    153 %MAKEOPTIONSAPPEND
    154