# Project configuration:
OBJS  = main.r30 rs232.r30 timer.r30 gfx.r30 tools.r30 ide.r30 mp3.r30 gui.r30
BIN   = main

#Compiler flags
CCFLAGS = -silent
LDFLAGS = $(CCFLAGS)
#-S für Assembleroutput
#-g für Debugging

# Compiler configuration:
CC      = nc30
LD      = nc30

#Do all
all: update image upload

#create ROM-Image
image: $(BIN)

#Upload to M16C
upload:
	C:\Programme\Elektronik\M16Cflasher\M16Cflasher COM2 115200 /ERASE /M62 C:\Daten\MATTHIAS\M16C\source\main.mot

#Bringt Dateien auf den neusten Stand
update:
	autover

#clean source directory
clean:
	del *.r30
	del *.bak
	del *.mot
	del *.map
	del *.x30

# Build rules:
main.r30: main.c version.h hardware.h
	$(CC) $(CCFLAGS) -c $<
%.r30: %.c hardware.h %.h
	$(CC) $(CCFLAGS) -c $<


$(BIN): $(OBJS)
	$(LD) $(LDFLAGS) -o$(BIN) -lnc30lib.lib ncrt0.a30 $^
	lmc30 $(BIN)

