#
# GNUmakefile is a wrapper for the real Makefile that includes
# rules for installing the source.  GNU make will use GNUmakefile
# preferentially over Makefile if both exist.
#

include Makefile

SRCDIR = $(ROOT)/usr/src/gba/nuptest

.PHONY: install_src
install_src:
	-mkdir -p $(SRCDIR)
	@for file in $(ASFILES) $(CFILES) $(HFILES); do \
		echo "Installing $$file"; \
		if [[ -s $(VPATH)/$$file ]]; then \
			$(INSTALL) $(VPATH)/$$file $(SRCDIR); \
		else \
			$(INSTALL) $$file $(SRCDIR); \
		fi; \
	done
	$(INSTALL) Makefile $(SRCDIR)

install: $(TARGETS) install_src
	$(INSTALL) $(TARGETS) $(ROOT)/usr/bin/gba
