Fix Makefile platform detection

Now works with buildroot.

Signed-off-by: Mahyar Koshkouei <mahyar.koshkouei@gmail.com>
This commit is contained in:
Mahyar Koshkouei 2018-01-09 14:44:20 +00:00
parent fd7fb797da
commit 7534a3d6e9
1 changed files with 25 additions and 15 deletions

View File

@ -4,15 +4,25 @@ DEBUG := 0
ifeq ($(platform),)
platform = unix
ifeq ($(shell uname -a),)
ifeq ($(shell uname -s),)
EXE_EXT = .exe
platform = win
else ifneq ($(findstring MINGW,$(shell uname -a)),)
else ifneq ($(findstring MINGW,$(shell uname -s)),)
platform = win
else ifneq ($(findstring Darwin,$(shell uname -a)),)
else ifneq ($(findstring Darwin,$(shell uname -s)),)
platform = osx
else ifneq ($(findstring win,$(shell uname -a)),)
ifeq ($(shell uname -p),powerpc)
arch = ppc
else
arch = intel
endif
else ifneq ($(findstring win,$(shell uname -s)),)
platform = win
endif
endif
else ifneq (,$(findstring armv,$(platform)))
override platform += unix
else ifneq (,$(findstring rpi3,$(platform)))
override platform += unix
endif
TARGET_NAME := mpv
@ -36,15 +46,11 @@ ifeq ($(STATIC_LINKING), 1)
EXT := a
endif
ifeq ($(platform), unix)
ifneq (,$(findstring unix,$(platform)))
EXT ?= so
TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
else ifeq ($(platform), linux-portable)
TARGET := $(TARGET_NAME)_libretro.$(EXT)
fpic := -fPIC -nostdlib
SHARED := -shared -Wl,--version-script=link.T
else ifneq (,$(findstring osx,$(platform)))
TARGET := $(TARGET_NAME)_libretro.dylib
fpic := -fPIC
@ -95,6 +101,10 @@ OBJECTS := mpv-libretro.o
LDFLAGS += -lmpv
CFLAGS += -Wall -pedantic $(fpic)
ifneq (,$(findstring gles,$(platform)))
CFLAGS += -DHAVE_OPENGLES
endif
ifneq (,$(findstring qnx,$(platform)))
CFLAGS += -Wc,-std=c99
else