include version.all ifneq ($(CROSS_COMPILE),arm-webos-linux-gnueabi-) $(error You need webOS toolchain to build this. See https://github.com/webosbrew/native-toolchain) endif ifdef SDKTARGETSYSROOT $(warning OE-based toolchain isn't supported anymore. Please use https://github.com/webosbrew/native-toolchain) STAGING_DIR = $(SDKTARGETSYSROOT) else ifndef STAGING_DIR $(error Can't find buildroot based toolchain. Please use https://github.com/webosbrew/native-toolchain) endif WEBOS_FREETYPE_CONFIG ?= $(STAGING_DIR)/usr/bin/freetype-config WEBOS_INC_DIR ?= $(STAGING_DIR)/usr/include WEBOS_LIB_DIR ?= $(STAGING_DIR)/usr/lib ADD_SDL2_LIB ?= 0 SDL2_PREBUILT_ARCHIVE ?= https://github.com/webosbrew/SDL-webOS/releases/download/release-2.30.0-2/SDL2-2.30.0-webos.tar.gz ######################### ######################### PACKAGE_NAME = com.retroarch PACKAGE_VERSION := $(patsubst "%",%,$(RARCH_VERSION)) DEBUG ?= 0 HAVE_CLOUDSYNC = 1 HAVE_SCREENSHOTS = 1 HAVE_REWIND = 1 HAVE_7ZIP = 1 HAVE_ACCESSIBILITY = 1 HAVE_AL = 0 # ALSA freezes when switching back from menu HAVE_ALSA = 0 HAVE_ANGLE = 0 HAVE_AUDIOIO = 0 HAVE_AUDIOMIXER = 1 HAVE_BLISSBOX = 0 HAVE_BSV_MOVIE = 1 HAVE_BUILTINBEARSSL = 0 HAVE_BUILTINFLAC = 1 HAVE_DSP_FILTER = 1 HAVE_VIDEO_FILTER = 1 HAVE_STATIC_VIDEO_FILTERS = 1 HAVE_STATIC_AUDIO_FILTERS = 1 HAVE_FILTERS_BUILTIN = 1 HAVE_BUILTINMBEDTLS = 1 HAVE_BUILTINZLIB = 1 HAVE_C99 = 1 HAVE_CC = 1 HAVE_CC_RESAMPLER = 1 HAVE_NEAREST_RESAMPLER = 1 HAVE_CHD = 1 HAVE_COMMAND = 1 HAVE_CXX = 1 HAVE_DR_MP3 = 1 HAVE_DYNAMIC = 1 HAVE_DYLIB = 1 HAVE_EGL = 0 HAVE_FREETYPE = 0 HAVE_GDI = 1 HAVE_GETADDRINFO = 1 HAVE_GETOPT_LONG = 1 HAVE_GLSL = 1 HAVE_GLSLANG = 0 HAVE_GLSLANG_HLSL = 0 HAVE_GLSLANG_OGLCOMPILER = 0 HAVE_GLSLANG_OSDEPENDENT = 0 HAVE_GLSLANG_SPIRV = 0 HAVE_GLSLANG_SPIRV_TOOLS = 0 HAVE_GLSLANG_SPIRV_TOOLS_OPT = 0 HAVE_HID = 1 HAVE_IBXM = 1 HAVE_IMAGEVIEWER = 1 HAVE_LANGEXTRA = 1 HAVE_LIBRETRODB = 1 HAVE_MENU = 1 HAVE_MENU_COMMON = 1 HAVE_NEON = 1 HAVE_NETWORKING = 1 HAVE_IFINFO = 1 HAVE_NETWORK_CMD = 1 HAVE_NETPLAYDISCOVERY = 1 HAVE_NETWORKGAMEPAD = 1 HAVE_GFX_WIDGETS = 1 HAVE_MMAP = 1 HAVE_ONLINE_UPDATER = 1 HAVE_OPENDINGUX_FBDEV = 0 HAVE_OPENGL = 0 HAVE_OPENGL1 = 0 HAVE_OPENGL_CORE = 0 HAVE_OPENGLES = 1 HAVE_OPENGLES3 = 0 HAVE_OPENGLES3_1 = 0 HAVE_OPENGLES3_2 = 0 HAVE_OPENSSL = 0 HAVE_OVERLAY = 1 HAVE_PULSE = 1 HAVE_RBMP = 1 HAVE_RJPEG = 1 HAVE_RPILED = 0 HAVE_RPNG = 1 HAVE_RUNAHEAD = 1 HAVE_SDL = 0 HAVE_SDL2 = 1 HAVE_SHADERPIPELINE = 1 HAVE_STB_FONT = 1 HAVE_STB_IMAGE = 1 HAVE_STB_VORBIS = 1 HAVE_STDIN_CMD = 1 HAVE_STRCASESTR = 1 HAVE_THREADS = 1 HAVE_UDEV = 0 HAVE_RGUI = 1 HAVE_MATERIALUI = 0 HAVE_XMB = 1 HAVE_OZONE = 1 HAVE_ZLIB = 1 HAVE_CONFIGFILE = 1 HAVE_PATCH = 1 HAVE_CHEATS = 1 HAVE_CHEEVOS = 1 HAVE_LIBSHAKE = 1 HAVE_UPDATE_ASSETS = 1 HAVE_UPDATE_CORES = 1 HAVE_UPDATE_CORE_INFO = 1 HAVE_CORE_INFO_CACHE = 1 OS = Linux TARGET = retroarch OBJ := LINK := $(CC) DEF_FLAGS += -ffunction-sections -fdata-sections DEF_FLAGS += -I. -Ideps -Ideps/stb -DWEBOS=1 -MMD DEF_FLAGS += -Wall -Wno-unused-variable LIBS := -ldl -lz -lrt -pthread CFLAGS := CXXFLAGS := -fno-exceptions -fno-rtti -std=c++11 -D__STDC_CONSTANT_MACROS ASFLAGS := LDFLAGS := -Wl,-rpath=\$$ORIGIN/lib,--gc-sections INCLUDE_DIRS = -I$(WEBOS_INC_DIR) LIBRARY_DIRS = -L$(WEBOS_LIB_DIR) DEFINES := -DRARCH_INTERNAL -D_FILE_OFFSET_BITS=64 -UHAVE_STATIC_DUMMY DEFINES += -DHAVE_C99=1 -DHAVE_CXX=1 -D_GNU_SOURCE DEFINES += -DHAVE_GETOPT_LONG=1 -DHAVE_STRCASESTR=1 -DHAVE_DYNAMIC=1 DEFINES += -DHAVE_FILTERS_BUILTIN DEFINES += -DHAVE_SDL2 DEFINES += -DHAVE_PULSE DEFINES += -DHAVE_NETWORKING -DHAVE_IFINFO -DHAVE_ONLINE_UPDATER -DHAVE_UPDATE_ASSETS -DHAVE_UPDATE_CORES DEFINES += -DHAVE_UPDATE_CORE_INFO PKG_CONFIG=pkg-config SDL2_CFLAGS := $(shell $(PKG_CONFIG) --cflags sdl2) SDL2_LIBS := $(shell $(PKG_CONFIG) --libs sdl2) OPENGLES_LIBS = -lGLESv2 PULSE_LIBS = $(shell $(PKG_CONFIG) --libs libpulse) MMAP_LIBS = -lc NEON_CFLAGS = -mfpu=neon NEON_ASFLAGS = -mfpu=neon NETWORKING_LIBS = -lc OBJDIR_BASE := obj-unix ifeq ($(DEBUG), 1) OBJDIR := $(OBJDIR_BASE)/debug DEF_FLAGS += -O0 -g -DDEBUG -D_DEBUG else OBJDIR := $(OBJDIR_BASE)/release DEF_FLAGS += -O2 -DNDEBUG endif include Makefile.common DEF_FLAGS += $(INCLUDE_DIRS) LDFLAGS += $(CFLAGS) $(CXXFLAGS) $(DEF_FLAGS) CFLAGS += $(DEF_FLAGS) CXXFLAGS += $(DEF_FLAGS) HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h) Q := @ RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ)) define APPINFO { "id": "$(PACKAGE_NAME)", "version": "$(PACKAGE_VERSION)", "vendor": "webosbrew.org", "title": "RetroArch", "icon": "icon160.png", "main": "retroarch", "iconColor": "#333333", "type": "native", "appDescription": "Emulation frontend" } endef export APPINFO all: $(TARGET) ipk -include $(RARCH_OBJ:.o=.d) SYMBOL_MAP := -Wl,-Map=output.map $(TARGET): $(RARCH_OBJ) @$(if $(Q), $(shell echo echo LD $@),) $(Q)$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS) $(OBJDIR)/%.o: %.c @mkdir -p $(dir $@) @$(if $(Q), $(shell echo echo CC $<),) $(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c -o $@ $< $(OBJDIR)/%.o: %.cpp @mkdir -p $(dir $@) @$(if $(Q), $(shell echo echo CXX $<),) $(Q)$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $< $(OBJDIR)/%.o: %.m @mkdir -p $(dir $@) @$(if $(Q), $(shell echo echo OBJC $<),) $(Q)$(CXX) $(OBJCFLAGS) $(DEFINES) -MMD -c -o $@ $< $(OBJDIR)/%.o: %.S $(HEADERS) @mkdir -p $(dir $@) @$(if $(Q), $(shell echo echo AS $<),) $(Q)$(CC) $(CFLAGS) $(ASFLAGS) $(DEFINES) -c -o $@ $< clean: rm -rf $(OBJDIR_BASE) rm -f $(TARGET) rm -f *.d rm -rf SDL rm -rf webos/*.ipk rm -rf webos/dist sdl2: $(TARGET) ifeq ($(ADD_SDL2_LIB), 1) @echo "Downloading SDL2 prebuilt" mkdir -p SDL wget -qO - $(SDL2_PREBUILT_ARCHIVE) | tar -C SDL -zxvf - endif ipk: $(TARGET) sdl2 rm -rf webos/dist mkdir -p webos/dist/lib echo "$$APPINFO" > webos/dist/appinfo.json cp -t webos/dist -vf $(TARGET) webos/icon160.png cp -t webos/dist/lib -vf $(WEBOS_LIB_DIR)/libstdc++.so.6 ifeq ($(ADD_SDL2_LIB), 1) cp -t webos/dist/lib -vf SDL/lib/libSDL2-2.0.so.0 endif $(STRIP) webos/dist/$(TARGET) cd webos && ares-package dist install: ipk ares-install webos/$(PACKAGE_NAME)_$(PACKAGE_VERSION)_$(ARCH).ipk launch: install ares-launch com.retroarch .PHONY: all clean ipk print-%: @echo '$*=$($*)'