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= -O2 -I../../../../include -I../../..
  20 CFLAGS += -DLOADER_ZFS_SUPPORT
  21 CPPFLAGS=
  22 
  23 all: libi386.a
  24 
  25 libi386.a: machine x86
  26 
  27 install: all
  28 
  29 clean: clobber
  30 clobber:
  31         $(RM) machine x86 $(OBJS) libi386.a
  32 
  33 AS=     $(GNU_ROOT)/bin/gas
  34 CC=     $(GCC_ROOT)/bin/gcc
  35 OBJCOPY= $(GNU_ROOT)/bin/gobjcopy
  36 AS_FLAGS=--32
  37 ASFLAGS=-m32
  38 AS_CPPFLAGS=
  39 COMPILE.s  = $(AS) $(AS_FLAGS)
  40 
  41 SRCS=   biosacpi.c bioscd.c biosdisk.c biosmem.c biospnp.c \
  42         biospci.c biossmap.c bootinfo.c bootinfo32.c bootinfo64.c \
  43         comconsole.c devicename.c elf32_freebsd.c \
  44         elf64_freebsd.c multiboot.c multiboot_tramp.S \
  45         i386_copy.c i386_module.c nullconsole.c pxe.c pxetramp.s \
  46         smbios.c time.c vidconsole.c amd64_tramp.S spinconsole.c linux.c \
  47         relocater_tramp.S
  48 OBJS=   biosacpi.o bioscd.o biosdisk.o biosmem.o biospnp.o \
  49         biospci.o biossmap.o bootinfo.o bootinfo32.o bootinfo64.o \
  50         comconsole.o devicename.o elf32_freebsd.o \
  51         elf64_freebsd.o multiboot.o multiboot_tramp.o \
  52         i386_copy.o i386_module.o nullconsole.o pxe.o pxetramp.o \
  53         smbios.o time.o vidconsole.o amd64_tramp.o spinconsole.o linux.o \
  54         relocater_tramp.o
  55 
  56 LIBZFS=  ../../zfs
  57 SRCS += $(LIBZFS)/devicename_stubs.c
  58 OBJS += devicename_stubs.o
  59 
  60 # Enable PXE TFTP or NFS support, not both.
  61 CFLAGS +=       -DLOADER_TFTP_SUPPORT
  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 # Include simple terminal emulation (cons25-compatible)
  80 CFLAGS += -DTERM_EMU
  81 
  82 # XXX: make alloca() useable
  83 CFLAGS += -Dalloca=__builtin_alloca
  84 
  85 CFLAGS +=       -I../../common -I../common \
  86                 -I../btx/lib \
  87                 -I../../../contrib/dev/acpica/include \
  88                 -I../../.. -I.
  89 # the location of libstand
  90 CFLAGS +=       -I../../../../lib/libstand/
  91 
  92 # Handle FreeBSD specific %b and %D printf format specifiers
  93 #FORMAT_EXTENSIONS=-D__printf__=__freebsd_kprintf__
  94 #CFLAGS += ${FORMAT_EXTENSIONS}
  95 
  96 CLEANFILES +=   machine x86
  97 
  98 # XXX: clang integrated-as doesn't grok .codeNN directives yet
  99 # CFLAGS.amd64_tramp.S= ${CLANG_NO_IAS}
 100 # CFLAGS.multiboot_tramp.S=     ${CLANG_NO_IAS}
 101 # CFLAGS +=             ${CFLAGS.${.IMPSRC:T}}
 102 
 103 include ../Makefile.inc
 104 
 105 machine:
 106         $(RM) machine
 107         $(SYMLINK) ../../../i386/include machine
 108 
 109 x86:
 110         $(RM) x86
 111         $(SYMLINK) ../../../x86/include x86
 112 
 113 libi386.a: machine $(OBJS)
 114         $(AR) $(ARFLAGS) $@ $(OBJS)
 115 
 116 %.o:    $(LIBZFS)/%.c
 117         $(COMPILE.c) -o $@ $<