.PHONY: all clean configure
-all: build-ppc64le/benchmarks build-aarch64/benchmarks build-x86_64/benchmarks
+
+host_arch = $(shell uname -m)
+ifeq ($(host_arch),x86_64)
+ enabled_arches = ppc64le aarch64 x86_64
+else ifeq ($(host_arch),aarch64)
+ # debian 10 doesn't have cross-compilers for ppc64le from aarch64
+ enabled_arches = aarch64 x86_64
+else ifeq ($(host_arch),ppc64le)
+ enabled_arches = ppc64le aarch64 x86_64
+else
+ $(error unsupported arch $(host_arch))
+endif
+
+all: $(foreach arch,$(enabled_arches),build-$(arch)/benchmarks)
common_cmake_flags = -S .
common_cmake_flags += -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE
reset_make_env = "MAKEFLAGS=" "MFLAGS=" "MAKELEVEL=" "MAKE_TERMERR=" "MAKE_TERMOUT="
.installed-dependencies: install-deps.sh
- ./install-deps.sh
+ ./install-deps.sh $(enabled_arches)
touch .installed-dependencies
build-ppc64le/Makefile: toolchain-powerpc64le-linux-gnu.cmake CMakeLists.txt .installed-dependencies
rm -fr build-x86_64
env $(reset_make_env) cmake $(common_cmake_flags) -B build-x86_64 -DCMAKE_TOOLCHAIN_FILE=toolchain-x86_64-linux-gnu.cmake
-configure: build-ppc64le/Makefile build-aarch64/Makefile build-x86_64/Makefile
+configure: $(foreach arch,$(enabled_arches),build-$(arch)/Makefile)
.PHONY: __force-run