ENDIAN_FLAGS=-EL
CFLAGS=$(ENDIAN_FLAGS) -msoft-float -O2 -march=r3000 -I. -Wl,-M

AS=mipsel-elf-as
AR=mipsel-elf-ar
CC=mipsel-elf-gcc
LD=mipsel-elf-ld
OBJDUMP=mipsel-elf-objdump
OBJCOPY=mipsel-elf-objcopy
FLASHGEN=flashgen

SRCS=libsys.c xcpt.c syscalls.c irq.c dbg.c mips_dis.c mips_gfx.c mips_ps2.c
OBJS=libsys.o xcpt.o syscalls.o irq.o dbg.o mips_dis.o mips_gfx.o mips_ps2.o

all: libsys.a
	$(MAKE) -C eb
	
%.o : %.c %.h
	$(CC) $(CFLAGS) -G 0 -c $(SRCS)

libsys.a: $(OBJS)
	$(AR) -r libsys.a $(OBJS)
	$(CC) $(CFLAGS) -G 0 -c startup.S
	$(CC) $(CFLAGS) -G 0 -c kernel.S
	
clean:
	rm -rf *.a *.o *.map *.dis *.elf > /dev/null
	$(MAKE) -C eb clean
	
