msxbuild/lib/make/mb_msxhub.mk
Willem Cazander 567f91be78
All checks were successful
Run test asserts / Test-Asserts (push) Successful in 2s
WIP Converted to per process openMSX share folder.
2024-06-27 16:58:21 +02:00

17 lines
921 B
Makefile

MB_MSXHUB_API ?= https://msxhub.com/api
MB_MSXHUB_CACHE ?= $(MB_CACHE)/msxbuild/msxhub
define _mb_msxhub_file_fetch
@echo === Fetch msxhub file
$(if $(wildcard $(dir $(MB_MSXHUB_CACHE)/$(subst $(MB_MSXHUB_API)/,,$(1)))),,$(call mb_mkdir,$(dir $(MB_MSXHUB_CACHE)/$(subst $(MB_MSXHUB_API)/,,$(1)))))
$(if $(wildcard $(MB_MSXHUB_CACHE)/$(subst $(MB_MSXHUB_API)/,,$(1))),,wget -O $(MB_MSXHUB_CACHE)/$(subst $(MB_MSXHUB_API)/,,$(1)) $(1))
endef
# NOTE: with HDD import/export we get duplicate files after openMSX run, so force to lowercase.
define mb_msxhub_file
$(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)))))
endef