# $Id$
# Application Makefile (C) 2002 The UbixOS Project

# Include Global 'Source' Options
include ../../Makefile.inc
include ../Makefile.inc

#Compiler Flags
CFLAGS = -I../../include -fno-builtin

#Linker
LD = ld

#Binary File Name
BINARY = mbr

#Delete Program
REMOVE = rm -f

#Objects
OBJS = mbr.o
ORG  = 0x600

#Startup File
#STARTUP = ../../../lib/ubix/startup.o

# Link The Binary
$(BINARY) : $(OBJS)
#	$(CC) -O -pipe  -ffreestanding -mpreferred-stack-boundary=2  -N -e start -Ttext $(ORG) -nostdlib -o $(BINARY).out $(OBJS) 
	$(CC) -O -pipe  -ffreestanding -mpreferred-stack-boundary=2  -N -e start -Wl,-Ttext,$(ORG) -nostdlib -o $(BINARY).out $(OBJS)
	objcopy -S -O binary $(BINARY).out $(BINARY) 

# Compile the source files
.cc.o:
	$(CXX)  -Wall -fomit-frame-pointer -O $(CFLAGS) -c -o $@ $<
 
.cc.s:
	$(CXX)  -Wall -fomit-frame-pointer -O $(CFLAGS) -S -o $@ $<
 
.c.o:
	$(CC)  -Wall -O $(CFLAGS) -c -o $@ $<

.s.o:
	as -defsym FLAGS=0xf  --defsym TICKS=0xb6  --defsym COMSPEED=0xE3 -o $@ $<
 
.c.s:
	$(CC)  -Wall -fomit-frame-pointer -O $(CFLAGS) -S -o $@ $<
 
.S.o:
	$(CC)  -Wall -fomit-frame-pointer -c -o $@ $<
 
# Clean Up The junk
clean:
	$(REMOVE) $(OBJS) $(BINARY) $(BINARY).out
