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 #
  15 
  16 include $(SRC)/Makefile.master
  17 
  18 PROG=   btx
  19 SRCS=   btx.S
  20 OBJS=   btx.o
  21 
  22 AS=     $(GNU_ROOT)/bin/gas
  23 LD=     $(GNU_ROOT)/bin/gld
  24 CC=     $(GCC_ROOT)/bin/gcc
  25 
  26 #.if defined(BOOT_BTX_NOHANG)
  27 #BOOT_BTX_FLAGS=0x1
  28 #.else
  29 BOOT_BTX_FLAGS=0x0
  30 #.endif
  31 
  32 CFLAGS = -DBTX_FLAGS=${BOOT_BTX_FLAGS}
  33 CFLAGS += -I./../../common
  34 CFLAGS += -march=i386 -ffreestanding -mno-mmx -mno-3dnow -mno-sse -mno-sse2
  35 CFLAGS += -mno-sse3 -msoft-float -m32 -std=gnu99
  36 CFLAGS += -Wa,--divide
  37 
  38 #.if defined(BTX_SERIAL)
  39 #BOOT_COMCONSOLE_PORT?= 0x3f8
  40 #BOOT_COMCONSOLE_SPEED?= 9600
  41 #B2SIOFMT?=     0x3
  42 #
  43 #CFLAGS+=-DBTX_SERIAL -DSIOPRT=${BOOT_COMCONSOLE_PORT} \
  44 #       -DSIOFMT=${B2SIOFMT} -DSIOSPD=${BOOT_COMCONSOLE_SPEED}
  45 #.endif
  46 
  47 ORG=    0x9000
  48 
  49 LDFLAGS=-e start -Ttext ${ORG} -N -S --oformat binary
  50 
  51 all:    $(PROG)
  52 
  53 $(PROG): $(OBJS)
  54         $(LD) $(LDFLAGS) -o $@ $(OBJS)
  55 
  56 .S.o:
  57         $(CC) $(CPPFLAGS) $(CFLAGS) -c -o $@ $<
  58 
  59 clobber: clean
  60 
  61 clean:
  62         $(RM) $(PROG) $(OBJS)