msxbuild/lib/make/mb_msxhub.mk

17 lines
921 B
Makefile
Raw Normal View History

2021-07-04 00:12:48 +00:00
MB_MSXHUB_API ?= https://msxhub.com/api
MB_MSXHUB_CACHE ?= $(MB_CACHE)/msxbuild/msxhub
2024-06-20 22:06:06 +00:00
define _mb_msxhub_file_fetch
2021-07-04 00:12:48 +00:00
@echo === Fetch msxhub file
2024-06-20 22:06:06 +00:00
$(if $(wildcard $(dir $(MB_MSXHUB_CACHE)/$(subst $(MB_MSXHUB_API)/,,$(1)))),,$(call mb_mkdir,$(dir $(MB_MSXHUB_CACHE)/$(subst $(MB_MSXHUB_API)/,,$(1)))))
2024-06-25 13:57:13 +00:00
$(if $(wildcard $(MB_MSXHUB_CACHE)/$(subst $(MB_MSXHUB_API)/,,$(1))),,wget -O $(MB_MSXHUB_CACHE)/$(subst $(MB_MSXHUB_API)/,,$(1)) $(1))
2021-07-04 00:12:48 +00:00
endef
# NOTE: with HDD import/export we get duplicate files after openMSX run, so force to lowercase.
2021-07-04 00:12:48 +00:00
define mb_msxhub_file
2024-06-20 22:06:06 +00:00
$(if $(wildcard $(MB_MSXHUB_CACHE)/$(2)),,$(call _mb_msxhub_file_fetch,$(MB_MSXHUB_API)/$(2)))
$(if $(wildcard $(1)/$(call _mb_lowercase,$(notdir $(2)))),,$(call mb_copy,$(MB_MSXHUB_CACHE)/$(2),$(1)/$(call _mb_lowercase,$(notdir $(2)))))
$(if $(filter true,$(3)),$(call mb_copy,$(MB_MSXHUB_CACHE)/$(2),$(1)/$(call _mb_lowercase,$(notdir $(2)))))
2021-07-04 00:12:48 +00:00
endef