2018-02-14 18:19:48 +00:00
|
|
|
STATIC_LINKING := 0
|
2020-10-08 01:48:23 +00:00
|
|
|
AR ?= ar
|
|
|
|
CC ?= gcc
|
|
|
|
CXX ?= g++
|
|
|
|
|
|
|
|
CORE_DIR := .
|
2018-02-14 18:19:48 +00:00
|
|
|
|
|
|
|
ifeq ($(platform),)
|
|
|
|
platform = unix
|
|
|
|
ifeq ($(shell uname -a),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
|
|
platform = osx
|
|
|
|
else ifneq ($(findstring win,$(shell uname -a)),)
|
|
|
|
platform = win
|
|
|
|
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 := vemulator
|
|
|
|
LIBM = -lm
|
|
|
|
|
|
|
|
ifeq ($(ARCHFLAGS),)
|
|
|
|
ifeq ($(archs),ppc)
|
|
|
|
ARCHFLAGS = -arch ppc -arch ppc64
|
|
|
|
else
|
|
|
|
ARCHFLAGS = -arch i386 -arch x86_64
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(platform), osx)
|
|
|
|
ifndef ($(NOUNIVERSAL))
|
|
|
|
CFLAGS += $(ARCHFLAGS)
|
|
|
|
LFLAGS += $(ARCHFLAGS)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(STATIC_LINKING), 1)
|
|
|
|
EXT := a
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(platform), unix)
|
|
|
|
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
|
|
|
|
LIBM :=
|
|
|
|
else ifneq (,$(findstring osx,$(platform)))
|
|
|
|
TARGET := $(TARGET_NAME)_libretro.dylib
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib
|
|
|
|
else ifneq (,$(findstring ios,$(platform)))
|
|
|
|
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib
|
|
|
|
|
|
|
|
ifeq ($(IOSSDK),)
|
|
|
|
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
|
|
|
|
endif
|
|
|
|
|
|
|
|
DEFINES := -DIOS
|
|
|
|
CC = CC -arch armv7 -isysroot $(IOSSDK)
|
2020-10-08 01:48:23 +00:00
|
|
|
CXX = CXX -arch armv7 -isysroot $(IOSSDK)
|
2018-02-14 18:19:48 +00:00
|
|
|
ifeq ($(platform),ios9)
|
|
|
|
CC += -miphoneos-version-min=8.0
|
2020-10-08 01:48:23 +00:00
|
|
|
CXX += -miphoneos-version-min=8.0
|
2018-02-14 18:19:48 +00:00
|
|
|
CFLAGS += -miphoneos-version-min=8.0
|
|
|
|
else
|
|
|
|
CC += -miphoneos-version-min=5.0
|
2020-10-08 01:48:23 +00:00
|
|
|
CXX += -miphoneos-version-min=5.0
|
2018-02-14 18:19:48 +00:00
|
|
|
CFLAGS += -miphoneos-version-min=5.0
|
|
|
|
endif
|
|
|
|
else ifneq (,$(findstring qnx,$(platform)))
|
|
|
|
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
|
|
|
else ifeq ($(platform), emscripten)
|
|
|
|
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
|
|
|
else ifeq ($(platform), vita)
|
|
|
|
TARGET := $(TARGET_NAME)_vita.a
|
2020-10-08 01:48:23 +00:00
|
|
|
CC = arm-vita-eabi-gcc
|
|
|
|
CXX = arm-vita-eabi-g++
|
2018-02-14 18:19:48 +00:00
|
|
|
AR = arm-vita-eabi-ar
|
|
|
|
CFLAGS += -Wl,-q -Wall -O3
|
|
|
|
STATIC_LINKING = 1
|
|
|
|
else
|
2020-10-08 01:48:23 +00:00
|
|
|
CC ?= gcc
|
|
|
|
CXX ?= g++
|
2018-02-14 18:19:48 +00:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.dll
|
|
|
|
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
|
|
|
|
endif
|
|
|
|
|
|
|
|
LDFLAGS += $(LIBM)
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -O0 -g
|
|
|
|
else
|
|
|
|
CFLAGS += -O3
|
|
|
|
endif
|
|
|
|
|
2020-10-08 01:48:23 +00:00
|
|
|
include Makefile.common
|
|
|
|
|
|
|
|
OBJECTS := $(SOURCES_C:.c=.o) $(SOURCES_CXX:.cpp=.o)
|
2018-02-14 18:19:48 +00:00
|
|
|
CFLAGS += -Wall -pedantic $(fpic)
|
|
|
|
|
|
|
|
ifneq (,$(findstring qnx,$(platform)))
|
2018-02-16 18:04:18 +00:00
|
|
|
CFLAGS += -Wc,-std=c++98
|
2018-02-14 18:19:48 +00:00
|
|
|
else
|
2020-10-08 01:48:23 +00:00
|
|
|
CFLAGS += -std=gnu++98
|
2018-02-14 18:19:48 +00:00
|
|
|
endif
|
|
|
|
|
2020-10-08 01:48:23 +00:00
|
|
|
all: $(TARGET)
|
2018-02-14 18:19:48 +00:00
|
|
|
|
2020-10-08 01:48:23 +00:00
|
|
|
$(TARGET): $(OBJECTS)
|
2018-02-14 18:19:48 +00:00
|
|
|
ifeq ($(STATIC_LINKING), 1)
|
2020-10-08 01:48:23 +00:00
|
|
|
$(AR) rcs $@ $(OBJECTS)
|
2018-02-14 18:19:48 +00:00
|
|
|
else
|
2020-10-08 01:48:23 +00:00
|
|
|
$(CXX) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
|
2018-02-14 18:19:48 +00:00
|
|
|
endif
|
|
|
|
|
2020-10-08 01:48:23 +00:00
|
|
|
%.o: %.cpp
|
|
|
|
$(CXX) $(CFLAGS) $(fpic) -c -o $@ $<
|
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) $(fpic) -c -o $@ $<
|
|
|
|
|
2018-02-14 18:19:48 +00:00
|
|
|
clean:
|
2020-10-08 01:48:23 +00:00
|
|
|
rm -f *.so *.o
|
2018-02-14 18:19:48 +00:00
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|