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
17 include $(SRC)/Makefile.master
18
19 CFLAGS= -Os
20 CPPFLAGS= -nostdinc -I../../../../include -I../../..
21 CPPFLAGS += -I../../../../lib/libz
22 CPPFLAGS += -D_STANDALONE -DLOADER_ZFS_SUPPORT
23
24 all: libi386.a
25
26 clean: clobber
27 clobber:
28 $(RM) machine x86 $(OBJS) libi386.a
29
30 AS= $(GNU_ROOT)/bin/gas
31 CC= $(GCC_ROOT)/bin/gcc
32 OBJCOPY= $(GNU_ROOT)/bin/gobjcopy
33 AS_FLAGS=--32
34 ASFLAGS=-m32
35 AS_CPPFLAGS=
36 COMPILE.s = $(AS) $(AS_FLAGS)
37
38 SRCS= biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp.c \
39 biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \
40 comconsole.c devicename.c elf32_freebsd.c \
41 elf64_freebsd.c multiboot.c multiboot_tramp.S \
42 i386_copy.c i386_module.c nullconsole.c pxe.c pxetramp.s \
43 smbios.c time.c vidconsole.c amd64_tramp.S spinconsole.c linux.c \
44 relocater_tramp.S vgasubr.c vbe.c
45 OBJS= biosacpi.o bioscd.o biosdisk.o biosmem.o biospnp.o \
46 biospci.o biossmap.o bootinfo.o bootinfo32.o bootinfo64.o \
47 comconsole.o devicename.o elf32_freebsd.o \
48 elf64_freebsd.o multiboot.o multiboot_tramp.o \
49 i386_copy.o i386_module.o nullconsole.o pxe.o pxetramp.o \
50 smbios.o time.o vidconsole.o amd64_tramp.o spinconsole.o linux.o \
51 relocater_tramp.o vgasubr.o vbe.o
52
53 COMMON= ../../common
54 PNGLITE=$(SRC)/common/pnglite
55 CPPFLAGS += -I$(PNGLITE)
56 SRCS += $(COMMON)/gfx_fb.c $(PNGLITE)/pnglite.c
57 OBJS += gfx_fb.o pnglite.o
58
59 LIBZFS= ../../zfs
60 SRCS += $(LIBZFS)/devicename_stubs.c
61 OBJS += devicename_stubs.o
62
63 BOOT_COMCONSOLE_PORT= 0x3f8
64 CFLAGS += -DCOMPORT=${BOOT_COMCONSOLE_PORT}
65
66 BOOT_COMCONSOLE_SPEED= 9600
67 CFLAGS += -DCOMSPEED=${BOOT_COMCONSOLE_SPEED}
68
69 # Make the disk code more talkative
70 # CFLAGS+= -DDISK_DEBUG
71
72 # Export serial numbers, UUID, and asset tag from loader.
73 CFLAGS += -DSMBIOS_SERIAL_NUMBERS
74 # Use little-endian UUID format as defined in SMBIOS 2.6.
75 CFLAGS += -DSMBIOS_LITTLE_ENDIAN_UUID
76 # Use network-endian UUID format for backward compatibility.
77 #CFLAGS += -DSMBIOS_NETWORK_ENDIAN_UUID
78
79 # XXX: make alloca() useable
80 CFLAGS += -Dalloca=__builtin_alloca
81
82 CFLAGS += -I$(SRC)/common/ficl -I../../libficl \
83 -I../../common -I../common \
84 -I../btx/lib \
85 -I$(SRC)/uts/intel/sys/acpi \
86 -I../../.. -I.
87 # the location of libstand
88 CFLAGS += -I../../../../lib/libstand/
89
90 # Handle FreeBSD specific %b and %D printf format specifiers
91 #FORMAT_EXTENSIONS=-D__printf__=__freebsd_kprintf__
92 #CFLAGS += ${FORMAT_EXTENSIONS}
93
94 CLEANFILES += machine x86
95
96 # XXX: clang integrated-as doesn't grok .codeNN directives yet
97 # CFLAGS.amd64_tramp.S= ${CLANG_NO_IAS}
98 # CFLAGS.multiboot_tramp.S= ${CLANG_NO_IAS}
99 # CFLAGS += ${CFLAGS.${.IMPSRC:T}}
100
101 include ../Makefile.inc
102
103 # For multiboot2.h, must be last, to avoid conflicts
104 CPPFLAGS += -I$(SRC)/uts/common
105
106 machine:
107 $(RM) machine
108 $(SYMLINK) ../../../i386/include machine
109
110 x86:
111 $(RM) x86
112 $(SYMLINK) ../../../x86/include x86
113
114 $(OBJS): machine x86
115
116 libi386.a: $(OBJS)
117 $(AR) $(ARFLAGS) $@ $(OBJS)
118
119 %.o: $(LIBZFS)/%.c
120 $(COMPILE.c) -o $@ $<
121
122 %.o: $(COMMON)/%.c
123 $(COMPILE.c) -o $@ $<
124
125 %.o: $(PNGLITE)/%.c
126 $(COMPILE.c) -o $@ $<