TOPDIR=.
include $(TOPDIR)/Makefile.config


all: dumps user_lib instruction_tests syscall
# 
# Main targets
#

instruction_tests:
	$(MAKE) build -C test/riscv_instructions/

dumps:
	$(MAKE) dumps -C test/riscv_instructions/
	mkdir -p ${TOPDIR}/target/dumps/
	find . -path ${TOPDIR}/target -prune -o -name '*.dump' -exec mv {} ${TOPDIR}/target/dumps/ \;

user_lib:
	$(MAKE) -C userlib/

syscall: user_lib
	$(MAKE) build -C test/syscall_tests/
	$(RM) test/syscall_tests/*.o
	mkdir -p ${TOPDIR}/target/guac/
	find . -name '*.guac' -exec mv {} ${TOPDIR}/target/guac/ \;

clean:
	$(MAKE) clean -C userlib/
	$(MAKE) clean -C test/
	$(RM) -rf $(TOPDIR)/target
	