8888 loader: rename STAND to _STANDALONE
[unleashed.git] / usr / src / boot / sys / boot / i386 / loader / Makefile
blob47a24f16c31448eae36822b808dab71c1ed52721
2 # This file and its contents are supplied under the terms of the
3 # Common Development and Distribution License ("CDDL"), version 1.0.
4 # You may only use this file in accordance with the terms of version
5 # 1.0 of the CDDL.
7 # A full copy of the text of the CDDL should have accompanied this
8 # source. A copy of the CDDL is also available via the Internet at
9 # http://www.illumos.org/license/CDDL.
13 # Copyright 2015 Toomas Soome <tsoome@me.com>
14 # Copyright 2016 RackTop Systems.
17 include $(SRC)/Makefile.master
18 include $(SRC)/boot/Makefile.version
20 CFLAGS= -O2
21 CPPFLAGS= -D_STANDALONE -nostdinc -I../../../../include -I../../..
22 CPPFLAGS += -I$(SRC)/uts/intel/sys/acpi
23 LOADER= zfsloader
24 NEWVERSWHAT= "ZFS enabled bootstrap loader" x86
25 MAN=
27 # Set by zfsloader Makefile
28 CPPFLAGS += -DLOADER_ZFS_SUPPORT -I../../zfs
29 CPPFLAGS += -I../libi386
30 LIBZFSBOOT= ../../zfs/i386/libzfsboot.a
31 LIBI386= ../libi386/libi386.a
33 # loader.help build needs better awk
34 AWK= /usr/xpg4/bin/awk
35 LD= $(GNU_ROOT)/bin/gld
36 CC= $(GCC_ROOT)/bin/gcc
37 OBJCOPY= $(GNU_ROOT)/bin/gobjcopy
38 GSTRIP= $(GNU_ROOT)/bin/gstrip
39 ROOT_BOOT= $(ROOT)/boot
40 ROOT_BOOT_DEFAULTS= $(ROOT)/boot/defaults
41 ROOT_BOOT_FORTH= $(ROOT)/boot/forth
42 ROOT_BOOT_CONF= $(ROOT)/boot/conf.d
43 ROOTBOOTFILES=$(FILES:%=$(ROOT_BOOT)/%)
44 ROOTBOOTFORTH=$(FORTH:%=$(ROOT_BOOT_FORTH)/%)
45 ROOTBOOTDEFAULTS=$(DEFFILES:%=$(ROOT_BOOT_DEFAULTS)/%)
46 FILEMODE=0444
48 all: ${LOADER} loader.help
50 install: all $(ROOTBOOTLOADER)
52 PROG= ${LOADER}.sym
53 INTERNALPROG=
55 # architecture-specific loader code
56 SRCS= main.c conf.c vers.c chain.c
58 CPPFLAGS += -DLOADER_GZIP_SUPPORT
60 # Enable BootForth
61 CPPFLAGS += -DBOOT_FORTH -I$(SRC)/common/ficl -I../../ficl
62 LIBFICL= ../../ficl/i386/libficl.a
64 # Always add MI sources
65 SRCS += boot.c commands.c console.c devopen.c interp.c
66 SRCS += interp_backslash.c interp_parse.c ls.c misc.c
67 SRCS += module.c panic.c linenoise.c multiboot2.c
69 SRCS += load_elf32.c load_elf32_obj.c reloc_elf32.c
70 SRCS += load_elf64.c load_elf64_obj.c reloc_elf64.c
72 SRCS += dev_net.c
74 SRCS += disk.c part.c
75 CPPFLAGS += -DLOADER_DISK_SUPPORT
76 SRCS += crc32.c
77 CPPFLAGS += -DLOADER_GPT_SUPPORT
78 CPPFLAGS += -DLOADER_MBR_SUPPORT
80 SRCS += bcache.c
82 SRCS += isapnp.c
83 SRCS += pnp.c
85 # Forth interpreter
86 SRCS += interp_forth.c
88 MAN += loader.8
89 MAN += zfsloader.8
90 CPPFLAGS += -I../../common
91 CPPFLAGS += -I.
93 CLEANFILES= vers.c ${LOADER} ${LOADER}.sym ${LOADER}.bin loader.help
95 CFLAGS += -Wall
96 LDFLAGS= -static -Ttext 0x0
98 # i386 standalone support library
99 CPPFLAGS += -I.. -I../../../../lib/libstand
100 LIBSTAND= ../../libstand/i386/libstand.a
102 # BTX components
103 CPPFLAGS += -I../btx/lib
105 # Debug me!
106 #CFLAGS+= -g
107 #LDFLAGS+= -g
109 include ../Makefile.inc
111 # For multiboot2.h, must be last, to avoid conflicts
112 CPPFLAGS += -I$(SRC)/uts/common
114 vers.c: ../../common/newvers.sh $(SRC)/boot/Makefile.version
115 $(SH) ../../common/newvers.sh ${LOADER_VERSION} ${NEWVERSWHAT}
117 ${LOADER}: ${LOADER}.bin ${BTXLDR} ${BTXKERN}
118 $(BTXLD) -f aout -e ${LOADER_ADDRESS} -o $@ -l ${BTXLDR} \
119 -b ${BTXKERN} ${LOADER}.bin
121 ${LOADER}.bin: ${LOADER}.sym
122 $(CP) $^ $@
123 $(GSTRIP) -R .comment -R .note $@
125 loader.help: ../../common/help.common help.i386
126 $(CAT) $^ | $(AWK) -f ../../common/merge_help.awk > $@
128 FILES= ${LOADER} loader.help
130 include ../../forth/Makefile.inc
131 FORTH += pcibios.4th
133 FILES += loader.rc
134 FORTH += menu.rc
136 # XXX crt0.o needs to be first for pxeboot(8) to work
138 DPADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND}
139 LDADD= ${LIBFICL} ${LIBZFSBOOT} ${LIBI386} ${LIBSTAND}
141 CLEANFILES += machine x86
143 machine:
144 $(RM) machine
145 $(SYMLINK) ../../../i386/include machine
147 x86:
148 $(RM) x86
149 $(SYMLINK) ../../../x86/include x86
151 OBJS= $(SRCS:%.c=%.o)
153 ${OBJS}: machine x86
155 ${PROG}: ${OBJS} $(LDADD)
156 $(LD) $(LDFLAGS) -o $@ $(BTXCRT) $(OBJS) $(LDADD)
158 clean: clobber
159 clobber:
160 $(RM) $(CLEANFILES) $(OBJS)
162 install: all $(ROOT_BOOT_DEFAULTS) $(ROOT_BOOT_FORTH) \
163 $(ROOTBOOTFILES) $(ROOTBOOTDEFAULTS) $(ROOT_BOOT_CONF) $(ROOTBOOTFORTH)
165 %.o: ../../common/%.c
166 $(COMPILE.c) -o $@ $<
168 %.o: ../../common/linenoise/%.c
169 $(COMPILE.c) -o $@ $<
171 $(ROOT_BOOT)/%: ../../forth/%
172 $(INS.file)
174 $(ROOT_BOOT_DEFAULTS)/%: ../../forth/%
175 $(INS.file)
177 $(ROOT_BOOT_FORTH)/%: ../../forth/%
178 $(INS.file)
180 $(ROOT_BOOT_DEFAULTS) $(ROOT_BOOT_CONF) $(ROOT_BOOT_FORTH):
181 $(INS.dir)