BINDIR = ./bin

FORMAT = elf
PREFIX	= mips-rmt-$(FORMAT)
CC 		= $(PREFIX)-gcc
CPP		= $(PREFIX)-gcc -E
AS 		= $(PREFIX)-gcc
REMOVE		= rm -f

LIBGCC		= $(shell $(CC) -print-libgcc-file-name)
LIBC		= $(shell $(CC) -print-file-name=libc.a)

CFLAGS		= -O2 -Wa,-murmtp -Wa,-rmtbug-xsync -Wa,-rmtbug-delaynop -Wa,-rmtbug-nopsync
#CFLAGS		= -Wa,-murmtp 
CFLAGS		+= -Wextra -Wstrict-prototypes -pipe -finline-functions \
		--param max-inline-insns-auto=0 -frename-registers \
		-march=mips1
GCC = gcc

.PHONY: all
all: boot.o main.o pci.o printk.o uart.o
#all: boot.o main.o uart.o

%.o: %.c
	$(AS) -c $(CFLAGS) -I./include -o $(BINDIR)/$@ $<

%.o: %.S
	$(AS) -c -D__ASSEMBLY__ $(CFLAGS) -I./include -o $(BINDIR)/$@ $<

.PHONY: clean install
clean:
	-$(REMOVE) *.o *.d *~
