#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

# CMake doesn't use CPPFLAGS, pass them to CFLAGS/CXXFLAGS to enable the
# missing (hardening) flags.
CFLAGS += $(CPPFLAGS)

include /usr/share/dpkg/architecture.mk

%:
	dh $@ --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure -- \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH)/ \
		-DCMAKE_BUILD_TYPE=Release \
		-DBUILD_DOCUMENTATION=ON

override_dh_auto_install:
	dh_auto_install
	ln -sf /usr/share/javascript/jquery/jquery.js debian/tmp/usr/share/opencc/doc/html/jquery.js

override_dh_auto_clean:
	dh_auto_clean
	find . -name *.pyc -delete

override_dh_installchangelogs:
	dh_installchangelogs -k NEWS.md

override_dh_missing:
	dh_missing --fail-missing
