include $(ROOT)/usr/include/make/SCdefs

LCOPTS += -marm

LLDOPTS += -T $(ROOT)/usr/lib/sc/linker.dat $(ROOT)/usr/lib/sc/dv_crt0.o
LLDLIBS += -lioslibc -lvio

TARGETS = \
    abort.bin \
    example.bin \
    memory.bin \
    cache.bin \
    cache_rand.bin \
    interrupt.bin \
    dcache1.bin \
    recursive.bin \
    pwrloop1.bin \
    pwrloop2.bin \
    pwrloop3.bin \
    pwrloop4.bin \
    pwrloop5.bin \
    jumploop.bin \
    shared.bin \
    usermode.bin \
    coproc.bin \
    coprocb.bin \
    fiq.bin \
    mixabort.bin \
    mixfiq.bin \
    mixreg.bin \
    mixuser.bin \
    sdram

ASFILES = \
    lock.s \
    lockb.s \
    modeutil.s \
    intrhandler.s \
    fiqirq.s

CFILES = \
    abort.c \
    rand.c \
    jumploop.c \
    shared.c \
    usermode.c \
    example.c \
    dcache1.c \
    memory.c \
    recursive.c \
    pwrloop1.c \
    pwrloop2.c \
    pwrloop3.c \
    pwrloop4.c \
    pwrloop5.c \
    cache.c \
    cache_rand.c \
    interrupt.c \
    coproc.c \
    coprocb.c \
    fiq.c \
    mixabort.c \
    mixfiq.c \
    mixreg.c \
    mixuser.c

default: $(TARGETS)

include $(COMMONRULES)

LDIRT += dcache1.elf example.elf memory.elf cache_rand.elf cache.elf interrupt.elf \
         usermode.elf coproc.elf coprocb.elf mixabort.elf mixreg.elf \
         fiq.elf mixfiq.elf recursive.elf mixuser.elf abort.elf \
         pwrloop1.elf pwrloop2.elf pwrloop3.elf pwrloop4.elf pwrloop5.elf \
         shared.elf jumploop.elf hashes.c

abort.elf: abort.o

cache_rand.elf: cache_rand.o intrhandler.o hashes.o rand.o

hashes.c: $(ROOT)/usr/bin/x86/genhashes
	$(ROOT)/usr/bin/x86/genhashes > $@

sdram: mem.py
	python $^ > $@

cache.elf: cache.o

dcache1.elf: dcache1.o

example.elf: example.o

fiq.elf: fiqirq.o

memory.elf: memory.o

recursive.elf: recursive.o

pwrloop1.elf: pwrloop1.o

pwrloop2.elf: pwrloop2.o

pwrloop3.elf: pwrloop3.o

pwrloop4.elf: pwrloop4.o

pwrloop5.elf: pwrloop5.o

jumploop.elf: rand.o

shared.elf: rand.o

usermode.elf: modeutil.o

coproc.elf: lock.o rand.o

coprocb.elf: lockb.o rand.o

mixabort.elf: modeutil.o

mixfiq.elf: fiqirq.o

mixreg.elf: mixreg.o

mixuser.elf: modeutil.o fiqirq.o

interrupt.elf: intrhandler.o
