Cleanup Makefile
Additionally strip the output object file. Signed-off-by: Mahyar Koshkouei <mahyar.koshkouei@gmail.com>
This commit is contained in:
parent
052a95b7bf
commit
0d92199936
100
Makefile
100
Makefile
|
@ -1,80 +1,63 @@
|
||||||
STATIC_LINKING := 0
|
STATIC_LINKING := 0
|
||||||
AR := ar
|
AR := ar
|
||||||
DEBUG := 1
|
DEBUG := 0
|
||||||
|
|
||||||
ifeq ($(platform),)
|
ifeq ($(platform),)
|
||||||
platform = unix
|
platform = unix
|
||||||
ifeq ($(shell uname -a),)
|
ifeq ($(shell uname -a),)
|
||||||
platform = win
|
platform = win
|
||||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
||||||
platform = win
|
platform = win
|
||||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
||||||
platform = osx
|
platform = osx
|
||||||
else ifneq ($(findstring win,$(shell uname -a)),)
|
else ifneq ($(findstring win,$(shell uname -a)),)
|
||||||
platform = win
|
platform = win
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# system platform
|
|
||||||
system_platform = unix
|
|
||||||
ifeq ($(shell uname -a),)
|
|
||||||
EXE_EXT = .exe
|
|
||||||
system_platform = win
|
|
||||||
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
||||||
system_platform = osx
|
|
||||||
arch = intel
|
|
||||||
ifeq ($(shell uname -p),powerpc)
|
|
||||||
arch = ppc
|
|
||||||
endif
|
|
||||||
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
||||||
system_platform = win
|
|
||||||
endif
|
|
||||||
|
|
||||||
TARGET_NAME := mpv
|
TARGET_NAME := mpv
|
||||||
LIBM = -lm
|
LIBM = -lm
|
||||||
|
|
||||||
ifeq ($(ARCHFLAGS),)
|
ifeq ($(ARCHFLAGS),)
|
||||||
ifeq ($(archs),ppc)
|
ifeq ($(archs),ppc)
|
||||||
ARCHFLAGS = -arch ppc -arch ppc64
|
ARCHFLAGS = -arch ppc -arch ppc64
|
||||||
else
|
else
|
||||||
ARCHFLAGS = -arch i386 -arch x86_64
|
ARCHFLAGS = -arch i386 -arch x86_64
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(platform), osx)
|
ifeq ($(platform), osx)
|
||||||
ifndef ($(NOUNIVERSAL))
|
ifndef ($(NOUNIVERSAL))
|
||||||
CFLAGS += $(ARCHFLAGS)
|
CFLAGS += $(ARCHFLAGS)
|
||||||
LFLAGS += $(ARCHFLAGS)
|
LFLAGS += $(ARCHFLAGS)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(STATIC_LINKING), 1)
|
ifeq ($(STATIC_LINKING), 1)
|
||||||
EXT := a
|
EXT := a
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(platform), unix)
|
ifeq ($(platform), unix)
|
||||||
EXT ?= so
|
EXT ?= so
|
||||||
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
||||||
fpic := -fPIC
|
fpic := -fPIC
|
||||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||||
else ifeq ($(platform), linux-portable)
|
else ifeq ($(platform), linux-portable)
|
||||||
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
||||||
fpic := -fPIC -nostdlib
|
fpic := -fPIC -nostdlib
|
||||||
SHARED := -shared -Wl,--version-script=link.T
|
SHARED := -shared -Wl,--version-script=link.T
|
||||||
LIBM :=
|
LIBM :=
|
||||||
else ifneq (,$(findstring osx,$(platform)))
|
else ifneq (,$(findstring osx,$(platform)))
|
||||||
TARGET := $(TARGET_NAME)_libretro.dylib
|
TARGET := $(TARGET_NAME)_libretro.dylib
|
||||||
fpic := -fPIC
|
fpic := -fPIC
|
||||||
SHARED := -dynamiclib
|
SHARED := -dynamiclib
|
||||||
else ifneq (,$(findstring ios,$(platform)))
|
else ifneq (,$(findstring ios,$(platform)))
|
||||||
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
||||||
fpic := -fPIC
|
fpic := -fPIC
|
||||||
SHARED := -dynamiclib
|
SHARED := -dynamiclib
|
||||||
|
|
||||||
ifeq ($(IOSSDK),)
|
ifeq ($(IOSSDK),)
|
||||||
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
|
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
DEFINES := -DIOS
|
DEFINES := -DIOS
|
||||||
CC = cc -arch armv7 -isysroot $(IOSSDK)
|
CC = cc -arch armv7 -isysroot $(IOSSDK)
|
||||||
ifeq ($(platform),ios9)
|
ifeq ($(platform),ios9)
|
||||||
|
@ -83,38 +66,37 @@ CFLAGS += -miphoneos-version-min=8.0
|
||||||
else
|
else
|
||||||
CC += -miphoneos-version-min=5.0
|
CC += -miphoneos-version-min=5.0
|
||||||
CFLAGS += -miphoneos-version-min=5.0
|
CFLAGS += -miphoneos-version-min=5.0
|
||||||
endif
|
endif #ifneq ios
|
||||||
else ifneq (,$(findstring qnx,$(platform)))
|
else ifneq (,$(findstring qnx,$(platform)))
|
||||||
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
||||||
fpic := -fPIC
|
fpic := -fPIC
|
||||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||||
else ifeq ($(platform), emscripten)
|
else ifeq ($(platform), emscripten)
|
||||||
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
||||||
fpic := -fPIC
|
fpic := -fPIC
|
||||||
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
||||||
else ifeq ($(platform), vita)
|
else ifeq ($(platform), vita)
|
||||||
TARGET := $(TARGET_NAME)_vita.a
|
TARGET := $(TARGET_NAME)_vita.a
|
||||||
CC = arm-vita-eabi-gcc
|
CC = arm-vita-eabi-gcc
|
||||||
AR = arm-vita-eabi-ar
|
AR = arm-vita-eabi-ar
|
||||||
CFLAGS += -Wl,-q -Wall -O3
|
CFLAGS += -Wl,-q -Wall -O3
|
||||||
STATIC_LINKING = 1
|
STATIC_LINKING = 1
|
||||||
else
|
else
|
||||||
CC = gcc
|
CC = gcc
|
||||||
TARGET := $(TARGET_NAME)_libretro.dll
|
TARGET := $(TARGET_NAME)_libretro.dll
|
||||||
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
|
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LDFLAGS += $(LIBM) -lmpv
|
LDFLAGS += $(LIBM) -lmpv
|
||||||
LIBRETRO-COM = -Ilibretro-common/include
|
|
||||||
|
|
||||||
ifeq ($(DEBUG), 1)
|
ifeq ($(DEBUG), 1)
|
||||||
CFLAGS += -O0 -g
|
CFLAGS += -O0 -g
|
||||||
else
|
else
|
||||||
CFLAGS += -O3
|
CFLAGS += -Ofast -s
|
||||||
endif
|
endif
|
||||||
|
|
||||||
OBJECTS := mpv-libretro.o
|
OBJECTS := mpv-libretro.o
|
||||||
CFLAGS += -Wall -pedantic $(LIBRETRO-COM) $(fpic)
|
CFLAGS += -Wall -pedantic $(fpic)
|
||||||
|
|
||||||
ifneq (,$(findstring qnx,$(platform)))
|
ifneq (,$(findstring qnx,$(platform)))
|
||||||
CFLAGS += -Wc,-std=c99
|
CFLAGS += -Wc,-std=c99
|
||||||
|
@ -128,7 +110,7 @@ $(TARGET): $(OBJECTS)
|
||||||
ifeq ($(STATIC_LINKING), 1)
|
ifeq ($(STATIC_LINKING), 1)
|
||||||
$(AR) rcs $@ $(OBJECTS)
|
$(AR) rcs $@ $(OBJECTS)
|
||||||
else
|
else
|
||||||
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
|
$(CC) $(fpic) $(SHARED) $(CFLAGS) -o $@ $(OBJECTS) $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
|
|
Loading…
Reference in New Issue