
OBJCOPY = objcopy
CFLAGS = -c -DLINUX -I.. -Os --freestanding -fomit-frame-pointer
LDFLAGS = -T ../bios.lds -static -nostdlib

all: test01.rom

main.o: main.S
	gcc $(CFLAGS) main.S

lib.o: lib.c
	gcc $(CFLAGS) lib.c
	

test01.elf: main.o lib.o  
	ld $(LDFLAGS) main.o lib.o -o test01.elf

test01.rom: test01.elf
	$(OBJCOPY) -O binary -j .text -j .rodata -j .data -j .bss -j .text.reset $< test01.rom

clean:
	rm -f *.o* *.rom *.elf
