9973 loader: use smbios specific defines only with smbios.c
[unleashed.git] / usr / src / boot / sys / boot / i386 / gptzfsboot / Makefile
blob50b9064379923f9a54a2c14fdc392824323f9337
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.
19 include $(SRC)/Makefile.master
20 include $(SRC)/boot/Makefile.version
22 AS= $(GNU_ROOT)/bin/gas
23 LD= $(GNU_ROOT)/bin/gld
24 CC= $(GNUC_ROOT)/bin/gcc
25 OBJCOPY= $(GNU_ROOT)/bin/gobjcopy
27 PROG= gptzfsboot
28 MAN= gptzfsboot.8
29 FILEMODE=0444
31 BOOT_COMCONSOLE_PORT= 0x3f8
32 BOOT_COMCONSOLE_SPEED= 9600
33 B2SIOFMT= 0x3
35 REL1= 0x700
36 ORG1= 0x7c00
37 ORG2= 0x0
39 CPPFLAGS=
40 CFLAGS= -nostdinc -DBOOTPROG=\"gptzfsboot\" \
41 -O1 \
42 -DGPT -DBOOT2 \
43 -DLOADER_MBR_SUPPORT -DLOADER_GPT_SUPPORT \
44 -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
45 -DSIOFMT=${B2SIOFMT} \
46 -DSIOSPD=${BOOT_COMCONSOLE_SPEED} \
47 -I../../../../include \
48 -I../../../../lib/libstand \
49 -I../../../../lib/libz \
50 -I../../common \
51 -I../common \
52 -I../../zfs \
53 -I../../../cddl/boot/zfs \
54 -I../btx/lib -I. \
55 -I../../.. \
56 -I../libi386 \
57 -Wall -Waggregate-return -Wbad-function-cast -Wcast-align \
58 -Wmissing-declarations -Wmissing-prototypes -Wnested-externs \
59 -Wpointer-arith -Wshadow -Wwrite-strings \
60 -Winline -Wno-unknown-pragmas
62 CFLAGS += --param max-inline-insns-single=100
63 CFLAGS += -fno-reorder-functions
65 LD_FLAGS=-static -N --gc-sections
66 CCASFLAGS=-Wa,--divide
67 LIBSTAND= ../../libstand/$(MACH)/libstand.a
68 LIBZFSBOOT= ../../zfs/$(MACH)/libzfsboot.a
70 include ../Makefile.inc
72 .PARALLEL:
74 all: $(PROG)
76 install: all $(ROOTBOOTPROG)
78 OBJS = multiboot.o zfsboot.o sio.o cons.o panic.o devopen.o \
79 part.o biosmem.o smbios.o biosdisk.o devicename.o disk.o bcache.o \
80 time.o
82 smbios.o := CPPFLAGS += -DSMBIOS_SERIAL_NUMBERS
83 smbios.o := CPPFLAGS += -DSMBIOS_LITTLE_ENDIAN_UUID
85 CLEANFILES= gptzfsboot $(OBJS)
87 gptzfsboot: gptldr.bin gptzfsboot.bin ${BTXKERN}
88 $(BTXLD) -E ${ORG2} -f bin -b ${BTXKERN} -V ${BOOT_VERSION} -l \
89 gptldr.bin -o $@ gptzfsboot.bin
91 CLEANFILES += gptldr.bin gptldr.out gptldr.o
93 gptldr.bin: gptldr.out
94 ${OBJCOPY} -S -O binary gptldr.out $@
96 gptldr.out: gptldr.o
97 ${LD} ${LD_FLAGS} -e start -Ttext ${ORG1} -o $@ gptldr.o
99 CLEANFILES += gptzfsboot.bin gptzfsboot.out
101 gptzfsboot.bin: gptzfsboot.out
102 ${OBJCOPY} -S -O binary gptzfsboot.out $@
104 gptzfsboot.out: ${BTXCRT} ${OBJS} ${LIBZFSBOOT} ${LIBSTAND}
105 ${LD} ${LD_FLAGS} -Ttext ${ORG2} -o $@ ${BTXCRT} ${OBJS} \
106 ${LIBZFSBOOT} ${LIBSTAND}
108 machine:
109 $(RM) machine
110 $(SYMLINK) ../../../i386/include machine
112 x86:
113 $(RM) x86
114 $(SYMLINK) ../../../x86/include x86
116 $(OBJS): machine x86
118 %.o: ../common/%.c
119 $(COMPILE.c) -o $@ $<
121 %.o: ../../common/%.c
122 $(COMPILE.c) -o $@ $<
124 biosdisk.o: ../libi386/biosdisk.c
125 $(CC) $(CFLAGS) $(CPPFLAGS) -Dalloca=__builtin_alloca -c -o $@ ../libi386/$*.c
127 biosmem.o: ../libi386/biosmem.c
128 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c
130 smbios.o: ../libi386/smbios.c
131 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c
133 devicename.o: ../libi386/devicename.c
134 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c
136 time.o: ../libi386/time.c
137 $(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ ../libi386/$*.c
139 multiboot.o: ../../common/multiboot.S
140 $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ ../../common/$*.S
142 .S.o:
143 $(CC) $(CFLAGS) $(CCASFLAGS) -c -o $@ $<
145 clobber: clean
147 clean:
148 $(RM) $(CLEANFILES) machine x86