From a19633fede6beab5b80da4e642d15b88cd220807 Mon Sep 17 00:00:00 2001 From: Ivan Tatarinov Date: Sat, 24 Apr 2021 17:49:19 +0300 Subject: [PATCH] Makefile: initial commit + added ability to build `utils` and install them into `SD` directory --- Makefile | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..9643e01 --- /dev/null +++ b/Makefile @@ -0,0 +1,67 @@ +# Updates content of SD directory. +# +# Supported environments: +# * GNU on Linux, FreeBSD etc. +# * GNU on Windows NT (using MinGW/MSYS/Cygwin/WSL) +# +# Build: +# make +# Clean: +# make clean +# +# SPDX-FileCopyrightText: 2021 Ivan Tatarinov +# +# SPDX-License-Identifier: GPL-3.0-or-later + +include sdk/common.mk + +INSTALL_DIR=SD + +UTILS_TARGETS=\ + BACK16M\ + BACKZX2\ + BACKZXD\ + BACKUP\ + CORCLEAN\ + COREBIOS\ + ROMSBACK\ + ROMSUPGR\ + UPGR16M\ + UPGRZX2\ + UPGRZXD\ + UPGRADE + +UTILS_INSTALL_DIR=$(INSTALL_DIR)/BIN + +.PHONY: all +all:\ + install-utils + @echo 'Done.' + +# utils + +.PHONY: install-utils +install-utils: $(foreach t,$(UTILS_TARGETS),$(UTILS_INSTALL_DIR)/$(t)) | utils + +# $1 = target +define utils_rule = +$$(UTILS_INSTALL_DIR)/$1: utils/build/$1 | utils + mv $$< $$@ +utils/build/$1: | utils + $$(MAKE) -w -C $$| build/$$(@F) +endef + +$(foreach t,$(UTILS_TARGETS),$(eval $(call utils_rule,$(t)))) + +.PHONY: clean-utils +clean-utils: | utils + $(MAKE) -w -C $| clean + +.PHONY: uninstall-utils +uninstall-utils: clean-utils + rm -f $(foreach t,$(UTILS_TARGETS),$(UTILS_INSTALL_DIR)/$(t)) + +# clean + +.PHONY: clean +clean: uninstall-utils