]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/boot/mips/uboot/Makefile
Define LIBSA* and use them instead of overloaded LIBSTAND
[FreeBSD/FreeBSD.git] / sys / boot / mips / uboot / Makefile
1 # $FreeBSD$
2
3 .include <src.opts.mk>
4
5 FILES=          ubldr
6
7 NEWVERSWHAT=    "U-Boot loader" ${MACHINE_ARCH}
8 BINDIR?=        /boot
9 INSTALLFLAGS=   -b
10 WARNS?=         1
11 # Address at which ubldr will be loaded.
12 # This varies for different boards and SOCs.
13 UBLDR_LOADADDR?=        0xffffffff80800000
14
15 # Architecture-specific loader code
16 SRCS=           start.S conf.c vers.c
17
18 .if !defined(LOADER_NO_DISK_SUPPORT)
19 LOADER_DISK_SUPPORT?=   yes
20 .else
21 LOADER_DISK_SUPPORT=    no
22 .endif
23 LOADER_MSDOS_SUPPORT?=  yes
24 LOADER_UFS_SUPPORT?=    yes
25 LOADER_CD9660_SUPPORT?= no
26 LOADER_EXT2FS_SUPPORT?= no
27 .if ${MK_NAND} != "no"
28 LOADER_NANDFS_SUPPORT?= yes
29 .else
30 LOADER_NANDFS_SUPPORT?= no
31 .endif
32 LOADER_NET_SUPPORT?=    yes
33 LOADER_NFS_SUPPORT?=    yes
34 LOADER_TFTP_SUPPORT?=   no
35 LOADER_GZIP_SUPPORT?=   no
36 LOADER_BZIP2_SUPPORT?=  no
37 .if ${MK_FDT} != "no"
38 LOADER_FDT_SUPPORT=     yes
39 .else
40 LOADER_FDT_SUPPORT=     no
41 .endif
42
43 .if ${LOADER_DISK_SUPPORT} == "yes"
44 CFLAGS+=        -DLOADER_DISK_SUPPORT
45 .endif
46 .if ${LOADER_MSDOS_SUPPORT} == "yes"
47 CFLAGS+=        -DLOADER_MSDOS_SUPPORT
48 .endif
49 .if ${LOADER_UFS_SUPPORT} == "yes"
50 CFLAGS+=        -DLOADER_UFS_SUPPORT
51 .endif
52 .if ${LOADER_CD9660_SUPPORT} == "yes"
53 CFLAGS+=        -DLOADER_CD9660_SUPPORT
54 .endif
55 .if ${LOADER_EXT2FS_SUPPORT} == "yes"
56 CFLAGS+=        -DLOADER_EXT2FS_SUPPORT
57 .endif
58 .if ${LOADER_NANDFS_SUPPORT} == "yes"
59 CFLAGS+=        -DLOADER_NANDFS_SUPPORT
60 .endif
61 .if ${LOADER_GZIP_SUPPORT} == "yes"
62 CFLAGS+=        -DLOADER_GZIP_SUPPORT
63 .endif
64 .if ${LOADER_BZIP2_SUPPORT} == "yes"
65 CFLAGS+=        -DLOADER_BZIP2_SUPPORT
66 .endif
67 .if ${LOADER_NET_SUPPORT} == "yes"
68 CFLAGS+=        -DLOADER_NET_SUPPORT
69 .endif
70 .if ${LOADER_NFS_SUPPORT} == "yes"
71 CFLAGS+=        -DLOADER_NFS_SUPPORT
72 .endif
73 .if ${LOADER_TFTP_SUPPORT} == "yes"
74 CFLAGS+=        -DLOADER_TFTP_SUPPORT
75 .endif
76 .if ${LOADER_FDT_SUPPORT} == "yes"
77 CFLAGS+=        -I${.CURDIR}/../../fdt
78 CFLAGS+=        -I${.OBJDIR}/../../fdt
79 CFLAGS+=        -DLOADER_FDT_SUPPORT
80 LIBUBOOT_FDT=   ${.OBJDIR}/../../uboot/fdt/libuboot_fdt.a
81 LIBFDT=         ${.OBJDIR}/../../fdt/libfdt.a
82 .endif
83
84 .if ${MK_FORTH} != "no"
85 # Enable BootForth
86 BOOT_FORTH=     yes
87 CFLAGS+=        -DBOOT_FORTH -I${.CURDIR}/../../ficl
88 .if ${MACHINE_ARCH:Mmips64*} != ""
89 CFLAGS+=        -I${.CURDIR}/../../ficl/mips64
90 .else
91 CFLAGS+=        -I${.CURDIR}/../../ficl/mips
92 .endif
93 LIBFICL=        ${.OBJDIR}/../../ficl/libficl.a
94 .endif
95
96 # Always add MI sources
97 .PATH:          ${.CURDIR}/../../common
98 .include        "${.CURDIR}/../../common/Makefile.inc"
99 CFLAGS+=        -I${.CURDIR}/../../common
100 CFLAGS+=        -I.
101
102 CLEANFILES+=    loader.help
103
104 CFLAGS+=        -ffreestanding -msoft-float -g
105
106 LDFLAGS=        -nostdlib -static -T ${.CURDIR}/ldscript.${MACHINE_CPUARCH}
107
108 # Pull in common loader code
109 .PATH:          ${.CURDIR}/../../uboot/common
110 .include        "${.CURDIR}/../../uboot/common/Makefile.inc"
111 CFLAGS+=        -I${.CURDIR}/../../uboot/common
112
113 # U-Boot standalone support library
114 LIBUBOOT=       ${.OBJDIR}/../../uboot/lib/libuboot.a
115 CFLAGS+=        -I${.CURDIR}/../../uboot/lib
116 CFLAGS+=        -I${.OBJDIR}/../../uboot/lib
117
118 # where to get libstand from
119 CFLAGS+=        -I${SASRC}
120
121 # clang doesn't understand %D as a specifier to printf
122 #NO_WERROR.clang=
123 #NO_WERROR=
124
125 DPADD=          ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
126 LDADD=          ${LIBFICL} ${LIBUBOOT} ${LIBFDT} ${LIBUBOOT_FDT} ${LIBSA}
127
128 OBJS+=  ${SRCS:N*.h:R:S/$/.o/g}
129
130 loader.help: help.common help.uboot ${.CURDIR}/../../fdt/help.fdt
131         cat ${.ALLSRC} | \
132             awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
133
134 ldscript.abs:
135         echo "UBLDR_LOADADDR = ${UBLDR_LOADADDR};" >${.TARGET}
136
137 ldscript.pie:
138         echo "UBLDR_LOADADDR = 0;" >${.TARGET}
139
140 ubldr: ${OBJS} ldscript.abs ${.CURDIR}/ldscript.${MACHINE_CPUARCH} ${DPADD}
141         ${CC} ${CFLAGS} -T ldscript.abs ${LDFLAGS} \
142             -o ${.TARGET} ${OBJS} ${LDADD}
143         ${OBJCOPY} -S -O binary ubldr ubldr.bin
144
145 CLEANFILES+=    ldscript.abs ldscript.pie ubldr ubldr.pie ubldr.bin
146
147 .if !defined(LOADER_ONLY)
148 .PATH: ${.CURDIR}/../../forth
149 .include        "${.CURDIR}/../../forth/Makefile.inc"
150
151 # Install loader.rc.
152 FILES+= loader.rc
153 # Put sample menu.rc on disk but don't enable it by default.
154 FILES+= menu.rc
155 FILESNAME_menu.rc=      menu.rc.sample
156 .endif
157
158 .include <bsd.stand.mk>
159 .include <bsd.prog.mk>