LD=mipsel-unknown-elf-ld
CC=mipsel-unknown-elf-gcc
AS=mipsel-unknown-elf-as
DU=mipsel-unknown-elf-objdump

OBJS= reset.o	\
	  giet.o	\
	  stdio.o	\
	  drivers.o	\
	  main.o

CFLAGS= -Wall -ffreestanding -fomit-frame-pointer -mips32 -ggdb

GIET= ../../giet

bin.soft: $(OBJS) ldscript
	$(LD) -o $@ -T ldscript $(OBJS)
	$(DU) -D $@ > $@.txt

reset.o: reset.s
	$(AS) -g -mips32 -o $@ $<
giet.o: $(GIET)/giet.s
	$(AS) -g -mips32 -o $@ $<

drivers.o: $(GIET)/drivers.c
	$(CC) $(CFLAGS) -c -o $@ $<
stdio.o: $(GIET)/stdio.c
	$(CC) $(CFLAGS) -c -o $@ $<

main.o: main.c
	$(CC) $(CFLAGS) -I$(GIET) -c -o $@ $<

clean:
	rm -f *.o bin.soft *.txt core *~

