]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - sys/conf/Makefile.mips
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.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=       600004
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 MKMODULESENV+=  MACHINE=${MACHINE} MACHINE_ARCH=${MACHINE_ARCH}
43
44 # We default to the MIPS32 ISA, if none specified in the
45 # kernel configuration file.
46 ARCH_FLAGS?=-march=mips32
47 EXTRA_FLAGS=-fno-pic -mno-abicalls -G0 -DKERNLOADADDR=${KERNLOADADDR}
48
49 HACK_EXTRA_FLAGS=-shared
50
51 # We add the -fno-pic flag to kernels because otherwise performance
52 # is extremely poor, as well as -mno-abicalls to force no ABI usage.
53 CFLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
54 HACK_EXTRA_FLAGS+=${EXTRA_FLAGS} $(ARCH_FLAGS)
55 TRAMP_ARCH_FLAGS?=$(ARCH_FLAGS)
56 TRAMP_EXTRA_FLAGS=${EXTRA_FLAGS} ${TRAMP_ARCH_FLAGS}
57 .if ${MACHINE_ARCH:Mmips64*} != ""
58 TRAMP_ELFSIZE=64
59 .else
60 TRAMP_ELFSIZE=32
61 .endif
62
63 # XXX hardcoded kernel entry point
64 ASM_CFLAGS+=${CFLAGS} -D_LOCORE -DLOCORE
65
66 .if !defined(WITHOUT_KERNEL_TRAMPOLINE)
67 KERNEL_EXTRA=trampoline
68 trampoline: ${KERNEL_KO}.tramp.bin
69 ${KERNEL_KO}.tramp.bin: ${KERNEL_KO} $S/$M/$M/elf_trampoline.c \
70         $S/$M/$M/inckern.S 
71         ${OBJCOPY} --strip-symbol '$$d' --strip-symbol '$$a' \
72                 -g --strip-symbol '$$t' ${FULLKERNEL} ${KERNEL_KO}.tmp
73         sed -e s/${KERNLOADADDR}/${TRAMPLOADADDR}/ -e s/" + SIZEOF_HEADERS"// \
74                  ${LDSCRIPT_NAME} > ${LDSCRIPT_NAME}.tramp.noheader
75         ${CC} -O -nostdlib -I. -I$S ${TRAMP_EXTRA_FLAGS} ${TRAMP_LDFLAGS} -Xlinker \
76                 -T -Xlinker ${LDSCRIPT_NAME}.tramp.noheader \
77                 -DKERNNAME="\"${KERNEL_KO}.tmp\"" -DELFSIZE=${TRAMP_ELFSIZE} \
78                 $S/$M/$M/elf_trampoline.c $S/$M/$M/inckern.S \
79                 -o ${KERNEL_KO}.tramp.elf
80         ${OBJCOPY} -S -O binary ${KERNEL_KO}.tramp.elf \
81                 ${KERNEL_KO}.tramp.bin
82 .endif
83
84 %BEFORE_DEPEND
85
86 %OBJS
87
88 %FILES.c
89
90 %FILES.s
91
92 %FILES.m
93
94 %CLEAN
95
96 CLEAN+= ${LDSCRIPT_NAME} ${LDSCRIPT_NAME}.tramp.noheader \
97         ${KERNEL_KO}.tramp.elf ${KERNEL_KO}.tramp.bin
98
99 ${LDSCRIPT_NAME}: $S/conf/${LDSCRIPT_NAME}
100         sed s/KERNLOADADDR/${KERNLOADADDR}/g $S/conf/${LDSCRIPT_NAME} \
101                 > ${LDSCRIPT_NAME}
102 %RULES
103
104 .include "$S/conf/kern.post.mk"