2015-12-13 21:20:09 +01:00
|
|
|
STATIC_LINKING := 0
|
|
|
|
AR := ar
|
|
|
|
|
2012-05-05 13:49:41 +02: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
|
|
|
|
|
2015-08-22 21:03:28 +02:00
|
|
|
# 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
|
|
|
|
|
2013-05-16 13:28:43 +02:00
|
|
|
TARGET_NAME := test
|
2015-03-03 09:38:27 +01:00
|
|
|
LIBM = -lm
|
2013-05-16 13:28:43 +02:00
|
|
|
|
2015-11-01 17:48:37 +01:00
|
|
|
ifeq ($(ARCHFLAGS),)
|
2015-11-01 17:50:48 +01:00
|
|
|
ifeq ($(archs),ppc)
|
|
|
|
ARCHFLAGS = -arch ppc -arch ppc64
|
|
|
|
else
|
2015-11-01 17:48:37 +01:00
|
|
|
ARCHFLAGS = -arch i386 -arch x86_64
|
|
|
|
endif
|
2015-11-01 17:50:48 +01:00
|
|
|
endif
|
2015-11-01 17:48:37 +01:00
|
|
|
|
|
|
|
ifeq ($(platform), osx)
|
|
|
|
ifndef ($(NOUNIVERSAL))
|
|
|
|
CFLAGS += $(ARCHFLAGS)
|
|
|
|
LFLAGS += $(ARCHFLAGS)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2015-12-13 21:20:09 +01:00
|
|
|
ifeq ($(STATIC_LINKING), 1)
|
|
|
|
EXT := a
|
|
|
|
endif
|
|
|
|
|
2012-05-05 13:49:41 +02:00
|
|
|
ifeq ($(platform), unix)
|
2015-12-13 21:20:09 +01:00
|
|
|
EXT ?= so
|
|
|
|
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
2012-05-05 13:49:41 +02:00
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
2015-03-03 09:38:27 +01:00
|
|
|
else ifeq ($(platform), linux-portable)
|
2015-12-13 21:20:09 +01:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.$(EXT)
|
2015-03-03 09:38:27 +01:00
|
|
|
fpic := -fPIC -nostdlib
|
2015-03-05 23:51:14 +01:00
|
|
|
SHARED := -shared -Wl,--version-script=link.T
|
2015-03-03 09:38:27 +01:00
|
|
|
LIBM :=
|
2015-08-01 05:28:04 +02:00
|
|
|
else ifneq (,$(findstring osx,$(platform)))
|
2013-05-16 13:28:43 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.dylib
|
2012-05-05 13:49:41 +02:00
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib
|
2015-10-15 16:14:25 +02:00
|
|
|
else ifneq (,$(findstring ios,$(platform)))
|
2013-05-16 13:38:16 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_ios.dylib
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -dynamiclib
|
2015-10-15 16:14:25 +02:00
|
|
|
|
|
|
|
ifeq ($(IOSSDK),)
|
|
|
|
IOSSDK := $(shell xcodebuild -version -sdk iphoneos Path)
|
|
|
|
endif
|
|
|
|
|
2013-05-16 13:38:16 +02:00
|
|
|
DEFINES := -DIOS
|
2015-10-15 16:14:25 +02:00
|
|
|
CC = cc -arch armv7 -isysroot $(IOSSDK)
|
|
|
|
ifeq ($(platform),ios9)
|
|
|
|
CC += -miphoneos-version-min=8.0
|
|
|
|
CFLAGS += -miphoneos-version-min=8.0
|
|
|
|
else
|
|
|
|
CC += -miphoneos-version-min=5.0
|
|
|
|
CFLAGS += -miphoneos-version-min=5.0
|
|
|
|
endif
|
2015-07-30 03:31:48 +02:00
|
|
|
else ifneq (,$(findstring qnx,$(platform)))
|
2013-05-16 13:28:43 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_qnx.so
|
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
2015-08-22 21:03:28 +02:00
|
|
|
else ifeq ($(platform), emscripten)
|
2015-08-20 01:11:00 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro_emscripten.bc
|
2013-07-27 14:17:22 -04:00
|
|
|
fpic := -fPIC
|
|
|
|
SHARED := -shared -Wl,--version-script=link.T -Wl,--no-undefined
|
2015-08-30 19:15:06 +02:00
|
|
|
else ifeq ($(platform), vita)
|
2015-08-31 20:52:25 +02:00
|
|
|
TARGET := $(TARGET_NAME)_vita.a
|
2015-08-30 19:15:06 +02:00
|
|
|
CC = arm-vita-eabi-gcc
|
|
|
|
AR = arm-vita-eabi-ar
|
|
|
|
CFLAGS += -Wl,-q -Wall -O3
|
2015-08-31 20:52:25 +02:00
|
|
|
STATIC_LINKING = 1
|
2012-05-05 13:49:41 +02:00
|
|
|
else
|
|
|
|
CC = gcc
|
2014-07-30 17:08:33 +02:00
|
|
|
TARGET := $(TARGET_NAME)_libretro.dll
|
2012-05-05 13:49:41 +02:00
|
|
|
SHARED := -shared -static-libgcc -static-libstdc++ -s -Wl,--version-script=link.T -Wl,--no-undefined
|
|
|
|
endif
|
|
|
|
|
2015-03-03 09:38:27 +01:00
|
|
|
LDFLAGS += $(LIBM)
|
|
|
|
|
2012-05-05 13:49:41 +02:00
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -O0 -g
|
|
|
|
else
|
|
|
|
CFLAGS += -O3
|
|
|
|
endif
|
|
|
|
|
|
|
|
OBJECTS := libretro-test.o
|
2015-12-13 21:20:09 +01:00
|
|
|
CFLAGS += -I../../libretro-common/include -Wall -pedantic $(fpic)
|
2013-05-16 13:28:43 +02:00
|
|
|
|
2015-07-30 03:31:48 +02:00
|
|
|
ifneq (,$(findstring qnx,$(platform)))
|
|
|
|
CFLAGS += -Wc,-std=c99
|
2013-05-16 13:28:43 +02:00
|
|
|
else
|
|
|
|
CFLAGS += -std=gnu99
|
|
|
|
endif
|
2012-05-05 13:49:41 +02:00
|
|
|
|
2016-02-16 20:24:00 +01:00
|
|
|
CFLAGS += -I../../libretro-common/include
|
|
|
|
|
2012-05-05 13:49:41 +02:00
|
|
|
all: $(TARGET)
|
|
|
|
|
2015-08-30 19:15:06 +02:00
|
|
|
$(TARGET): $(OBJECTS)
|
2015-08-31 20:52:25 +02:00
|
|
|
ifeq ($(STATIC_LINKING), 1)
|
|
|
|
$(AR) rcs $@ $(OBJECTS)
|
2015-08-30 19:15:06 +02:00
|
|
|
else
|
2015-03-03 09:38:27 +01:00
|
|
|
$(CC) $(fpic) $(SHARED) $(INCLUDES) -o $@ $(OBJECTS) $(LDFLAGS)
|
2015-08-30 19:15:06 +02:00
|
|
|
endif
|
2012-05-05 13:49:41 +02:00
|
|
|
|
|
|
|
%.o: %.c
|
|
|
|
$(CC) $(CFLAGS) -c -o $@ $<
|
|
|
|
|
|
|
|
clean:
|
|
|
|
rm -f $(OBJECTS) $(TARGET)
|
|
|
|
|
|
|
|
.PHONY: clean
|
|
|
|
|