mirror of
https://github.com/holub/mame
synced 2025-10-05 00:38:58 +03:00
add TOOLCHAIN make flag for explicit toolchain prefix cross compiling (nw)
This commit is contained in:
parent
4e7f9e86e8
commit
36df7413dc
20
makefile
20
makefile
@ -75,6 +75,7 @@
|
|||||||
# BUILDDIR = build
|
# BUILDDIR = build
|
||||||
# TARGETOS = windows
|
# TARGETOS = windows
|
||||||
# CROSS_BUILD = 1
|
# CROSS_BUILD = 1
|
||||||
|
# TOOLCHAIN =
|
||||||
# OVERRIDE_CC = cc
|
# OVERRIDE_CC = cc
|
||||||
# OVERRIDE_CXX = c++
|
# OVERRIDE_CXX = c++
|
||||||
# OVERRIDE_LD = ld
|
# OVERRIDE_LD = ld
|
||||||
@ -270,9 +271,9 @@ WINDRES := $(MINGW32)/bin/windres
|
|||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
ifeq ($(ARCHITECTURE),_x64)
|
ifeq ($(ARCHITECTURE),_x64)
|
||||||
WINDRES := x86_64-w64-mingw32-windres
|
WINDRES := $(word 1,$(TOOLCHAIN) x86_64-w64-mingw32-)windres
|
||||||
else
|
else
|
||||||
WINDRES := i686-w64-mingw32-windres
|
WINDRES := $(word 1,$(TOOLCHAIN) i686-w64-mingw32-)windres
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -407,6 +408,9 @@ endif
|
|||||||
|
|
||||||
PARAMS+= --distro=$(DISTRO)
|
PARAMS+= --distro=$(DISTRO)
|
||||||
|
|
||||||
|
ifdef TOOLCHAIN
|
||||||
|
PARAMS += --TOOLCHAIN='$(TOOLCHAIN)'
|
||||||
|
endif
|
||||||
ifdef OVERRIDE_CC
|
ifdef OVERRIDE_CC
|
||||||
PARAMS += --CC='$(OVERRIDE_CC)'
|
PARAMS += --CC='$(OVERRIDE_CC)'
|
||||||
ifndef CROSS_BUILD
|
ifndef CROSS_BUILD
|
||||||
@ -777,12 +781,12 @@ endif
|
|||||||
|
|
||||||
ifeq ($(OS),windows)
|
ifeq ($(OS),windows)
|
||||||
ifeq (posix,$(SHELLTYPE))
|
ifeq (posix,$(SHELLTYPE))
|
||||||
GCC_VERSION := $(shell $(subst @,,$(CC)) -dumpversion 2> /dev/null)
|
GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null)
|
||||||
CLANG_VERSION := $(shell $(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$$/\1/" | head -n 1)
|
CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$$/\1/" | head -n 1)
|
||||||
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
|
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
|
||||||
else
|
else
|
||||||
GCC_VERSION := $(shell $(subst @,,$(CC)) -dumpversion 2> NUL)
|
GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> NUL)
|
||||||
CLANG_VERSION := $(shell $(subst @,,$(CC)) --version 2> NUL| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$$/\1/" | head -n 1)
|
CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> NUL| head -n 1 | grep clang | sed "s/^.*[^0-9]\([0-9]*\.[0-9]*\.[0-9]*\).*$$/\1/" | head -n 1)
|
||||||
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > NUL 2>&1 && echo python)
|
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > NUL 2>&1 && echo python)
|
||||||
endif
|
endif
|
||||||
ifdef MSBUILD
|
ifdef MSBUILD
|
||||||
@ -799,9 +803,9 @@ MSBUILD_PARAMS += /p:Platform=win32
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
else
|
||||||
GCC_VERSION := $(shell $(subst @,,$(CC)) -dumpversion 2> /dev/null)
|
GCC_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) -dumpversion 2> /dev/null)
|
||||||
ifneq ($(OS),solaris)
|
ifneq ($(OS),solaris)
|
||||||
CLANG_VERSION := $(shell $(subst @,,$(CC)) --version 2> /dev/null | head -n 1 | grep -e 'version [0-9]\.[0-9]\(\.[0-9]\)\?' -o | grep -e '[0-9]\.[0-9]\(\.[0-9]\)\?' -o | tail -n 1)
|
CLANG_VERSION := $(shell $(TOOLCHAIN)$(subst @,,$(CC)) --version 2> /dev/null | head -n 1 | grep -e 'version [0-9]\.[0-9]\(\.[0-9]\)\?' -o | grep -e '[0-9]\.[0-9]\(\.[0-9]\)\?' -o | tail -n 1)
|
||||||
endif
|
endif
|
||||||
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
|
PYTHON_AVAILABLE := $(shell $(PYTHON) --version > /dev/null 2>&1 && echo python)
|
||||||
endif
|
endif
|
||||||
|
@ -197,6 +197,11 @@ newoption {
|
|||||||
description = "LD replacement",
|
description = "LD replacement",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newoption {
|
||||||
|
trigger = "TOOLCHAIN",
|
||||||
|
description = "Toolchain prefix"
|
||||||
|
}
|
||||||
|
|
||||||
newoption {
|
newoption {
|
||||||
trigger = "PROFILE",
|
trigger = "PROFILE",
|
||||||
description = "Enable profiling.",
|
description = "Enable profiling.",
|
||||||
@ -427,6 +432,10 @@ if(_OPTIONS["USE_BGFX"]~=nil) then
|
|||||||
USE_BGFX = tonumber(_OPTIONS["USE_BGFX"])
|
USE_BGFX = tonumber(_OPTIONS["USE_BGFX"])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if(_OPTIONS["TOOLCHAIN"] == nil) then
|
||||||
|
_OPTIONS['TOOLCHAIN'] = ""
|
||||||
|
end
|
||||||
|
|
||||||
GEN_DIR = MAME_BUILD_DIR .. "generated/"
|
GEN_DIR = MAME_BUILD_DIR .. "generated/"
|
||||||
|
|
||||||
if (_OPTIONS["target"] == nil) then return false end
|
if (_OPTIONS["target"] == nil) then return false end
|
||||||
|
@ -106,7 +106,7 @@ end
|
|||||||
|
|
||||||
function sdlconfigcmd()
|
function sdlconfigcmd()
|
||||||
if not _OPTIONS["SDL_INSTALL_ROOT"] then
|
if not _OPTIONS["SDL_INSTALL_ROOT"] then
|
||||||
return _OPTIONS["SDL_LIBVER"] .. "-config"
|
return _OPTIONS['TOOLCHAIN'] .. "pkg-config " .. _OPTIONS["SDL_LIBVER"]
|
||||||
else
|
else
|
||||||
return path.join(_OPTIONS["SDL_INSTALL_ROOT"],"bin",_OPTIONS["SDL_LIBVER"]) .. "-config"
|
return path.join(_OPTIONS["SDL_INSTALL_ROOT"],"bin",_OPTIONS["SDL_LIBVER"]) .. "-config"
|
||||||
end
|
end
|
||||||
|
@ -4,6 +4,11 @@
|
|||||||
--
|
--
|
||||||
|
|
||||||
local naclToolchain = ""
|
local naclToolchain = ""
|
||||||
|
local toolchainPrefix = ""
|
||||||
|
|
||||||
|
if _OPTIONS['TOOLCHAIN'] then
|
||||||
|
toolchainPrefix = _OPTIONS["TOOLCHAIN"]
|
||||||
|
end
|
||||||
|
|
||||||
newoption {
|
newoption {
|
||||||
trigger = "gcc",
|
trigger = "gcc",
|
||||||
@ -204,15 +209,18 @@ function toolchain(_buildDir, _subDir)
|
|||||||
if not os.getenv("MINGW32") then
|
if not os.getenv("MINGW32") then
|
||||||
print("Set MINGW32 envrionment variable.")
|
print("Set MINGW32 envrionment variable.")
|
||||||
end
|
end
|
||||||
premake.gcc.cc = "$(MINGW32)/bin/i686-w64-mingw32-gcc"
|
if not toolchainPrefix then
|
||||||
premake.gcc.cxx = "$(MINGW32)/bin/i686-w64-mingw32-g++"
|
toolchainPrefix = "$(MINGW32)/bin/i686-w64-mingw32-"
|
||||||
|
end
|
||||||
|
premake.gcc.cc = toolchainPrefix .. "gcc"
|
||||||
|
premake.gcc.cxx = toolchainPrefix .. "g++"
|
||||||
-- work around GCC 4.9.2 not having proper linker for LTO=1 usage
|
-- work around GCC 4.9.2 not having proper linker for LTO=1 usage
|
||||||
local version_4_ar = str_to_version(_OPTIONS["gcc_version"])
|
local version_4_ar = str_to_version(_OPTIONS["gcc_version"])
|
||||||
if (version_4_ar < 50000) then
|
if (version_4_ar < 50000) then
|
||||||
premake.gcc.ar = "$(MINGW32)/bin/ar"
|
premake.gcc.ar = toolchainPrefix .. "ar"
|
||||||
end
|
end
|
||||||
if (version_4_ar >= 50000) then
|
if (version_4_ar >= 50000) then
|
||||||
premake.gcc.ar = "$(MINGW32)/bin/gcc-ar"
|
premake.gcc.ar = toolchainPrefix .. "gcc-ar"
|
||||||
end
|
end
|
||||||
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw32-gcc")
|
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw32-gcc")
|
||||||
end
|
end
|
||||||
@ -221,20 +229,22 @@ function toolchain(_buildDir, _subDir)
|
|||||||
if not os.getenv("MINGW64") then
|
if not os.getenv("MINGW64") then
|
||||||
print("Set MINGW64 envrionment variable.")
|
print("Set MINGW64 envrionment variable.")
|
||||||
end
|
end
|
||||||
premake.gcc.cc = "$(MINGW64)/bin/x86_64-w64-mingw32-gcc"
|
if not toolchainPrefix then
|
||||||
premake.gcc.cxx = "$(MINGW64)/bin/x86_64-w64-mingw32-g++"
|
toolchainPrefix = "$(MINGW64)/bin/x86_64-w64-mingw32-"
|
||||||
|
end
|
||||||
|
premake.gcc.cc = toolchainPrefix .. "gcc"
|
||||||
|
premake.gcc.cxx = toolchainPrefix .. "g++"
|
||||||
-- work around GCC 4.9.2 not having proper linker for LTO=1 usage
|
-- work around GCC 4.9.2 not having proper linker for LTO=1 usage
|
||||||
local version_4_ar = str_to_version(_OPTIONS["gcc_version"])
|
local version_4_ar = str_to_version(_OPTIONS["gcc_version"])
|
||||||
if (version_4_ar < 50000) then
|
if (version_4_ar < 50000) then
|
||||||
premake.gcc.ar = "$(MINGW64)/bin/ar"
|
premake.gcc.ar = toolchainPrefix .. "ar"
|
||||||
end
|
end
|
||||||
if (version_4_ar >= 50000) then
|
if (version_4_ar >= 50000) then
|
||||||
premake.gcc.ar = "$(MINGW64)/bin/gcc-ar"
|
premake.gcc.ar = toolchainPrefix .. "gcc-ar"
|
||||||
end
|
end
|
||||||
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw64-gcc")
|
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-mingw64-gcc")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if "mingw-clang" == _OPTIONS["gcc"] then
|
if "mingw-clang" == _OPTIONS["gcc"] then
|
||||||
premake.gcc.cc = "clang"
|
premake.gcc.cc = "clang"
|
||||||
premake.gcc.cxx = "clang++"
|
premake.gcc.cxx = "clang++"
|
||||||
@ -283,18 +293,17 @@ function toolchain(_buildDir, _subDir)
|
|||||||
|
|
||||||
if "osx" == _OPTIONS["gcc"] then
|
if "osx" == _OPTIONS["gcc"] then
|
||||||
if os.is("linux") then
|
if os.is("linux") then
|
||||||
local osxToolchain = "x86_64-apple-darwin13-"
|
premake.gcc.cc = toolchainPrefix .. "clang"
|
||||||
premake.gcc.cc = osxToolchain .. "clang"
|
premake.gcc.cxx = toolchainPrefix .. "clang++"
|
||||||
premake.gcc.cxx = osxToolchain .. "clang++"
|
premake.gcc.ar = toolchainPrefix .. "ar"
|
||||||
premake.gcc.ar = osxToolchain .. "ar"
|
|
||||||
end
|
end
|
||||||
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx")
|
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx")
|
||||||
end
|
end
|
||||||
|
|
||||||
if "osx-clang" == _OPTIONS["gcc"] then
|
if "osx-clang" == _OPTIONS["gcc"] then
|
||||||
premake.gcc.cc = "clang"
|
premake.gcc.cc = toolchainPrefix .. "clang"
|
||||||
premake.gcc.cxx = "clang++"
|
premake.gcc.cxx = toolchainPrefix .. "clang++"
|
||||||
premake.gcc.ar = "ar"
|
premake.gcc.ar = toolchainPrefix .. "ar"
|
||||||
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx-clang")
|
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-osx-clang")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -911,7 +920,6 @@ function toolchain(_buildDir, _subDir)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function strip()
|
function strip()
|
||||||
|
|
||||||
configuration { "android-arm", "Release" }
|
configuration { "android-arm", "Release" }
|
||||||
postbuildcommands {
|
postbuildcommands {
|
||||||
"$(SILENT) echo Stripping symbols.",
|
"$(SILENT) echo Stripping symbols.",
|
||||||
@ -939,13 +947,12 @@ function strip()
|
|||||||
configuration { "mingw*", "x64", "Release" }
|
configuration { "mingw*", "x64", "Release" }
|
||||||
postbuildcommands {
|
postbuildcommands {
|
||||||
"$(SILENT) echo Stripping symbols.",
|
"$(SILENT) echo Stripping symbols.",
|
||||||
"$(SILENT) $(MINGW64)/bin/strip -s \"$(TARGET)\"",
|
"$(SILENT) " .. (_OPTIONS['TOOLCHAIN'] and toolchainPrefix or "$(MINGW64)/bin/") .. "strip -s \"$(TARGET)\"",
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration { "mingw*", "x32", "Release" }
|
configuration { "mingw*", "x32", "Release" }
|
||||||
postbuildcommands {
|
postbuildcommands {
|
||||||
"$(SILENT) echo Stripping symbols.",
|
"$(SILENT) echo Stripping symbols.",
|
||||||
"$(SILENT) $(MINGW32)/bin/strip -s \"$(TARGET)\""
|
"$(SILENT) " .. (_OPTIONS['TOOLCHAIN'] and toolchainPrefix or "$(MINGW32)/bin/") .. "strip -s \"$(TARGET)\"",
|
||||||
}
|
}
|
||||||
|
|
||||||
configuration { "pnacl" }
|
configuration { "pnacl" }
|
||||||
|
Loading…
Reference in New Issue
Block a user