#!/usr/bin/make -f
# -*- makefile -*-

include /usr/share/dpkg/pkg-info.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PREFIX = /usr
export LIBDIR = /usr/lib/$(DEB_HOST_MULTIARCH)

sonameVersion = $(shell echo $(DEB_VERSION_UPSTREAM) | cut -d '+' -f 1 | cut -d '.' -f -3)
sonameAlias = $(shell echo $(sonameVersion) | cut -d '.' -f -2)

export SONAME = libllhttp.so.$(sonameVersion)
export SONAMEALIAS = libllhttp.so.$(sonameAlias)

%:
	dh $@ --with cmake

override_dh_auto_test:
	# tests are done by llhttp source package

execute_before_dh_auto_configure:
	cp -r /usr/src/llhttp/* .

override_dh_auto_configure:
	dh_auto_configure --buildsystem=cmake -- -DBUILD_STATIC_LIBS=ON

execute_after_dh_auto_clean:
	rm -rf src include obj-*
	-rm *
