# This makefile does nothing but delegating the actual building to cmake
BUILDDIR := build
MAKEFLAGS := --no-print-directory

all: cpu_with_pybind

cpu_only:
	mkdir -p ${BUILDDIR}; \
	cd ${BUILDDIR}; \
	cmake -DBUILD_CPU_ALONE=ON -DCMAKE_BUILD_TYPE=Release -DPYBIND=OFF -DTESTS=OFF ..; \
	${MAKE} ${MAKEFLAGS};

cpu_tests:
	mkdir -p ${BUILDDIR}; \
	cd ${BUILDDIR}; \
	cmake -DBUILD_CPU_ALONE=ON -DCMAKE_BUILD_TYPE=Debug -DPYBIND=OFF -DTESTS=ON ..; \
	${MAKE} ${MAKEFLAGS}; \
	cd tests; \
	ctest --output-on-failure || true;

cpu_with_pybind:
	mkdir -p ${BUILDDIR}; \
	cd ${BUILDDIR}; \
	cmake -DBUILD_CPU_ALONE=ON -DCMAKE_BUILD_TYPE=Release -DPYBIND=ON -DTESTS=OFF ..; \
	${MAKE} ${MAKEFLAGS};

cpu_with_pybind_tests:
	mkdir -p ${BUILDDIR}; \
	cd ${BUILDDIR}; \
	cmake -DBUILD_CPU_ALONE=ON -DCMAKE_BUILD_TYPE=Debug -DPYBIND=ON -DTESTS=ON ..; \
	${MAKE} ${MAKEFLAGS}; \
	cd tests; \
	ctest --output-on-failure || true;

clean:
	if [ -d "${BUILDDIR}" ]; then rm -rf ${BUILDDIR}; fi