One build directory per branch/arch.
This proposal allows to perform multiple compilation from different branch/arch in separate directories. Example: build ├── GNU_Linux │ ├── multi-compilation │ │ └── release │ └── NanoS-USBHID │ └── release └── Msys └── NanoS-USBHID └── release Edit 1: Try to handle special char as : / \ . --data-dir in unit test not yet tested Edit 2: donot use param for uname. -o is not supported by MacOS.
This commit is contained in:
parent
11dbfbc5b3
commit
b4679f37f4
117
Makefile
117
Makefile
|
@ -28,112 +28,129 @@
|
||||||
|
|
||||||
ANDROID_STANDALONE_TOOLCHAIN_PATH ?= /usr/local/toolchain
|
ANDROID_STANDALONE_TOOLCHAIN_PATH ?= /usr/local/toolchain
|
||||||
|
|
||||||
|
subbuilddir:=$(shell echo `uname | sed -e 's|[:/\\ \(\)]|_|g'`/`git branch | grep '\* ' | cut -f2- -d' '| sed -e 's|[:/\\ \(\)]|_|g'`)
|
||||||
|
ifeq ($(USE_SINGLE_BUILDDIR),)
|
||||||
|
builddir := build/"$(subbuilddir)"
|
||||||
|
topdir := ../../../..
|
||||||
|
deldirs := $(builddir)
|
||||||
|
else
|
||||||
|
builddir := build
|
||||||
|
topdir := ../..
|
||||||
|
deldirs := $(builddir)/debug $(builddir)/release $(builddir)/fuzz
|
||||||
|
endif
|
||||||
|
|
||||||
all: release-all
|
all: release-all
|
||||||
|
|
||||||
cmake-debug:
|
cmake-debug:
|
||||||
mkdir -p build/debug
|
mkdir -p $(builddir)/debug
|
||||||
cd build/debug && cmake -D CMAKE_BUILD_TYPE=Debug ../..
|
cd $(builddir)/debug && cmake -D CMAKE_BUILD_TYPE=Debug $(topdir)
|
||||||
|
|
||||||
debug: cmake-debug
|
debug: cmake-debug
|
||||||
cd build/debug && $(MAKE)
|
cd $(builddir)/debug && $(MAKE)
|
||||||
|
|
||||||
# Temporarily disable some tests:
|
# Temporarily disable some tests:
|
||||||
# * libwallet_api_tests fail (Issue #895)
|
# * libwallet_api_tests fail (Issue #895)
|
||||||
debug-test:
|
debug-test:
|
||||||
mkdir -p build/debug
|
mkdir -p $(builddir)/debug
|
||||||
cd build/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE) && $(MAKE) ARGS="-E libwallet_api_tests" test
|
cd $(builddir)/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug $(topdir) && $(MAKE) && $(MAKE) ARGS="-E libwallet_api_tests" test
|
||||||
|
|
||||||
debug-all:
|
debug-all:
|
||||||
mkdir -p build/debug
|
mkdir -p $(builddir)/debug
|
||||||
cd build/debug && cmake -D BUILD_TESTS=ON -D BUILD_SHARED_LIBS=OFF -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE)
|
cd $(builddir)/debug && cmake -D BUILD_TESTS=ON -D BUILD_SHARED_LIBS=OFF -D CMAKE_BUILD_TYPE=Debug $(topdir) && $(MAKE)
|
||||||
|
|
||||||
debug-static-all:
|
debug-static-all:
|
||||||
mkdir -p build/debug
|
mkdir -p $(builddir)/debug
|
||||||
cd build/debug && cmake -D BUILD_TESTS=ON -D STATIC=ON -D CMAKE_BUILD_TYPE=Debug ../.. && $(MAKE)
|
cd $(builddir)/debug && cmake -D BUILD_TESTS=ON -D STATIC=ON -D CMAKE_BUILD_TYPE=Debug $(topdir) && $(MAKE)
|
||||||
|
|
||||||
debug-static-win64:
|
debug-static-win64:
|
||||||
mkdir -p build/debug
|
mkdir -p $(builddir)/debug
|
||||||
cd build/debug && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=../../cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 ../.. && $(MAKE)
|
cd $(builddir)/debug && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 $(topdir) && $(MAKE)
|
||||||
|
|
||||||
debug-static-win32:
|
debug-static-win32:
|
||||||
mkdir -p build/debug
|
mkdir -p $(builddir)/debug
|
||||||
cd build/debug && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x32" -D CMAKE_TOOLCHAIN_FILE=../../cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys32 ../.. && $(MAKE)
|
cd $(builddir)/debug && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Debug -D BUILD_TAG="win-x32" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys32 $(topdir) && $(MAKE)
|
||||||
|
|
||||||
cmake-release:
|
cmake-release:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D CMAKE_BUILD_TYPE=Release ../..
|
cd $(builddir)/release && cmake -D CMAKE_BUILD_TYPE=Release $(topdir)
|
||||||
|
|
||||||
release: cmake-release
|
release: cmake-release
|
||||||
cd build/release && $(MAKE)
|
cd $(builddir)/release && $(MAKE)
|
||||||
|
|
||||||
release-test:
|
release-test:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE) && $(MAKE) test
|
cd $(builddir)/release && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=release $(topdir) && $(MAKE) && $(MAKE) test
|
||||||
|
|
||||||
release-all:
|
release-all:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=release $(topdir) && $(MAKE)
|
||||||
|
|
||||||
release-static:
|
release-static:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release $(topdir) && $(MAKE)
|
||||||
|
|
||||||
coverage:
|
coverage:
|
||||||
mkdir -p build/debug
|
mkdir -p $(builddir)/debug
|
||||||
cd build/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug -D COVERAGE=ON ../.. && $(MAKE) && $(MAKE) test
|
cd $(builddir)/debug && cmake -D BUILD_TESTS=ON -D CMAKE_BUILD_TYPE=Debug -D COVERAGE=ON $(topdir) && $(MAKE) && $(MAKE) test
|
||||||
|
|
||||||
# Targets for specific prebuilt builds which will be advertised for updates by their build tag
|
# Targets for specific prebuilt builds which will be advertised for updates by their build tag
|
||||||
|
|
||||||
release-static-linux-armv6:
|
release-static-linux-armv6:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv6zk" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv6" ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv6zk" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv6" $(topdir) && $(MAKE)
|
||||||
|
|
||||||
release-static-linux-armv7:
|
release-static-linux-armv7:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv7" ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv7" $(topdir) && $(MAKE)
|
||||||
|
|
||||||
release-static-android:
|
release-static-android:
|
||||||
mkdir -p build/release/translations
|
mkdir -p $(builddir)/release/translations
|
||||||
cd build/release/translations && cmake ../../../translations && $(MAKE)
|
cd $(builddir)/release/translations && cmake ../../../translations && $(MAKE)
|
||||||
cd build/release && CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D INSTALL_VENDORED_LIBUNBOUND=ON -D BUILD_TAG="android" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARM_MODE=ON -D CMAKE_ANDROID_ARCH_ABI="armeabi-v7a" ../.. && $(MAKE)
|
cd $(builddir)/release && CC=arm-linux-androideabi-clang CXX=arm-linux-androideabi-clang++ cmake -D BUILD_TESTS=OFF -D ARCH="armv7-a" -D STATIC=ON -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D INSTALL_VENDORED_LIBUNBOUND=ON -D BUILD_TAG="android" -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARM_MODE=ON -D CMAKE_ANDROID_ARCH_ABI="armeabi-v7a" ../.. && $(MAKE)
|
||||||
|
|
||||||
release-static-linux-armv8:
|
release-static-linux-armv8:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv8" ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -D BUILD_TESTS=OFF -D ARCH="armv8-a" -D STATIC=ON -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-armv8" $(topdir) && $(MAKE)
|
||||||
|
|
||||||
release-static-linux-x86_64:
|
release-static-linux-x86_64:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-x64" ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-x64" $(topdir) && $(MAKE)
|
||||||
|
|
||||||
release-static-freebsd-x86_64:
|
release-static-freebsd-x86_64:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="freebsd-x64" ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="freebsd-x64" $(topdir) && $(MAKE)
|
||||||
|
|
||||||
release-static-mac-x86_64:
|
release-static-mac-x86_64:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="mac-x64" ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="mac-x64" $(topdir) && $(MAKE)
|
||||||
|
|
||||||
release-static-linux-i686:
|
release-static-linux-i686:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-x86" ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=release -D BUILD_TAG="linux-x86" $(topdir) && $(MAKE)
|
||||||
|
|
||||||
release-static-win64:
|
release-static-win64:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=../../cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="x86-64" -D BUILD_64=ON -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x64" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/64-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys64 $(topdir) && $(MAKE)
|
||||||
|
|
||||||
release-static-win32:
|
release-static-win32:
|
||||||
mkdir -p build/release
|
mkdir -p $(builddir)/release
|
||||||
cd build/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x32" -D CMAKE_TOOLCHAIN_FILE=../../cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys32 ../.. && $(MAKE)
|
cd $(builddir)/release && cmake -G "MSYS Makefiles" -D STATIC=ON -D ARCH="i686" -D BUILD_64=OFF -D CMAKE_BUILD_TYPE=Release -D BUILD_TAG="win-x32" -D CMAKE_TOOLCHAIN_FILE=$(topdir)/cmake/32-bit-toolchain.cmake -D MSYS2_FOLDER=c:/msys32 $(topdir) && $(MAKE)
|
||||||
|
|
||||||
fuzz:
|
fuzz:
|
||||||
mkdir -p build/fuzz
|
mkdir -p $(builddir)/fuzz
|
||||||
cd build/fuzz && cmake -D STATIC=ON -D SANITIZE=ON -D BUILD_TESTS=ON -D USE_LTO=OFF -D CMAKE_C_COMPILER=afl-gcc -D CMAKE_CXX_COMPILER=afl-g++ -D ARCH="x86-64" -D CMAKE_BUILD_TYPE=fuzz -D BUILD_TAG="linux-x64" ../.. && $(MAKE)
|
cd $(builddir)/fuzz && cmake -D STATIC=ON -D SANITIZE=ON -D BUILD_TESTS=ON -D USE_LTO=OFF -D CMAKE_C_COMPILER=afl-gcc -D CMAKE_CXX_COMPILER=afl-g++ -D ARCH="x86-64" -D CMAKE_BUILD_TYPE=fuzz -D BUILD_TAG="linux-x64" $(topdir) && $(MAKE)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@echo "WARNING: Back-up your wallet if it exists within ./build!" ; \
|
@echo "WARNING: Back-up your wallet if it exists within ./"$(deldirs)"!" ; \
|
||||||
read -r -p "This will destroy the build directory, continue (y/N)?: " CONTINUE; \
|
read -r -p "This will destroy the build directory, continue (y/N)?: " CONTINUE; \
|
||||||
[ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)
|
[ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)
|
||||||
rm -rf build
|
rm -rf $(deldirs)
|
||||||
|
|
||||||
|
clean-all:
|
||||||
|
@echo "WARNING: Back-up your wallet if it exists within ./build!" ; \
|
||||||
|
read -r -p "This will destroy all build directories, continue (y/N)?: " CONTINUE; \
|
||||||
|
[ $$CONTINUE = "y" ] || [ $$CONTINUE = "Y" ] || (echo "Exiting."; exit 1;)
|
||||||
|
rm -rf ./build
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
|
ctags -R --sort=1 --c++-kinds=+p --fields=+iaS --extra=+q --language-force=C++ src contrib tests/gtest
|
||||||
|
|
Loading…
Reference in New Issue