#!/usr/bin/make -f

%:
	dh $@

override_dh_auto_build:
	# Build openssl from git and build heartleech against it
	git clone git://git.openssl.org/openssl.git -b OpenSSL_1_0_1g
	cd openssl; \
	./config; \
	make depend; \
	make; \
	gcc $$CFLAGS ../heartleech.c $$LDFLAGS libssl.a libcrypto.a -ldl -lpthread -o heartleech -I./include

override_dh_auto_install:
	# Copy the newly compiled binary in the package
	mkdir -p debian/heartleech/usr/bin
	cp openssl/heartleech debian/heartleech/usr/bin/

override_dh_auto_clean:
	rm -rf openssl
