initial commit
[freebsd-arm:freebsd-arm.git] / 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" i386
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 LIBZFS=         ${.OBJDIR}/../../zfs/libzfsboot.a
24 .else
25 LIBZFS=
26 .endif
27
28 # Enable PXE TFTP or NFS support, not both.
29 .if defined(LOADER_TFTP_SUPPORT)
30 CFLAGS+=        -DLOADER_TFTP_SUPPORT
31 .else
32 CFLAGS+=        -DLOADER_NFS_SUPPORT
33 .endif
34
35 # Include bcache code.
36 HAVE_BCACHE=    yes
37
38 # Enable PnP and ISA-PnP code.
39 HAVE_PNP=       yes
40 HAVE_ISABUS=    yes
41
42 .if ${MK_FORTH} != "no"
43 # Enable BootForth
44 BOOT_FORTH=     yes
45 CFLAGS+=        -DBOOT_FORTH -I${.CURDIR}/../../ficl -I${.CURDIR}/../../ficl/i386
46 LIBFICL=        ${.OBJDIR}/../../ficl/libficl.a
47 .endif
48
49 .if defined(LOADER_BZIP2_SUPPORT)
50 CFLAGS+=        -DLOADER_BZIP2_SUPPORT
51 .endif
52 .if !defined(LOADER_NO_GZIP_SUPPORT)
53 CFLAGS+=        -DLOADER_GZIP_SUPPORT
54 .endif
55 .if !defined(LOADER_NO_GPT_SUPPORT)
56 CFLAGS+=        -DLOADER_GPT_SUPPORT
57 .endif
58
59 # Always add MI sources 
60 .PATH:          ${.CURDIR}/../../common
61 .include        "${.CURDIR}/../../common/Makefile.inc"
62 CFLAGS+=        -I${.CURDIR}/../../common
63 CFLAGS+=        -I.
64
65 CLEANFILES=     vers.c ${LOADER} ${LOADER}.bin loader.help
66
67 CFLAGS+=        -Wall
68 LDFLAGS=        -static -Ttext 0x0
69
70 # i386 standalone support library
71 LIBI386=        ${.OBJDIR}/../libi386/libi386.a
72 CFLAGS+=        -I${.CURDIR}/..
73
74 # BTX components
75 CFLAGS+=        -I${.CURDIR}/../btx/lib
76
77 # Debug me!
78 #CFLAGS+=       -g
79 #LDFLAGS+=      -g
80
81 # Pick up ../Makefile.inc early.
82 .include <bsd.init.mk>
83
84 vers.c: ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version
85         sh ${.CURDIR}/../../common/newvers.sh ${.CURDIR}/../loader/version \
86                 ${NEWVERSWHAT}
87
88 ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
89         btxld -v -f aout -e ${LOADER_ADDRESS} -o ${.TARGET} -l ${BTXLDR} \
90                 -b ${BTXKERN} ${LOADER}.bin
91
92 ${LOADER}.bin: ${LOADER}.sym
93         cp ${.ALLSRC} ${.TARGET}
94         strip -R .comment -R .note ${.TARGET}
95
96 loader.help: help.common help.i386
97         cat ${.ALLSRC} | awk -f ${.CURDIR}/../../common/merge_help.awk > ${.TARGET}
98
99 FILES=  ${LOADER}
100 # XXX INSTALLFLAGS_loader= -b
101 FILESMODE_${LOADER}= ${BINMODE} -b
102
103 .if !defined(LOADER_ONLY)
104 .PATH: ${.CURDIR}/../../forth 
105 FILES+= loader.help loader.4th support.4th loader.conf
106 FILES+= screen.4th frames.4th beastie.4th
107 FILESDIR_loader.conf=   /boot/defaults
108
109 .if !exists(${DESTDIR}/boot/loader.rc)
110 FILES+= loader.rc
111 .endif
112 .endif
113
114 # XXX crt0.o needs to be first for pxeboot(8) to work
115 OBJS=   ${BTXCRT} 
116
117 DPADD=  ${LIBFICL} ${LIBFIREWIRE} ${LIBZFS} ${LIBI386} ${LIBSTAND}
118 LDADD=  ${LIBFICL} ${LIBFIREWIRE} ${LIBZFS} ${LIBI386} -lstand
119
120 .include <bsd.prog.mk>
121
122 .if ${MACHINE_ARCH} == "amd64"
123 beforedepend ${OBJS}: machine
124 CLEANFILES+=    machine
125 machine:
126         ln -sf ${.CURDIR}/../../../i386/include machine
127 .endif