]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/conf/Makefile.mips
MFV r353141 (by phillip):
[FreeBSD/FreeBSD.git] / sys / conf / Makefile.mips
1 # Makefile.mips
2 # $FreeBSD$
3 #
4 # Makefile for FreeBSD
5 #
6 # This makefile is constructed from a machine description:
7 #       config machineid
8 # Most changes should be made in the machine description
9 #       /sys/mips/conf/``machineid''
10 # after which you should do
11 #        config machineid
12 # Generic makefile changes should be made in
13 #       /sys/conf/Makefile.mips
14 # after which config should be rerun for all machines.
15 #
16
17 # Which version of config(8) is required.
18 %VERSREQ=       600012
19
20 STD8X16FONT?=   iso
21
22 .if !defined(S)
23 .if exists(./@/.)
24 S=      ./@
25 .else
26 S=      ../../..
27 .endif
28 .endif
29 .include "$S/conf/kern.pre.mk"
30
31 INCLUDES+= -I$S/contrib/libfdt
32
33 LDSCRIPT_NAME?=ldscript.$M
34 SYSTEM_LD:= ${SYSTEM_LD:$S/conf/${LDSCRIPT_NAME}=${LDSCRIPT_NAME}}
35 SYSTEM_DEP:= ${SYSTEM_DEP:$S/conf/${LDSCRIPT_NAME}=${LDSCRIPT_NAME}}
36
37 KERNLOADADDR?=0x80001000
38 # This obscure value is defined by CFE for WR160N
39 # To be changed later
40 TRAMPLOADADDR?=0x807963c0
41
42 # We default to the MIPS32 ISA for O32 and MIPS64 ISA for N64 and N32
43 # if none is specified in the kernel configuration file.
44 .if ${MACHINE_ARCH:Mmips64*} != "" || ${MACHINE_ARCH:Mmipsn32*} != ""
45 ARCH_FLAGS?=-march=mips64
46 .else
47 ARCH_FLAGS?=-march=mips32
48 .endif
49 ARCH_FLAGS+=-mabi=${MIPS_ABI}
50 EXTRA_FLAGS=-fno-pic -mno-abicalls -G0 -DKERNLOADADDR=${KERNLOADADDR}
51 EXTRA_FLAGS+=-${MIPS_ENDIAN}
52
53 HACK_EXTRA_FLAGS=-shared
54
55 # We add the -fno-pic flag to kernels because otherwise performance
56 # is extremely poor, as well as -mno-abicalls to force no ABI usage.
57 CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
58 HACK_EXTRA_FLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
59 TRAMP_ARCH_FLAGS?=$(ARCH_FLAGS)
60 TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} ${TRAMP_ARCH_FLAGS}
61 # Kernel code is always compiled with soft-float on MIPS
62 TRAMP_EXTRA_FLAGS+=-msoft-float
63 .if ${MACHINE_ARCH:Mmips64*} != ""
64 TRAMP_ELFSIZE=64
65 .else
66 TRAMP_ELFSIZE=32
67 .endif
68
69 ASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE
70
71 .if !defined(WITHOUT_KERNEL_TRAMPOLINE)
72 KERNEL_EXTRA=trampoline
73 KERNEL_EXTRA_INSTALL=${KERNEL_KO}.tramp.bin
74 trampoline: ${KERNEL_KO}.tramp.bin
75 ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \
76         $S/$M/$M/inckern.S 
77         ${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \
78                 -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp
79         sed -e s/${KERNLOADADDR}/${TRAMPLOADADDR}/ -e s/" + SIZEOF_HEADERS"// \
80                  ${LDSCRIPT_NAME} > ${LDSCRIPT_NAME}.tramp.noheader
81         ${CC} -O -nostdlib -I. -I$S ${TRAMP_EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \
82                 -T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader \
83                 -DKERNNAME="\"${KERNEL_KO}.tmp\"" -DELFSIZE=${TRAMP_ELFSIZE} \
84                 $S/$M/$M/inckern.S $S/$M/$M/elf_trampoline.c \
85                 -o ${KERNEL_KO}.tramp.elf
86         ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.elf \
87                 ${KERNEL_KO}.tramp.bin
88 .endif
89
90 %BEFORE_DEPEND
91
92 %OBJS
93
94 %FILES.c
95
96 %FILES.s
97
98 %FILES.m
99
100 %CLEAN
101
102 CLEAN+= ${LDSCRIPT_NAME} ${LDSCRIPT_NAME}.tramp.noheader \
103         ${KERNEL_KO}.tramp.elf ${KERNEL_KO}.tramp.bin
104
105 ${LDSCRIPT_NAME}: $S/conf/${LDSCRIPT_NAME}
106         sed s/KERNLOADADDR/${KERNLOADADDR}/g $S/conf/${LDSCRIPT_NAME} \
107                 > ${LDSCRIPT_NAME}
108 %RULES
109
110 .include "$S/conf/kern.post.mk"