Improve multi-targetting infrastructure.

Make the Makefile require a standard
|TARGET=<arch>-<vendor>-<sys>-<abi>| variable to be set instead of
requiring |TARGET_OS| and |TARGET_ARCH_BASE|.

Also, have the Makefile generate outputs to a subdirectory of build/
that names the target and compiler. This will make it easier and less
error-prone to test multiple configurations using a single source tree,
and will make some future cross-compilation targets easier.
This commit is contained in:
Brian Smith 2015-08-02 22:23:32 -04:00
parent bee3deff77
commit 0b191d69d0
5 changed files with 402 additions and 370 deletions

View File

@ -9,10 +9,143 @@ matrix:
#
# BEGIN GENERATED
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 TARGET_OS=darwin
- env: TARGET=x86_64-apple-darwin-macho USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG
os: osx
- env: USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 TARGET_OS=linux
- env: TARGET=x86_64-apple-darwin-macho USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: osx
- env: TARGET=x86-apple-darwin-macho USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG
os: osx
- env: TARGET=x86-apple-darwin-macho USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: osx
- env: TARGET=x86_64-pc-linux-gnu USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
packages:
- clang-3.6
- yasm
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- clang-3.6
- yasm
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
packages:
- g++-4.8
- gcc-4.8
- yasm
sources:
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- g++-4.8
- gcc-4.8
- yasm
sources:
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
packages:
- clang-3.5
- yasm
sources:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- clang-3.5
- yasm
sources:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
packages:
- yasm
- env: TARGET=x86_64-pc-linux-gnu USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- yasm
- env: TARGET=x86_64-pc-linux-gnu USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
packages:
- g++-5
- gcc-5
- yasm
sources:
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- g++-5
- gcc-5
- yasm
sources:
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu USE_CC=gcc-4.9 USE_CXX=g++-4.9 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
packages:
- g++-4.9
- gcc-4.9
- yasm
sources:
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu USE_CC=gcc-4.9 USE_CXX=g++-4.9 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- g++-4.9
- gcc-4.9
- yasm
sources:
- ubuntu-toolchain-r-test
- env: TARGET=x86-pc-linux-gnu USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -26,7 +159,21 @@ matrix:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- clang-3.6
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: TARGET=x86-pc-linux-gnu USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -40,64 +187,7 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- clang-3.5
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-5
- g++-5-multilib
- gcc-5
- gcc-5-multilib
- linux-libc-dev:i386
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 TARGET_OS=darwin
os: osx
- env: USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- clang-3.6
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
@ -111,7 +201,7 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -125,7 +215,21 @@ matrix:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- clang-3.5
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: TARGET=x86-pc-linux-gnu USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -137,7 +241,19 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- ubuntu-toolchain-r-test
- env: TARGET=x86-pc-linux-gnu USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -151,10 +267,21 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 TARGET_OS=darwin
os: osx
- env: TARGET=x86-pc-linux-gnu USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- g++-5
- g++-5-multilib
- gcc-5
- gcc-5-multilib
- linux-libc-dev:i386
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -165,61 +292,7 @@ matrix:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-4.8
- gcc-4.8
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- clang-3.5
- yasm
sources:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- yasm
- env: USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-5
- gcc-5
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.9 USE_CXX=g++-4.9 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-4.9
- gcc-4.9
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 TARGET_OS=darwin
os: osx
- env: USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
@ -230,7 +303,7 @@ matrix:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -241,7 +314,18 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- g++-4.8
- gcc-4.8
- yasm
sources:
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -252,14 +336,32 @@ matrix:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- clang-3.5
- yasm
sources:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
packages:
- yasm
- env: USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- yasm
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -270,7 +372,18 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.9 USE_CXX=g++-4.9 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- g++-5
- gcc-5
- yasm
sources:
- ubuntu-toolchain-r-test
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=gcc-4.9 USE_CXX=g++-4.9 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -281,10 +394,18 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=darwin
os: osx
- env: TARGET=x86_64-pc-linux-gnu NO_ASM=1 USE_CC=gcc-4.9 USE_CXX=g++-4.9 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- g++-4.9
- gcc-4.9
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu NO_ASM=1 USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -298,7 +419,21 @@ matrix:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu NO_ASM=1 USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- clang-3.6
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: TARGET=x86-pc-linux-gnu NO_ASM=1 USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -312,64 +447,7 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- clang-3.5
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-5
- g++-5-multilib
- gcc-5
- gcc-5-multilib
- linux-libc-dev:i386
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=darwin
os: osx
- env: USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- clang-3.6
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu NO_ASM=1 USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
@ -383,7 +461,7 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu NO_ASM=1 USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -397,7 +475,21 @@ matrix:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu NO_ASM=1 USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- clang-3.5
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: TARGET=x86-pc-linux-gnu NO_ASM=1 USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -409,7 +501,19 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86 NO_ASM=1 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu NO_ASM=1 USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- g++-multilib
- gcc-multilib
- libc6-dev-i386
- yasm
sources:
- ubuntu-toolchain-r-test
- env: TARGET=x86-pc-linux-gnu NO_ASM=1 USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=DEBUG
os: linux
addons:
apt:
@ -423,132 +527,16 @@ matrix:
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=darwin
os: osx
- env: USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- clang-3.6
- yasm
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-4.8
- gcc-4.8
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- clang-3.5
- yasm
sources:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- yasm
- env: USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
- env: TARGET=x86-pc-linux-gnu NO_ASM=1 USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=RELWITHDEBINFO
os: linux
addons:
apt:
packages:
- g++-5
- g++-5-multilib
- gcc-5
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.9 USE_CXX=g++-4.9 CMAKE_BUILD_TYPE=DEBUG TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-4.9
- gcc-4.9
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=darwin
os: osx
- env: USE_CC=clang-3.6 USE_CXX=clang++-3.6 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- clang-3.6
- yasm
sources:
- llvm-toolchain-precise-3.6
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.8 USE_CXX=g++-4.8 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-4.8
- gcc-4.8
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=clang-3.5 USE_CXX=clang++-3.5 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- clang-3.5
- yasm
sources:
- llvm-toolchain-precise-3.5
- ubuntu-toolchain-r-test
- env: USE_CC=clang USE_CXX=clang++ CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- yasm
- env: USE_CC=gcc-5 USE_CXX=g++-5 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-5
- gcc-5
- yasm
sources:
- ubuntu-toolchain-r-test
- env: USE_CC=gcc-4.9 USE_CXX=g++-4.9 CMAKE_BUILD_TYPE=RELWITHDEBINFO TARGET_ARCH_BASE=x86_64 NO_ASM=1 TARGET_OS=linux
os: linux
addons:
apt:
packages:
- g++-4.9
- gcc-4.9
- gcc-5-multilib
- linux-libc-dev:i386
- yasm
sources:
- ubuntu-toolchain-r-test

View File

@ -21,20 +21,24 @@ There is no ./configure step.
GNU Make 3.81 or later is required. Perl 5.6.1 or later is also required
(unless you disable all the assembly language optimizations by building
with ```NO_ASM=1```). *ring* is designed with cross-compilation in mind so it
expects variables ```CC```, ```CXX```, ```TARGET_ARCH_BASE```, and ```TARGET_OS```
to be passed to ```make```. For example, this will build ring
expects variables ```CC```, ```CXX```, and ```TARGET``` to be passed
to ```make```. For example, this will build a 32-bit x86 *ring* for Linux using
GCC 4.8:
make -j6 CC=clang-3.6 CXX=clang++-3.6 TARGET_ARCH_BASE=x86_64 TARGET_OS=linux
make -j6 CC=gcc-4.8 CXX=g++-4.8 TARGET=x86-pc-linux-gnu
As another example, this will build a 64-bit x86-64 *ring* for Mac OS X:
make -j6 CC=clang CXX=clang++ TARGET=x86_64-apple-darwin-macho
All four parts of the target are required. ```x86``` must be used instead
of ```i386```, ```i586```, etc.
GCC 4.8 and later are supported, as are clang 3.4 and later. Other compilers
will also probably work without too much trouble. Set ```TARGET_ARCH_BASE``` to
either ```x86``` or ```x86_64```. (ARM and MIPS support is just waiting on some
tweaks of the build system and the test infrastructure.) Set ```TARGET_OS```
to ```darwin``` for Mac OS X or ```linux``` for Linux.
Note in particular that if you are cross-compiling an x86 build on a 64-bit
version of Linux, then you need to have the proper gcc-multilibs and
g++-multilibs packages, or equivalent, installed.
will also probably work without too much trouble. Note in particular that if
you are cross-compiling an x86 build on a 64-bit version of Linux, then you
need to have the proper gcc-multilibs and g++-multilibs packages or equivalent
installed.
The default build is a debug build (```CMAKE_BUILD_TYPE=DEBUG```). You can
build a release build by setting ```CMAKE_BUILD_TYPE``` to ```RELWITHDEBINFO```.
@ -42,19 +46,19 @@ build a release build by setting ```CMAKE_BUILD_TYPE``` to ```RELWITHDEBINFO```.
used.) For example, this will build *ring* in release mode with the default
version of clang on Mac OS X:
make -j6 CC=clang CXX=clang++ TARGET_ARCH_BASE=x86_64 TARGET_OS=darwin CMAKE_BUILD_TYPE=RELWITHDEBINFO
make -j6 CC=clang-3.6 CXX=clang++-3.6 TARGET=x86_64-pc-linux-gnu CMAKE_BUILD_TYPE=RELWITHDEBINFO
Then compile your applications with ```-Iring/include``` (assuming you put *ring*
into the ```ring``` subdirectory of your project) and add ```$(RING_LDFLAGS)```
to LDFLAGS in your linking step. ```RING_LDFLAGS``` expands by default
to ```-pthread -Lbuild/lib/libring.a -lring```. (It should also be easy to
build *ring* so that it doesn't depend on pthreads, but the build system hasn't
been enhanced to fully support that yet.)
to ```-pthread -Lbuild/$TARGET-$CC/lib/libring.a -lring```. (It should also be
easy to build *ring* so that it doesn't depend on pthreads, but the build system
hasn't been enhanced to fully support that yet.)
Running the tests using ```make check``` requires Go (https://golang.org/) to
be in ```$PATH```. Example:
make check -j6 CC=clang-3.6 CXX=clang-3.6++ TARGET_ARCH_BASE=x86 TARGET_OS=linux
make check -j6 CC=clang-3.6 CXX=clang++-3.6 TARGET=x86_64-pc-linux-gnu

View File

@ -283,7 +283,7 @@ PERLASM_LIB_SRCS = $(addprefix $(RING_PREFIX), \
PERL_EXECUTABLE ?= perl
# The British spelling "flavour" is used for consistency with perlasm's code.
ifeq ($(TARGET_OS),darwin)
ifeq ($(findstring darwin,$(TARGET_SYS)),darwin)
PERLASM_FLAVOUR ?= macosx
else
PERLASM_FLAVOUR ?= elf

View File

@ -14,6 +14,27 @@
.DEFAULT_GOAL := all
# $(TARGET) must be of the form <arch>-<vendor>-<sys>-<abi>.
TARGET_WORDS = $(subst -, ,$(TARGET))
ifneq ($(words $(TARGET_WORDS)),4)
define NEWLINE
endef
$(error TARGET must be of the form \
<arch>[<sub>]-<vendor>-<sys>-<abi>.$(NEWLINE)\
\
Linux x86 example: TARGET=x86-pc-linux-gnu $(NEWLINE)\
Mac OS X x64 example: TARGET=x86_64-apple-darwin-macho) $(NEWLINE)\
\
NOTE: Use "x86" instead of "i386", "i586", "i686", etc.)
endif
TARGET_ARCH_BASE = $(word 1,$(TARGET_WORDS))
TARGET_VENDOR = $(word 2,$(TARGET_WORDS))
TARGET_SYS = $(word 3,$(TARGET_WORDS))
TARGET_ABI = $(word 4,$(TARGET_WORDS))
# Although it isn't documented, GNU Make passes $(TARGET_ARCH) in its implicit
# rules.
ifeq ($(TARGET_ARCH_BASE),x86)
@ -24,7 +45,20 @@ else
$(error You must specify TARGET_ARCH_BASE as one of {x86,x86_64})
endif
BUILD_PREFIX ?= build/
ifeq ($(CC),)
$(error You must specify CC)
endif
ifeq ($(CXX),)
$(error You must specify CXX)
endif
# e.g. "clang-3.6"
COMPILER_NAME ?= $(notdir $(CC))
# Generate output to a directory like build/x86_64-unknown-linux-elf-clang-3.6.
BUILD_PREFIX_PRIMARY ?= build
BUILD_PREFIX_SUB ?= $(TARGET)-$(COMPILER_NAME)
BUILD_PREFIX ?= $(BUILD_PREFIX_PRIMARY)/$(BUILD_PREFIX_SUB)/
EXE_PREFIX ?= $(BUILD_PREFIX)bin/
OBJ_PREFIX ?= $(BUILD_PREFIX)obj/
@ -36,18 +70,14 @@ CXXFLAGS_STD ?= -std=c++11
CFLAGS += $(CFLAGS_STD)
CXXFLAGS += $(CXXFLAGS_STD)
# Always add full debug info. |-gfull| is required for Darwin's |-dead_strip|.
ifeq ($TARGET_OS,darwin)
CPPFLAGS += -gfull
else
CPPFLAGS += -g3
endif
# Dead code elimination.
# Always add full debug info and strip dead code.
CPPFLAGS += -fdata-sections -ffunction-sections
ifeq ($(TARGET_OS),darwin)
ifeq ($(findstring darwin,$(TARGET_SYS)),darwin)
# |-gfull| is required for Darwin's |-dead_strip|.
CPPFLAGS += -gfull
LDFLAGS += -Wl,-dead_strip
else
CPPFLAGS += -g3
LDFLAGS += -Wl,--gc-sections
endif

View File

@ -44,47 +44,58 @@ osx_compilers = [
]
compilers = {
"darwin" : osx_compilers,
"linux" : linux_compilers,
"osx" : osx_compilers,
}
oss = [
("darwin", "osx"),
("linux", "linux"),
]
modes = [
"DEBUG",
"RELWITHDEBINFO"
]
archs = [
"x86",
"x86_64",
# Mac OS X is first because we don't want to have to wait until all the Linux
# configurations have been built to find out that there is a failure on Mac.
oss = [
"osx",
"linux",
]
# The second vlaue in each tuple is the value of the NO_ASM paramter.
targets = {
"osx" : [
("x86_64-apple-darwin-macho", ""),
("x86-apple-darwin-macho", ""),
],
"linux" : [
("x86_64-pc-linux-gnu", ""),
("x86-pc-linux-gnu", ""),
("x86_64-pc-linux-gnu", "1"),
("x86-pc-linux-gnu", "1"),
],
}
no_asms = [
"",
"1",
]
def format_entries():
return "\n".join([format_entry(os, compiler, mode, arch, no_asm)
for no_asm in no_asms
for arch in archs
for mode in modes
return "\n".join([format_entry(os, target, compiler, no_asm, mode)
for os in oss
for compiler in compilers[os[0]]
for target, no_asm in targets[os]
for compiler in compilers[os]
for mode in modes
# XXX: 32-bit GCC 4.9 does not work because Travis does
# not have g++-4.9-multilib whitelisted for use.
if not (compiler == "gcc-4.9" and arch == "x86")])
if not (compiler == "gcc-4.9" and
target == "x86-pc-linux-gnu")])
# Set |USE_CC| and |USE_CXX| instead of |CC| and |CXX| since Travis sets |CC|
# and |CXX| to its default values *after* processing the |env:| directive here.
# The travis |before_script| section will then export CC=$USE_CC CXX=$USE_CXX.
# The travis |before_script| section will then |export CC=$USE_CC CXX=$USE_CXX|.
entry_template = """
- env: USE_CC=%(cc)s USE_CXX=%(cxx)s CMAKE_BUILD_TYPE=%(mode)s TARGET_ARCH_BASE=%(arch)s TARGET_OS=%(target_os)s
os: %(travis_os)s"""
- env: TARGET=%(target)s USE_CC=%(cc)s USE_CXX=%(cxx)s CMAKE_BUILD_TYPE=%(mode)s
os: %(os)s"""
entry_packages_template = """
addons:
@ -96,15 +107,15 @@ entry_sources_template = """
sources:
%(sources)s"""
def format_entry(os, compiler, mode, arch, no_asm):
def format_entry(os, target, compiler, no_asm, mode):
arch, vendor, sys, abi = target.split("-")
def prefix_all(prefix, xs):
return [prefix + x for x in xs]
target_os, travis_os = os
template = entry_template
if target_os == "linux":
if sys == "linux":
packages = sorted(get_linux_packages_to_install(compiler, arch))
sources_with_dups = sum([get_sources_for_package(p) for p in packages],[])
sources = sorted(list(set(sources_with_dups)))
@ -116,18 +127,17 @@ def format_entry(os, compiler, mode, arch, no_asm):
packages = []
sources = []
cc = get_cc(target_os, compiler)
cxx = replace_cc_with_cxx(target_os, compiler)
cc = get_cc(sys, compiler)
cxx = replace_cc_with_cxx(sys, compiler)
return template % {
"arch" : arch + ("" if not no_asm else (" NO_ASM=" + no_asm)),
"cc" : cc,
"cxx" : cxx,
"mode" : mode,
"packages" : "\n ".join(prefix_all("- ", packages)),
"sources" : "\n ".join(prefix_all("- ", sources)),
"target_os" : target_os,
"travis_os" : travis_os,
"target" : target + ("" if not no_asm else (" NO_ASM=" + no_asm)),
"os" : os,
}
def get_linux_packages_to_install(compiler, arch):
@ -180,14 +190,14 @@ def get_sources_for_package(package):
else:
return [ubuntu_toolchain]
def get_cc(target_os, compiler):
if target_os == "linux" and compiler == "clang-3.4":
def get_cc(sys, compiler):
if sys == "linux" and compiler == "clang-3.4":
return "clang"
return compiler
def replace_cc_with_cxx(target_os, compiler):
return get_cc(target_os, compiler) \
def replace_cc_with_cxx(sys, compiler):
return get_cc(sys, compiler) \
.replace("gcc", "g++") \
.replace("clang", "clang++")