]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - sys/boot/i386/loader/Makefile
MFC Loader Fixes 2017q2: r316437,r316577,r316578,r316585,r316590,r316612,
[FreeBSD/FreeBSD.git] / sys / boot / i386 / loader / Makefile
1 # $FreeBSD$
2
3 .include <src.opts.mk>
4 MK_SSP=         no
5
6 LOADER?=        loader
7 PROG=           ${LOADER}.sym
8 MAN=    
9 INTERNALPROG=
10 NEWVERSWHAT?=   "bootstrap loader" x86
11 VERSION_FILE=   ${.CURDIR}/../loader/version
12 LOADER_NET_SUPPORT?=    yes
13 LOADER_NFS_SUPPORT?=    yes
14 LOADER_TFTP_SUPPORT?=   yes
15
16 # architecture-specific loader code
17 SRCS=           main.c conf.c vers.c chain.c
18
19 # Put LOADER_FIREWIRE_SUPPORT=yes in /etc/make.conf for FireWire/dcons support
20 .if defined(LOADER_FIREWIRE_SUPPORT)
21 CFLAGS+=        -DLOADER_FIREWIRE_SUPPORT
22 LIBFIREWIRE=    ${.OBJDIR}/../libfirewire/libfirewire.a
23 .endif
24
25 # Set by zfsloader Makefile
26 .if defined(LOADER_ZFS_SUPPORT)
27 CFLAGS+=        -DLOADER_ZFS_SUPPORT
28 LIBZFSBOOT=     ${.OBJDIR}/../../zfs/libzfsboot.a
29 .endif
30
31 .if defined(LOADER_NET_SUPPORT)
32 CFLAGS+=        -I${.CURDIR}/../../../../lib/libstand
33 .endif
34
35 .if defined(LOADER_TFTP_SUPPORT)
36 CFLAGS+=        -DLOADER_TFTP_SUPPORT
37 .endif
38 .if defined(LOADER_NFS_SUPPORT)
39 CFLAGS+=        -DLOADER_NFS_SUPPORT
40 .endif
41
42 # Include bcache code.
43 HAVE_BCACHE=    yes
44
45 # Enable PnP and ISA-PnP code.
46 HAVE_PNP=       yes
47 HAVE_ISABUS=    yes
48
49 .if ${MK_FORTH} != "no"
50 # Enable BootForth
51 BOOT_FORTH=     yes
52 CFLAGS+=        -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
53 .if ${MACHINE_CPUARCH} == "amd64"
54 LIBFICL=        ${.OBJDIR}/../../ficl32/libficl.a
55 .else
56 LIBFICL=        ${.OBJDIR}/../../ficl/libficl.a
57 .endif
58 .endif
59
60 .if defined(LOADER_BZIP2_SUPPORT)
61 CFLAGS+=        -DLOADER_BZIP2_SUPPORT
62 .endif
63 .if !defined(LOADER_NO_GZIP_SUPPORT)
64 CFLAGS+=        -DLOADER_GZIP_SUPPORT
65 .endif
66 .if defined(LOADER_NANDFS_SUPPORT)
67 CFLAGS+=        -DLOADER_NANDFS_SUPPORT
68 .endif
69 .if !defined(LOADER_NO_GELI_SUPPORT)
70 CFLAGS+=        -DLOADER_GELI_SUPPORT
71 CFLAGS+=        -I${.CURDIR}/../../geli
72 LIBGELIBOOT=    ${.OBJDIR}/../../geli/libgeliboot.a
73 .PATH:          ${.CURDIR}/../../../opencrypto
74 SRCS+=          xform_aes_xts.c
75 CFLAGS+=        -I${.CURDIR}/../../.. -D_STAND
76 .endif
77
78 # Always add MI sources
79 .PATH:          ${.CURDIR}/../../common
80 .include        "${.CURDIR}/../../common/Makefile.inc"
81 CFLAGS+=        -I${.CURDIR}/../../common
82 CFLAGS+=        -I.
83
84 CLEANFILES=     ${LOADER} ${LOADER}.bin loader.help
85
86 CFLAGS+=        -Wall
87 LDFLAGS=        -static -Ttext 0x0
88
89 # i386 standalone support library
90 LIBI386=        ${.OBJDIR}/../libi386/libi386.a
91 CFLAGS+=        -I${.CURDIR}/..
92
93 LIBSTAND=       ${.OBJDIR}/../../libstand32/libstand.a
94
95 # BTX components
96 CFLAGS+=        -I${.CURDIR}/../btx/lib
97
98 # Debug me!
99 #CFLAGS+=       -g
100 #LDFLAGS+=      -g
101
102 # Pick up ../Makefile.inc early.
103 .include <bsd.init.mk>
104
105 ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
106         btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
107                 -b ${BTXKERN} ${LOADER}.bin
108
109 ${LOADER}.bin: ${LOADER}.sym
110         strip -R .comment -R .note -o ${.TARGET} ${.ALLSRC}
111
112 loader.help: help.common help.i386
113         cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
114
115 FILES=  ${LOADER}
116 # XXX INSTALLFLAGS_loader= -b
117 FILESMODE_${LOADER}= ${BINMODE} -b
118
119 .if !defined(LOADER_ONLY)
120 .PATH: ${.CURDIR}/../../forth
121 .include        "${.CURDIR}/../../forth/Makefile.inc"
122 FILES+= pcibios.4th
123
124 FILES+= loader.rc menu.rc
125 .endif
126
127 # XXX crt0.o needs to be first for pxeboot(8) to work
128 OBJS=   ${BTXCRT}
129
130 DPADD=  ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSTAND}
131 LDADD=  ${LIBFICL} ${LIBFIREWIRE} ${LIBZFSBOOT} ${LIBI386} ${LIBGELIBOOT} ${LIBSTAND}
132
133 .include <bsd.prog.mk>
134
135 .if ${MACHINE_CPUARCH} == "amd64"
136 beforedepend ${OBJS}: machine
137 CLEANFILES+=    machine
138 CFLAGS+=        -DLOADER_PREFER_AMD64
139 machine: .NOMETA
140         ln -sf ${.CURDIR}/../../../i386/include machine
141 .endif