CORE_PKGS += stdcxx libc libm
NO_UNDEFINED =

LIBRETRO_COMM_DIR =

DEBUG   = 0
LOG_PERFORMANCE = 0
HAVE_COMPAT = 0

ifeq ($(DEBUG), 1)
	DEFINES += -O0 -g
else
	DEFINES += -O2 -DHAVE_STDINT_H -DNDEBUG
	CXXFLAGS += -fno-exceptions -fno-rtti
endif

ifeq ($(LOG_PERFORMANCE), 1)
	DEFINES += -DLOG_PERFORMANCE
endif

include upstream/Makefile.common

DEFINES += $(COREDEFINES)

CFLAGS   += -w
CXXFLAGS   += -w

: foreach $(SOURCES_C) |> !libretro_cc |> {libretro_objs}
: foreach $(SOURCES_CXX) |> !libretro_cxx |> {libretro_objs}

: {libretro_objs} |> !libretro_core_link |> {core}
: {core} |> !collect_bin |>
: |> !bin |>

ifndef CONFIG_NO_NETWORK
: |> wget --quiet http://bluemsx.msxblue.com/rel_download/%o |> blueMSXv282.zip {zip}

: {zip} \
	|> unzip %f -d tmp ; tar cf %o -C tmp Machines Databases ; rm -r tmp \
	|> blueMSX.tar {tar}

: {tar} |> !collect_raw |>
: |> !raw |>
endif

PKG_DEPENDS += \
	@(PUBLIC_SRC_STDCXX) \
	_/raw/bluemsx \

: $(TUP_CWD)/runtime |> !collect_pkg_runtime |>
: |> !pkg |>
