#
# @(#)Makefile
#
# Copyright 1999-2001, Aaron Ardiri (mailto:aaron@ardiri.com)
# All rights reserved.
#
# The  source code outlines a number of basic Helio Computing Programming
# principles and you  should be able to take the core structure and write 
# a large complex program. It is distributed WITHOUT ANY WARRANTY; use it
# "AS IS" and at your own risk.
#
# The code presented is Copyright by Aaron Ardiri. It should be used  for 
# educational purposes only.  You shall not modify the Cube3D source code 
# in  any way and  re-distribute it as your own,  however you are free to
# use the code as a guide for developing programs on the Helio  Computing 
# Platform.
#

# compiler setup
PREFIX    = c:/Progra~1/GNUHEL~1/SDK/
AS        = gcc
CC        = gcc
LD        = ld

# compiler flags 
PROCESSOR = POSEIDON
INCLUDE   = $(PREFIX)include
LIB       = $(PREFIX)lib
ASFLAGS   = -O2 -G0 -g -I$(INCLUDE) -EL -DP31700
CCFLAGS   = $(ASFLAGS) -s -msoft-float -mno-abicalls -mips2
LDFLAGS   = -n -warn-common -Map resource/link.map -EL -nostdlib -G 0

# source / outputs
LD_OBJS   = appstart.o gccfix.o syscall.o resource/gfx.a
OBJS      = helio.o device.o help.o cube3D.o resource.o

# compile requirements
main.obj: $(OBJS) $(LD_OBJS)
	$(LD) $(LDFLAGS) -T resource/link.cmd -o $@ $(OBJS) $(LD_OBJS)

# compile rules
%.o: %.S
	$(AS) -c $(ASFLAGS) $<
%.o: %.c
	$(CC) -c $(CCFLAGS) $<

# clean-up funtions
clean:
	rm -f *.[oO] *.OBJ *.BIN c.txt resource.c *~ main.* 

distclean:
	rm -f *.[oO] *.OBJ *.BIN c.txt resource.c *~ main.* *.app
