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