2015-05-02 00:12:29 +00:00
|
|
|
local template = [[
|
|
|
|
##############
|
2015-08-02 22:58:37 +00:00
|
|
|
# Works on hosts ${HOST}
|
2015-05-02 00:12:29 +00:00
|
|
|
# ${HEADERMSG}
|
|
|
|
|
|
|
|
#############
|
|
|
|
# User config
|
|
|
|
|
|
|
|
DEBUG = 0
|
|
|
|
LOG_PERFORMANCE = 1
|
|
|
|
|
2015-08-02 22:58:37 +00:00
|
|
|
##########################
|
|
|
|
# Checks the host platform
|
|
|
|
|
|
|
|
HOST_PLATFORM = linux
|
|
|
|
ifeq ($(shell uname -a),)
|
|
|
|
HOST_PLATFORM = windows
|
|
|
|
else ifneq ($(findstring MINGW,$(shell uname -a)),)
|
|
|
|
HOST_PLATFORM = windows
|
|
|
|
else ifneq ($(findstring Darwin,$(shell uname -a)),)
|
|
|
|
HOST_PLATFORM = darwin
|
|
|
|
else ifneq ($(findstring win,$(shell uname -a)),)
|
|
|
|
HOST_PLATFORM = windows
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2015-05-02 00:12:29 +00:00
|
|
|
####################################
|
|
|
|
# Variable setup for Makefile.common
|
|
|
|
|
2015-08-02 22:58:37 +00:00
|
|
|
CORE_DIR ?= ..
|
|
|
|
BUILD_DIR ?= .
|
|
|
|
INCLUDES = ${PLAT_INCDIR}
|
2015-05-02 00:12:29 +00:00
|
|
|
|
2015-08-02 22:58:37 +00:00
|
|
|
include $(BUILD_DIR)/Makefile.common
|
2015-05-02 00:12:29 +00:00
|
|
|
|
|
|
|
#################
|
|
|
|
# Toolchain setup
|
|
|
|
|
|
|
|
CC = ${CC}
|
|
|
|
CXX = ${CXX}
|
|
|
|
AS = ${AS}
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = ${AR}
|
2015-05-02 00:12:29 +00:00
|
|
|
|
|
|
|
############
|
|
|
|
# Extensions
|
|
|
|
|
2015-07-26 03:37:14 +00:00
|
|
|
OBJEXT = .${EXT}.o
|
|
|
|
SOEXT = .${EXT}.${SO}
|
2015-05-02 00:12:29 +00:00
|
|
|
|
|
|
|
################
|
|
|
|
# Platform setup
|
|
|
|
|
2015-07-26 03:03:35 +00:00
|
|
|
STATIC_LINKING = ${STATIC_LINKING}
|
2015-08-01 19:57:03 +00:00
|
|
|
platform = ${PLATFORM}
|
2015-07-26 03:03:35 +00:00
|
|
|
PLATDEFS = ${PLAT_DEFS}
|
|
|
|
PLATCFLAGS = ${PLAT_CFLAGS}
|
|
|
|
PLATCXXFLAGS = ${PLAT_CXXFLAGS}
|
|
|
|
PLATLDFLAGS = ${PLAT_LDFLAGS}
|
2015-08-01 19:57:03 +00:00
|
|
|
PLATLDXFLAGS = ${PLAT_LDXFLAGS}
|
2015-05-02 00:12:29 +00:00
|
|
|
|
|
|
|
################
|
|
|
|
# libretro setup
|
|
|
|
|
|
|
|
RETRODEFS = -D__LIBRETRO__
|
|
|
|
RETROCFLAGS =
|
|
|
|
RETROCXXFLAGS =
|
|
|
|
RETROLDFLAGS =
|
2015-08-01 19:57:03 +00:00
|
|
|
RETROLDXFLAGS =
|
2015-05-02 00:12:29 +00:00
|
|
|
|
|
|
|
#################
|
|
|
|
# Final variables
|
|
|
|
|
|
|
|
DEFINES = $(PLATDEFS) $(RETRODEFS)
|
|
|
|
CFLAGS = $(PLATCFLAGS) $(RETROCFLAGS) $(DEFINES) $(INCLUDES)
|
|
|
|
CXXFLAGS = $(PLATCXXFLAGS) $(RETROCXXFLAGS) $(DEFINES) $(INCLUDES)
|
|
|
|
LDFLAGS = $(PLATLDFLAGS) $(RETROLDFLAGS)
|
2015-08-01 19:57:03 +00:00
|
|
|
LDXFLAGS = $(PLATLDXFLAGS) $(RETROLDXFLAGS)
|
2015-05-02 00:12:29 +00:00
|
|
|
|
|
|
|
########
|
|
|
|
# Tuning
|
|
|
|
|
|
|
|
ifeq ($(DEBUG), 1)
|
|
|
|
CFLAGS += -O0 -g
|
|
|
|
CXXFLAGS += -O0 -g
|
|
|
|
LDFLAGS += -g
|
2015-08-01 19:57:03 +00:00
|
|
|
LDXFLAGS += -g
|
2015-05-02 00:12:29 +00:00
|
|
|
else
|
|
|
|
CFLAGS += -O3 -DNDEBUG
|
|
|
|
CXXFLAGS += -O3 -DNDEBUG
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(LOG_PERFORMANCE), 1)
|
|
|
|
CFLAGS += -DLOG_PERFORMANCE
|
|
|
|
CXXFLAGS += -DLOG_PERFORMANCE
|
|
|
|
endif
|
|
|
|
|
|
|
|
###############
|
|
|
|
# Include rules
|
|
|
|
|
2015-08-02 22:58:37 +00:00
|
|
|
include $(BUILD_DIR)/Makefile.rules
|
2015-05-02 00:12:29 +00:00
|
|
|
]]
|
|
|
|
|
2015-08-02 22:58:37 +00:00
|
|
|
--local host = 'linux-x86_64'
|
|
|
|
--local host = 'darwin-x86_64'
|
2015-05-02 00:12:29 +00:00
|
|
|
--local host = 'windows-x86_64'
|
2015-08-02 22:58:37 +00:00
|
|
|
local host = '$(HOST_PLATFORM)-x86_64'
|
2015-05-02 00:12:29 +00:00
|
|
|
|
|
|
|
local platforms = {
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
android_arm64_v8a = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.android-arm64_v8a',
|
|
|
|
HOST = 'Linux, Windows and Darwin',
|
|
|
|
HEADERMSG = 'Download the Android NDK, unpack somewhere, and set NDK_ROOT_DIR to it',
|
2015-05-02 00:12:29 +00:00
|
|
|
CC = '$(NDK_ROOT_DIR)/toolchains/aarch64-linux-android-4.9/prebuilt/' .. host .. '/bin/aarch64-linux-android-gcc',
|
|
|
|
CXX = '$(NDK_ROOT_DIR)/toolchains/aarch64-linux-android-4.9/prebuilt/' .. host .. '/bin/aarch64-linux-android-g++',
|
|
|
|
AS = '$(NDK_ROOT_DIR)/toolchains/aarch64-linux-android-4.9/prebuilt/' .. host .. '/bin/aarch64-linux-android-as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = '$(NDK_ROOT_DIR)/toolchains/aarch64-linux-android-4.9/prebuilt/' .. host .. '/bin/aarch64-linux-android-ar',
|
2015-05-02 00:12:29 +00:00
|
|
|
EXT = 'android_arm64_v8a',
|
|
|
|
SO = 'so',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'android',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_INCDIR = '-I$(NDK_ROOT_DIR)/platforms/android-21/arch-arm64/usr/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward',
|
2015-05-02 02:24:47 +00:00
|
|
|
PLAT_DEFS = '-DANDROID -DINLINE=inline -DHAVE_STDINT_H -DBSPF_UNIX -DHAVE_INTTYPES -DLSB_FIRST',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_CFLAGS = '-fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -Wa,--noexecstack -Wformat -Werror=format-security',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS} -fno-exceptions -fno-rtti',
|
|
|
|
PLAT_LDFLAGS = '-shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-21/arch-arm64 -lgcc -no-canonical-prefixes -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -lc -lm',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS} $(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/libs/arm64-v8a/libgnustl_static.a',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
android_x86_64 = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.android-x86_64',
|
|
|
|
HOST = 'Linux, Windows and Darwin',
|
|
|
|
HEADERMSG = 'Download the Android NDK, unpack somewhere, and set NDK_ROOT_DIR to it',
|
2015-05-02 00:12:29 +00:00
|
|
|
CC = '$(NDK_ROOT_DIR)/toolchains/x86_64-4.9/prebuilt/' .. host .. '/bin/x86_64-linux-android-gcc',
|
|
|
|
CXX = '$(NDK_ROOT_DIR)/toolchains/x86_64-4.9/prebuilt/' .. host .. '/bin/x86_64-linux-android-g++',
|
|
|
|
AS = '$(NDK_ROOT_DIR)/toolchains/x86_64-4.9/prebuilt/' .. host .. '/bin/x86_64-linux-android-as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = '$(NDK_ROOT_DIR)/toolchains/x86_64-4.9/prebuilt/' .. host .. '/bin/x86_64-linux-android-ar',
|
2015-05-02 00:12:29 +00:00
|
|
|
EXT = 'android_x86_64',
|
|
|
|
SO = 'so',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'android',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_INCDIR = '-I$(NDK_ROOT_DIR)/platforms/android-21/arch-x86_64/usr/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward',
|
2015-05-02 02:24:47 +00:00
|
|
|
PLAT_DEFS = '-DANDROID -DINLINE=inline -DHAVE_STDINT_H -DBSPF_UNIX -DHAVE_INTTYPES -DLSB_FIRST',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_CFLAGS = '-ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -Wa,--noexecstack -Wformat -Werror=format-security',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS} -fno-exceptions -fno-rtti',
|
|
|
|
PLAT_LDFLAGS = '-shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-21/arch-x86_64 -lgcc -no-canonical-prefixes -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -lc -lm',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS} $(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86_64/libgnustl_static.a',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
android_mips64 = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.android-mips64',
|
|
|
|
HOST = 'Linux, Windows and Darwin',
|
|
|
|
HEADERMSG = 'Download the Android NDK, unpack somewhere, and set NDK_ROOT_DIR to it',
|
2015-05-02 00:12:29 +00:00
|
|
|
CC = '$(NDK_ROOT_DIR)/toolchains/mips64el-linux-android-4.9/prebuilt/' .. host .. '/bin/mips64el-linux-android-gcc',
|
|
|
|
CXX = '$(NDK_ROOT_DIR)/toolchains/mips64el-linux-android-4.9/prebuilt/' .. host .. '/bin/mips64el-linux-android-g++',
|
|
|
|
AS = '$(NDK_ROOT_DIR)/toolchains/mips64el-linux-android-4.9/prebuilt/' .. host .. '/bin/mips64el-linux-android-as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = '$(NDK_ROOT_DIR)/toolchains/mips64el-linux-android-4.9/prebuilt/' .. host .. '/bin/mips64el-linux-android-ar',
|
2015-05-02 00:12:29 +00:00
|
|
|
EXT = 'android_mips64',
|
|
|
|
SO = 'so',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'android',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_INCDIR = '-I$(NDK_ROOT_DIR)/platforms/android-21/arch-mips64/usr/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips64/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward',
|
2015-05-02 02:24:47 +00:00
|
|
|
PLAT_DEFS = '-DANDROID -DINLINE=inline -DHAVE_STDINT_H -DBSPF_UNIX -DHAVE_INTTYPES -DLSB_FIRST',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_CFLAGS = '-fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -no-canonical-prefixes -fomit-frame-pointer -funswitch-loops -finline-limit=300 -Wa,--noexecstack -Wformat -Werror=format-security',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS} -fno-exceptions -fno-rtti',
|
|
|
|
PLAT_LDFLAGS = '-shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-21/arch-mips64 -lgcc -no-canonical-prefixes -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -lc -lm',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS} $(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips64/libgnustl_static.a',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
android_arm_v7a = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.android-armeabi_v7a',
|
|
|
|
HOST = 'Linux, Windows and Darwin',
|
|
|
|
HEADERMSG = 'Download the Android NDK, unpack somewhere, and set NDK_ROOT_DIR to it',
|
2015-05-02 00:12:29 +00:00
|
|
|
CC = '$(NDK_ROOT_DIR)/toolchains/arm-linux-androideabi-4.8/prebuilt/' .. host .. '/bin/arm-linux-androideabi-gcc',
|
|
|
|
CXX = '$(NDK_ROOT_DIR)/toolchains/arm-linux-androideabi-4.8/prebuilt/' .. host .. '/bin/arm-linux-androideabi-g++',
|
|
|
|
AS = '$(NDK_ROOT_DIR)/toolchains/arm-linux-androideabi-4.8/prebuilt/' .. host .. '/bin/arm-linux-androideabi-as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = '$(NDK_ROOT_DIR)/toolchains/arm-linux-androideabi-4.8/prebuilt/' .. host .. '/bin/arm-linux-androideabi-ar',
|
2015-06-18 02:10:39 +00:00
|
|
|
EXT = 'armeabi-v7a',
|
2015-05-02 00:12:29 +00:00
|
|
|
SO = 'so',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'android',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_INCDIR = '-I$(NDK_ROOT_DIR)/platforms/android-3/arch-arm/usr/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/include/backward',
|
2015-05-02 02:24:47 +00:00
|
|
|
PLAT_DEFS = '-DANDROID -DINLINE=inline -DHAVE_STDINT_H -DBSPF_UNIX -DHAVE_INTTYPES -DLSB_FIRST',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_CFLAGS = '-fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -Wa,--noexecstack -Wformat -Werror=format-security',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS} -fno-exceptions -fno-rtti',
|
|
|
|
PLAT_LDFLAGS = '-shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-3/arch-arm -lgcc -no-canonical-prefixes -march=armv7-a -Wl,--fix-cortex-a8 -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -lc -lm',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS} $(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/thumb/libgnustl_static.a',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
android_arm_v5te = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.android-armeabi',
|
|
|
|
HOST = 'Linux, Windows and Darwin',
|
|
|
|
HEADERMSG = 'Download the Android NDK, unpack somewhere, and set NDK_ROOT_DIR to it',
|
2015-05-02 00:12:29 +00:00
|
|
|
CC = '$(NDK_ROOT_DIR)/toolchains/arm-linux-androideabi-4.8/prebuilt/' .. host .. '/bin/arm-linux-androideabi-gcc',
|
|
|
|
CXX = '$(NDK_ROOT_DIR)/toolchains/arm-linux-androideabi-4.8/prebuilt/' .. host .. '/bin/arm-linux-androideabi-g++',
|
|
|
|
AS = '$(NDK_ROOT_DIR)/toolchains/arm-linux-androideabi-4.8/prebuilt/' .. host .. '/bin/arm-linux-androideabi-as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = '$(NDK_ROOT_DIR)/toolchains/arm-linux-androideabi-4.8/prebuilt/' .. host .. '/bin/arm-linux-androideabi-ar',
|
2015-06-18 02:10:39 +00:00
|
|
|
EXT = 'armeabi',
|
2015-05-02 00:12:29 +00:00
|
|
|
SO = 'so',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'android',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_INCDIR = '-I$(NDK_ROOT_DIR)/platforms/android-3/arch-arm/usr/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/include/backward',
|
2015-05-02 02:24:47 +00:00
|
|
|
PLAT_DEFS = '-DANDROID -DINLINE=inline -DHAVE_STDINT_H -DBSPF_UNIX -DHAVE_INTTYPES -DLSB_FIRST',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_CFLAGS = '-fpic -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -march=armv5te -mtune=xscale -msoft-float -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -Wa,--noexecstack -Wformat -Werror=format-security',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS} -fno-exceptions -fno-rtti',
|
|
|
|
PLAT_LDFLAGS = '-shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-3/arch-arm -lgcc -no-canonical-prefixes -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -lc -lm',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS} $(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi/thumb/libgnustl_static.a',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
android_x86 = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.android-x86',
|
|
|
|
HOST = 'Linux, Windows and Darwin',
|
|
|
|
HEADERMSG = 'Download the Android NDK, unpack somewhere, and set NDK_ROOT_DIR to it',
|
2015-05-02 00:12:29 +00:00
|
|
|
CC = '$(NDK_ROOT_DIR)/toolchains/x86-4.8/prebuilt/' .. host .. '/bin/i686-linux-android-gcc',
|
|
|
|
CXX = '$(NDK_ROOT_DIR)/toolchains/x86-4.8/prebuilt/' .. host .. '/bin/i686-linux-android-g++',
|
|
|
|
AS = '$(NDK_ROOT_DIR)/toolchains/x86-4.8/prebuilt/' .. host .. '/bin/i686-linux-android-as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = '$(NDK_ROOT_DIR)/toolchains/x86-4.8/prebuilt/' .. host .. '/bin/i686-linux-android-ar',
|
2015-06-18 02:10:39 +00:00
|
|
|
EXT = 'x86',
|
2015-05-02 00:12:29 +00:00
|
|
|
SO = 'so',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'android',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_INCDIR = '-I$(NDK_ROOT_DIR)/platforms/android-9/arch-x86/usr/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/include $(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/include/backward',
|
2015-05-02 02:24:47 +00:00
|
|
|
PLAT_DEFS = '-DANDROID -DINLINE=inline -DHAVE_STDINT_H -DBSPF_UNIX -DHAVE_INTTYPES -DLSB_FIRST',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_CFLAGS = '-ffunction-sections -funwind-tables -no-canonical-prefixes -fstack-protector -fomit-frame-pointer -fstrict-aliasing -funswitch-loops -finline-limit=300 -Wa,--noexecstack -Wformat -Werror=format-security',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS} -fno-exceptions -fno-rtti',
|
|
|
|
PLAT_LDFLAGS = '-shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-9/arch-x86 -lgcc -no-canonical-prefixes -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -lc -lm',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS} $(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/libs/x86/libgnustl_static.a',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
android_mips = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.android-mips',
|
|
|
|
HOST = 'Linux, Windows and Darwin',
|
|
|
|
HEADERMSG = 'Download the Android NDK, unpack somewhere, and set NDK_ROOT_DIR to it',
|
2015-05-02 00:12:29 +00:00
|
|
|
CC = '$(NDK_ROOT_DIR)/toolchains/mipsel-linux-android-4.8/prebuilt/' .. host .. '/bin/mipsel-linux-android-gcc',
|
|
|
|
CXX = '$(NDK_ROOT_DIR)/toolchains/mipsel-linux-android-4.8/prebuilt/' .. host .. '/bin/mipsel-linux-android-g++',
|
|
|
|
AS = '$(NDK_ROOT_DIR)/toolchains/mipsel-linux-android-4.8/prebuilt/' .. host .. '/bin/mipsel-linux-android-as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = '$(NDK_ROOT_DIR)/toolchains/mipsel-linux-android-4.8/prebuilt/' .. host .. '/bin/mipsel-linux-android-ar',
|
2015-05-02 00:12:29 +00:00
|
|
|
EXT = 'android_mips',
|
|
|
|
SO = 'so',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'android',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_INCDIR = '-I$(NDK_ROOT_DIR)/platforms/android-9/arch-mips/usr/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/include -I$(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/include/backward',
|
2015-05-02 02:24:47 +00:00
|
|
|
PLAT_DEFS = '-DANDROID -DINLINE=inline -DHAVE_STDINT_H -DBSPF_UNIX -DHAVE_INTTYPES -DLSB_FIRST',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_CFLAGS = '-fpic -fno-strict-aliasing -finline-functions -ffunction-sections -funwind-tables -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers -no-canonical-prefixes -fomit-frame-pointer -funswitch-loops -finline-limit=300 -Wa,--noexecstack -Wformat -Werror=format-security',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS} -fno-exceptions -fno-rtti',
|
|
|
|
PLAT_LDFLAGS = '-shared --sysroot=$(NDK_ROOT_DIR)/platforms/android-9/arch-mips -lgcc -no-canonical-prefixes -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,relro -Wl,-z,now -lc -lm',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS} $(NDK_ROOT_DIR)/sources/cxx-stl/gnu-libstdc++/4.8/libs/mips/libgnustl_static.a',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
linux_x86 = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.linux-x86',
|
|
|
|
HOST = 'Linux',
|
2015-05-02 00:12:29 +00:00
|
|
|
HEADERMSG = 'apt-get install g++-multilib libc6-dev-i386',
|
|
|
|
CC = 'gcc',
|
|
|
|
CXX = 'g++',
|
|
|
|
AS = 'as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = 'ar',
|
2015-05-02 00:12:29 +00:00
|
|
|
EXT = 'linux_x86',
|
|
|
|
SO = 'so',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'unix',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_INCDIR = '',
|
|
|
|
PLAT_DEFS = '',
|
|
|
|
PLAT_CFLAGS = '-m32 -fpic -fstrict-aliasing',
|
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS}',
|
2015-08-02 22:58:37 +00:00
|
|
|
PLAT_LDFLAGS = '-m32 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T -Wl,-no-undefined',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS}',
|
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
linux_portable_x86 = {
|
|
|
|
MAKEFILE = 'Makefile.linux_portable-x86',
|
|
|
|
HOST = 'Linux',
|
|
|
|
HEADERMSG = 'apt-get install g++-multilib libc6-dev-i386',
|
|
|
|
CC = 'gcc',
|
|
|
|
CXX = 'g++',
|
|
|
|
AS = 'as',
|
|
|
|
AR = 'ar',
|
|
|
|
EXT = 'linux_x86',
|
|
|
|
SO = 'so',
|
|
|
|
PLATFORM = 'unix',
|
|
|
|
PLAT_INCDIR = '',
|
|
|
|
PLAT_DEFS = '',
|
|
|
|
PLAT_CFLAGS = '-m32 -fpic -fstrict-aliasing',
|
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS}',
|
|
|
|
PLAT_LDFLAGS = '-m32 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS}',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
linux_x86_64 = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.linux-x86_64',
|
|
|
|
HOST = 'Linux',
|
2015-05-02 00:12:29 +00:00
|
|
|
HEADERMSG = '',
|
|
|
|
CC = 'gcc',
|
|
|
|
CXX = 'g++',
|
|
|
|
AS = 'as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = 'ar',
|
2015-05-02 00:12:29 +00:00
|
|
|
EXT = 'linux_x86_64',
|
|
|
|
SO = 'so',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'unix',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_INCDIR = '',
|
|
|
|
PLAT_DEFS = '',
|
|
|
|
PLAT_CFLAGS = '-m64 -fpic -fstrict-aliasing',
|
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS}',
|
2015-08-02 22:58:37 +00:00
|
|
|
PLAT_LDFLAGS = '-m64 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T -Wl,-no-undefined',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS}',
|
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
linux_portable_x86_64 = {
|
|
|
|
MAKEFILE = 'Makefile.linux_portable-x86_64',
|
|
|
|
HOST = 'Linux',
|
|
|
|
HEADERMSG = '',
|
|
|
|
CC = 'gcc',
|
|
|
|
CXX = 'g++',
|
|
|
|
AS = 'as',
|
|
|
|
AR = 'ar',
|
|
|
|
EXT = 'linux_x86_64',
|
|
|
|
SO = 'so',
|
|
|
|
PLATFORM = 'unix',
|
|
|
|
PLAT_INCDIR = '',
|
|
|
|
PLAT_DEFS = '',
|
|
|
|
PLAT_CFLAGS = '-m64 -fpic -fstrict-aliasing',
|
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS}',
|
|
|
|
PLAT_LDFLAGS = '-m64 -shared -lm -Wl,-version-script=$(BUILD_DIR)/link.T',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS}',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
windows_x86 = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.windows-x86',
|
|
|
|
HOST = 'Linux',
|
2015-05-02 00:12:29 +00:00
|
|
|
HEADERMSG = 'apt-get install mingw-w64',
|
|
|
|
CC = 'i686-w64-mingw32-gcc',
|
|
|
|
CXX = 'i686-w64-mingw32-g++',
|
|
|
|
AS = 'i686-w64-mingw32-as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = 'i686-w64-mingw32-ar',
|
2015-05-02 00:12:29 +00:00
|
|
|
EXT = 'windows_x86',
|
|
|
|
SO = 'dll',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'win',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_INCDIR = '',
|
|
|
|
PLAT_DEFS = '',
|
|
|
|
PLAT_CFLAGS = '-fstrict-aliasing',
|
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS}',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_LDFLAGS = '-shared -lm',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS}',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
windows_x86_64 = {
|
2015-08-02 22:58:37 +00:00
|
|
|
MAKEFILE = 'Makefile.windows-x86_64',
|
|
|
|
HOST = 'Linux',
|
2015-05-02 00:12:29 +00:00
|
|
|
HEADERMSG = 'apt-get install mingw-w64',
|
|
|
|
CC = 'x86_64-w64-mingw32-gcc',
|
|
|
|
CXX = 'x86_64-w64-mingw32-g++',
|
|
|
|
AS = 'x86_64-w64-mingw32-as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = 'x86_64-w64-mingw32-ar',
|
2015-05-02 00:12:29 +00:00
|
|
|
EXT = 'windows_x86_64',
|
|
|
|
SO = 'dll',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'win',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_INCDIR = '',
|
|
|
|
PLAT_DEFS = '',
|
|
|
|
PLAT_CFLAGS = '-fpic -fstrict-aliasing',
|
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS}',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_LDFLAGS = '-shared -lm',
|
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS}',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
mingw32 = {
|
2015-06-17 05:21:14 +00:00
|
|
|
MAKEFILE = 'Makefile.mingw32',
|
2015-08-02 22:58:37 +00:00
|
|
|
HOST = 'Windows',
|
2015-07-26 01:59:07 +00:00
|
|
|
HEADERMSG = 'Install MSYS2',
|
2015-05-02 00:12:29 +00:00
|
|
|
CC = 'gcc',
|
|
|
|
CXX = 'g++',
|
|
|
|
AS = 'as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = 'ar',
|
2015-05-02 00:12:29 +00:00
|
|
|
EXT = 'mingw32',
|
|
|
|
SO = 'dll',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'win',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_INCDIR = '',
|
|
|
|
PLAT_DEFS = '',
|
|
|
|
PLAT_CFLAGS = '-m32 -fpic -fstrict-aliasing',
|
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS}',
|
2015-08-02 22:58:37 +00:00
|
|
|
PLAT_LDFLAGS = '-m32 -shared -lm',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS}',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
mingw64 = {
|
2015-06-17 05:21:14 +00:00
|
|
|
MAKEFILE = 'Makefile.mingw64',
|
2015-08-02 22:58:37 +00:00
|
|
|
HOST = 'Windows',
|
2015-07-26 01:59:07 +00:00
|
|
|
HEADERMSG = 'Install MSYS2',
|
2015-05-02 00:12:29 +00:00
|
|
|
CC = 'gcc',
|
|
|
|
CXX = 'g++',
|
|
|
|
AS = 'as',
|
2015-07-26 01:59:07 +00:00
|
|
|
AR = 'ar',
|
2015-07-26 04:46:44 +00:00
|
|
|
EXT = 'mingw64',
|
2015-05-02 00:12:29 +00:00
|
|
|
SO = 'dll',
|
2015-07-26 03:58:22 +00:00
|
|
|
PLATFORM = 'win',
|
2015-05-02 00:12:29 +00:00
|
|
|
PLAT_INCDIR = '',
|
|
|
|
PLAT_DEFS = '',
|
|
|
|
PLAT_CFLAGS = '-m64 -fpic -fstrict-aliasing',
|
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS}',
|
2015-08-02 22:58:37 +00:00
|
|
|
PLAT_LDFLAGS = '-m64 -shared -lm',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS}',
|
2015-05-02 00:12:29 +00:00
|
|
|
},
|
2015-07-26 01:59:07 +00:00
|
|
|
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
|
|
wii = {
|
2015-07-26 03:58:22 +00:00
|
|
|
MAKEFILE = 'Makefile.wii',
|
2015-08-02 22:58:37 +00:00
|
|
|
HOST = 'Linux',
|
|
|
|
HEADERMSG = 'Install devkitppc',
|
2015-07-26 03:58:22 +00:00
|
|
|
CC = '$(DEVKITPPC_ROOT_DIR)/bin/powerpc-eabi-gcc',
|
|
|
|
CXX = '$(DEVKITPPC_ROOT_DIR)/bin/powerpc-eabi-g++',
|
|
|
|
AS = '$(DEVKITPPC_ROOT_DIR)/bin/powerpc-eabi-as',
|
|
|
|
AR = '$(DEVKITPPC_ROOT_DIR)/bin/powerpc-eabi-ar',
|
|
|
|
EXT = 'wii',
|
|
|
|
SO = 'so',
|
|
|
|
PLATFORM = 'wii',
|
|
|
|
PLAT_INCDIR = '',
|
|
|
|
PLAT_DEFS = '-DGEKKO -DHW_RVL',
|
|
|
|
PLAT_CFLAGS = '-m32 -fstrict-aliasing -mrvl -mcpu=750 -meabi -mhard-float',
|
|
|
|
PLAT_CXXFLAGS = '${PLAT_CFLAGS}',
|
|
|
|
PLAT_LDFLAGS = '-shared -lm',
|
2015-08-01 19:57:03 +00:00
|
|
|
PLAT_LDXFLAGS = '${PLAT_LDFLAGS}',
|
2015-07-26 03:58:22 +00:00
|
|
|
STATIC_LINKING = '1'
|
2015-07-26 01:59:07 +00:00
|
|
|
},
|
2015-05-02 00:12:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for plat, defs in pairs( platforms ) do
|
|
|
|
local templ = template
|
|
|
|
local equal
|
2015-07-26 03:03:35 +00:00
|
|
|
|
|
|
|
defs.STATIC_LINKING = defs.STATIC_LINKING or '0'
|
2015-05-02 00:12:29 +00:00
|
|
|
|
|
|
|
repeat
|
|
|
|
equal = true
|
|
|
|
|
|
|
|
for def, value in pairs( defs ) do
|
|
|
|
local templ2 = templ:gsub( '%${' .. def .. '}', ( value:gsub( '%%', '%%%%' ) ) )
|
|
|
|
equal = equal and templ == templ2
|
|
|
|
templ = templ2
|
|
|
|
end
|
|
|
|
until equal
|
|
|
|
|
2015-06-17 05:21:14 +00:00
|
|
|
local file, err = io.open( defs.MAKEFILE, 'wb' )
|
2015-05-02 00:12:29 +00:00
|
|
|
if not file then error( err ) end
|
|
|
|
|
|
|
|
file:write( templ )
|
|
|
|
file:close()
|
|
|
|
end
|