]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - stand/defs.mk
Re-sync loader.mk and ficl.mk to where they should be
[FreeBSD/FreeBSD.git] / stand / defs.mk
1 # $FreeBSD$
2
3 .include <src.opts.mk>
4
5 .if !defined(__BOOT_DEFS_MK__)
6 __BOOT_DEFS_MK__=${MFILE}
7
8 BOOTSRC=        ${SRCTOP}/stand
9 EFISRC=         ${BOOTSRC}/efi
10 EFIINC=         ${EFISRC}/include
11 EFIINCMD=       ${EFIINC}/${MACHINE}
12 FDTSRC=         ${BOOTSRC}/fdt
13 FICLSRC=        ${BOOTSRC}/ficl
14 LDRSRC=         ${BOOTSRC}/common
15 SASRC=          ${BOOTSRC}/libsa
16 SYSDIR=         ${SRCTOP}/sys
17 UBOOTSRC=       ${BOOTSRC}/uboot
18 ZFSSRC=         ${BOOTSRC}/zfs
19
20 BOOTOBJ=        ${OBJTOP}/stand
21
22 # BINDIR is where we install
23 BINDIR?=        /boot
24
25 # NB: The makefiles depend on these being empty when we don't build forth.
26 .if ${MK_FORTH} != "no"
27 LIBFICL=        ${BOOTOBJ}/ficl/libficl.a
28 .if ${MACHINE} == "i386"
29 LIBFICL32=      ${LIBFICL}
30 .else
31 LIBFICL32=      ${BOOTOBJ}/ficl32/libficl.a
32 .endif
33 .endif
34 LIBSA=          ${BOOTOBJ}/libsa/libsa.a
35 .if ${MACHINE} == "i386"
36 LIBSA32=        ${LIBSA}
37 .else
38 LIBSA32=        ${BOOTOBJ}/libsa32/libsa32.a
39 .endif
40
41 # Standard options:
42
43 # Filesystem support
44 .if ${LOADER_CD9660_SUPPORT:Uno} == "yes"
45 CFLAGS+=        -DLOADER_CD9660_SUPPORT
46 .endif
47 .if ${LOADER_EXT2FS_SUPPORT:Uno} == "yes"
48 CFLAGS+=        -DLOADER_EXT2FS_SUPPORT
49 .endif
50 .if ${LOADER_MSDOS_SUPPORT:Uno} == "yes"
51 CFLAGS+=        -DLOADER_MSDOS_SUPPORT
52 .endif
53 .if ${LOADER_NANDFS_SUPPORT:U${MK_NAND}} == "yes"
54 CFLAGS+=        -DLOADER_NANDFS_SUPPORT
55 .endif
56 .if ${LOADER_UFS_SUPPORT:Uyes} == "yes"
57 CFLAGS+=        -DLOADER_UFS_SUPPORT
58 .endif
59
60 # Compression
61 .if ${LOADER_GZIP_SUPPORT:Uno} == "yes"
62 CFLAGS+=        -DLOADER_GZIP_SUPPORT
63 .endif
64 .if ${LOADER_BZIP2_SUPPORT:Uno} == "yes"
65 CFLAGS+=        -DLOADER_BZIP2_SUPPORT
66 .endif
67
68 # Network related things
69 .if ${LOADER_NET_SUPPORT:Uno} == "yes"
70 CFLAGS+=        -DLOADER_NET_SUPPORT
71 .endif
72 .if ${LOADER_NFS_SUPPORT:Uno} == "yes"
73 CFLAGS+=        -DLOADER_NFS_SUPPORT
74 .endif
75 .if ${LOADER_TFTP_SUPPORT:Uno} == "yes"
76 CFLAGS+=        -DLOADER_TFTP_SUPPORT
77 .endif
78
79 # Disk and partition support
80 .if ${LOADER_DISK_SUPPORT:Uyes} == "yes"
81 CFLAGS+= -DLOADER_DISK_SUPPORT
82 .if ${LOADER_GPT_SUPPORT:Uyes} == "yes"
83 CFLAGS+= -DLOADER_GPT_SUPPORT
84 .endif
85 .if ${LOADER_MBR_SUPPORT:Uyes} == "yes"
86 CFLAGS+= -DLOADER_MBR_SUPPORT
87 .endif
88
89 # GELI Support, with backward compat hooks
90 .if defined(HAVE_GELI)
91 .if defined(LOADER_NO_GELI_SUPPORT)
92 MK_LOADER_GELI=no
93 .warning "Please move from LOADER_NO_GELI_SUPPORT to WITHOUT_LOADER_GELI"
94 .endif
95 .if defined(LOADER_GELI_SUPPORT)
96 MK_LOADER_GELI=yes
97 .warning "Please move from LOADER_GELI_SUPPORT to WITH_LOADER_GELI"
98 .endif
99 .if ${MK_LOADER_GELI} == "yes"
100 CFLAGS+=        -DLOADER_GELI_SUPPORT
101 CFLAGS+=        -I${BOOTSRC}/geli
102 LIBGELIBOOT=    ${BOOTOBJ}/geli/libgeliboot.a
103 .endif
104 .endif
105 .endif
106
107 CFLAGS+=        -I${SYSDIR}
108
109 # All PowerPC builds are 32 bit. We have no 64-bit loaders on powerpc
110 # or powerpc64.
111 .if ${MACHINE_ARCH} == "powerpc64"
112 CFLAGS+=        -m32 -mcpu=powerpc
113 .endif
114
115 # For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is
116 # build 32-bit and some 64-bit (lib*, efi). Centralize all the 32-bit magic here
117 # and activate it when DO32 is explicitly defined to be 1.
118 .if ${MACHINE_ARCH} == "amd64" && ${DO32:U0} == 1
119 CFLAGS+=        -m32 -mcpu=i386
120 # LD_FLAGS is passed directly to ${LD}, not via ${CC}:
121 LD_FLAGS+=      -m elf_i386_fbsd
122 AFLAGS+=        --32
123 .endif
124
125 # Make sure we use the machine link we're about to create
126 CFLAGS+=-I.
127
128 _ILINKS=machine
129 .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64"
130 _ILINKS+=${MACHINE_CPUARCH}
131 .endif
132 .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64"
133 _ILINKS+=x86
134 .endif
135 CLEANFILES+=${_ILINKS}
136
137 all: ${PROG}
138
139 beforedepend: ${_ILINKS}
140 beforebuild: ${_ILINKS}
141
142 # Ensure that the links exist without depending on it when it exists which
143 # causes all the modules to be rebuilt when the directory pointed to changes.
144 .for _link in ${_ILINKS}
145 .if !exists(${.OBJDIR}/${_link})
146 ${OBJS}:       ${_link}
147 .endif
148 .endfor
149
150 .NOPATH: ${_ILINKS}
151
152 ${_ILINKS}:
153         @case ${.TARGET} in \
154         machine) \
155                 if [ ${DO32:U0} -eq 0 ]; then \
156                         path=${SYSDIR}/${MACHINE}/include ; \
157                 else \
158                         path=${SYSDIR}/${MACHINE:C/amd64/i386/}/include ; \
159                 fi ;; \
160         *) \
161                 path=${SYSDIR}/${.TARGET:T}/include ;; \
162         esac ; \
163         path=`(cd $$path && /bin/pwd)` ; \
164         ${ECHO} ${.TARGET:T} "->" $$path ; \
165         ln -fhs $$path ${.TARGET:T}
166
167 # For loader implementations, we generate a loader.help file. This can be suppressed by
168 # setting HELP_FILES to nothing.
169 HELP_FILES=     ${LDRSRC}/help.common
170
171 .endif # __BOOT_DEFS_MK__