1#
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.
6#
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.
10#
11
12#
13# Copyright 2015 Toomas Soome <tsoome@me.com>
14# Copyright 2016 RackTop Systems.
15#
16
17include $(SRC)/Makefile.master
18include $(SRC)/boot/sys/boot/Makefile.inc
19
20CPPFLAGS += -I../../../../include -I../../..
21CPPFLAGS += -I$(ZFSSRC)
22
23all install: libi386.a
24
25clean: clobber
26clobber:
27	$(RM) machine x86 $(OBJS) libi386.a
28
29SRCS=	\
30	amd64_tramp.S \
31	bio.c \
32	biosacpi.c \
33	biosdisk.c \
34	biosmem.c \
35	biospci.c \
36	biospnp.c \
37	biossmap.c \
38	bootinfo.c \
39	bootinfo32.c \
40	bootinfo64.c \
41	comconsole.c \
42	cpuid.c \
43	devicename.c \
44	elf32_freebsd.c \
45	elf64_freebsd.c \
46	i386_copy.c \
47	i386_module.c \
48	linux.c \
49	multiboot.c \
50	multiboot_tramp.S \
51	nullconsole.c \
52	pxe.c \
53	pxetramp.s \
54	relocater_tramp.S \
55	smbios.c \
56	spinconsole.c \
57	time.c \
58	vbe.c \
59	vgasubr.c \
60	vidconsole.c
61
62OBJS=	\
63	amd64_tramp.o \
64	bio.o \
65	biosacpi.o \
66	biosdisk.o \
67	biosmem.o \
68	biospci.o \
69	biospnp.o \
70	biossmap.o \
71	bootinfo.o \
72	bootinfo32.o \
73	bootinfo64.o \
74	comconsole.o \
75	cpuid.o \
76	devicename.o \
77	elf32_freebsd.o \
78	elf64_freebsd.o \
79	i386_copy.o \
80	i386_module.o \
81	linux.o \
82	multiboot.o \
83	multiboot_tramp.o \
84	nullconsole.o \
85	pxe.o \
86	pxetramp.o \
87	relocater_tramp.o \
88	smbios.o \
89	spinconsole.o \
90	time.o \
91	vbe.o \
92	vgasubr.o \
93	vidconsole.o
94
95COMMON=  ../../common
96VGASUBR=$(SRC)/common/vga
97CPPFLAGS += -I$(PNGLITE)
98SRCS +=	$(COMMON)/gfx_fb.c $(PNGLITE)/pnglite.c
99OBJS +=	gfx_fb.o pnglite.o
100
101gfx_fb.o := CPPFLAGS += $(DEFAULT_CONSOLE_COLOR) -I$(LZ4)
102pnglite.o := CPPFLAGS += -I$(ZLIB)
103
104SRCS +=	$(ZFSSRC)/devicename_stubs.c
105OBJS +=	devicename_stubs.o
106
107BOOT_COMCONSOLE_PORT= 0x3f8
108CPPFLAGS +=	-DCOMPORT=${BOOT_COMCONSOLE_PORT}
109
110BOOT_COMCONSOLE_SPEED= 9600
111CPPFLAGS +=	-DCOMSPEED=${BOOT_COMCONSOLE_SPEED}
112
113# Make the disk code more talkative
114# CPPFLAGS+= -DDISK_DEBUG
115
116# Export serial numbers, UUID, and asset tag from loader.
117smbios.o := CPPFLAGS += -DSMBIOS_SERIAL_NUMBERS
118# Use little-endian UUID format as defined in SMBIOS 2.6.
119smbios.o := CPPFLAGS += -DSMBIOS_LITTLE_ENDIAN_UUID
120# Use network-endian UUID format for backward compatibility.
121#CPPFLAGS += -DSMBIOS_NETWORK_ENDIAN_UUID
122
123# XXX: make alloca() useable
124CPPFLAGS += -Dalloca=__builtin_alloca
125
126CPPFLAGS +=	-I$(SRC)/common/ficl -I../../libficl \
127		-I../../common -I../common \
128		-I../btx/lib \
129		-I$(SRC)/uts/intel/sys/acpi \
130		-I../../.. -I.
131# the location of libstand
132CPPFLAGS +=	-I../../../../lib/libstand/
133
134multiboot.o := CPPFLAGS += -I../../../cddl/boot/zfs
135multiboot2.o := CPPFLAGS += -I../../../cddl/boot/zfs
136devicename.o := CPPFLAGS += -I../../../cddl/boot/zfs
137devicename_stubs.o := CPPFLAGS += -I../../../cddl/boot/zfs
138
139CLEANFILES +=	machine x86
140
141include ../Makefile.inc
142
143# For multiboot2.h, must be last, to avoid conflicts
144CPPFLAGS +=	-I$(SRC)/uts/common
145
146machine:
147	$(RM) machine
148	$(SYMLINK) ../../../i386/include machine
149
150x86:
151	$(RM) x86
152	$(SYMLINK) ../../../x86/include x86
153
154$(OBJS): machine x86
155
156libi386.a: $(OBJS)
157	$(AR) $(ARFLAGS) $@ $(OBJS)
158
159%.o:	$(ZFSSRC)/%.c
160	$(COMPILE.c) -o $@ $<
161
162%.o:	$(COMMON)/%.c
163	$(COMPILE.c) -o $@ $<
164
165%.o:	$(PNGLITE)/%.c
166	$(COMPILE.c) -o $@ $<
167
168%.o:	$(VGASUBR)/%.c
169	$(COMPILE.c) -o $@ $<
170