# Normally makefiles should include a *defs file and commonrules,
# but this makefile needs to work when the tree is first created
# before those files have been placed in $ROOT
#
include $(ROOT)/usr/include/make/NGdefs

LATEST = rel_0.6
DEST_ROOT=$(ROOT)/usr/bin/nintendo

INST=$(LATEST)/16instruction.bin
BS1=$(LATEST)/BS1.img
BS2=$(LATEST)/BS2.img

ifeq ($(RVL_MEM), 128)
BOOT=$(LATEST)/bootinfo.128.bin
else
ifeq ($(RVL_MEM), 64)
BOOT=$(LATEST)/bootinfo.64.bin
endif
endif

#Compat boot files
COMPAT_LATEST = compat_0.0
COMPAT_DEST_ROOT=$(ROOT)/usr/bin/nintendo/compat
#INST is the same as for normal mode. BS1, BS2 are different
#bootinfo is a dummy.
COMPAT_BS2=$(COMPAT_LATEST)/BS2.img
COMPAT_BS1=$(COMPAT_LATEST)/BS1.img

exports install:
	mkdir -p $(DEST_ROOT)
	$(INSTALL) $(INST) $(DEST_ROOT)
	$(INSTALL) $(BS1) $(DEST_ROOT)
	$(INSTALL) $(BS2) $(DEST_ROOT)
	$(INSTALL) $(BOOT) $(DEST_ROOT)/bootinfo.bin
	mkdir -p $(COMPAT_DEST_ROOT)
	$(INSTALL) $(INST) $(COMPAT_DEST_ROOT)
	$(INSTALL) $(COMPAT_BS1) $(COMPAT_DEST_ROOT)
	$(INSTALL) $(COMPAT_BS2) $(COMPAT_DEST_ROOT)
	$(INSTALL) $(BOOT) $(COMPAT_DEST_ROOT)/bootinfo.bin

clobber headers clean all:
