#!/usr/bin/make -f
# export DH_VERBOSE = 1
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1

export CPPFLAGS:=$(shell dpkg-buildflags --get CPPFLAGS)
export CXXFLAGS:=$(shell dpkg-buildflags --get CXXFLAGS) $(CPPFLAGS)

%:
	dh $@

# hyprpaper uses the 'clear' target instead of a 'clean' target
override_dh_auto_clean:
	dh_auto_clean
	rm -rf *.c *.h obj-x86_64-linux-gnu/

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr

override_dh_auto_install:
	mkdir -p debian/tmp/usr/share/doc/hyprpaper
	pandoc debian/hyprpaper.1.rst --standalone --variable=header:"hyprpaper User Manual" --variable=section:1 --from rst --to man > debian/tmp/usr/share/doc/hyprpaper/hyprpaper.1
	dh_auto_install -- PREFIX='$${DESTDIR}/usr'
