all: eigen

clean:
	rm -rf eigen/

EIGEN_PATCH=eigen_fix_gcc_610_compile.patch

# For some weird reason tar command below sometimes generates files with wrong ownership (happened in a virtual machine).
# If so, the following patch command fails.
# Workaround: patch again after 10 seconds (and once more after 30 seconds)

eigen: eigen.tgz $(EIGEN_PATCH) Makefile
	tar --no-same-owner -zxf $<
	patch -p0 < $(EIGEN_PATCH) || \
		( sleep 10 ; patch -p0 < $(EIGEN_PATCH) || \
		( sleep 30 ; patch -p0 < $(EIGEN_PATCH) ) )
	touch eigen/