#!/usr/bin/make -f

# See debhelper(7) (uncomment to enable).
# Output every command that modifies files on the build system.

include /usr/share/dpkg/pkg-info.mk
DEB_UPSTREAM_VERSION=$DEB_{SOURCE,VERSION}

export QT_SELECT = 5

#export DH_VERBOSE = 1


# See FEATURE AREAS in dpkg-buildflags(1).
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# See ENVIRONMENT in dpkg-buildflags(1).
# Package maintainers to append CFLAGS.
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
# Package maintainers to append LDFLAGS.
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed


%:
	dh $@


# dh_make generated override targets.
# This is an example for Cmake (see <https://bugs.debian.org/641051>).
#override_dh_auto_configure:
#	dh_auto_configure -- \
#	-DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)

override_dh_clean:
	dh_clean
	rm -rf unix/
	find . -name *.qm -delete
	rm -rf debian/librecad.1 debian/librecad.desktop \
           debian/librecad.sharedmimeinfo debian/librecad.mime \
           debian/librecad.png debian/librecad.xpm debian/librecad.svg \
           plugins/intermediate \
           generated/ custom.pro

override_dh_auto_configure:
	dh_auto_configure -- librecad.pro
	cp desktop/librecad* debian
	cp desktop/graphics_icons_and_splash/Icon\ LibreCAD/Icon_Librecad.svg debian/librecad.svg
	convert -resize 48x48 desktop/graphics_icons_and_splash/Icon\ LibreCAD/Icon_Librecad.svg debian/librecad.png
	convert -resize 32x32 desktop/graphics_icons_and_splash/Icon\ LibreCAD/Icon_Librecad.svg debian/librecad.xpm

copyright_check:
	$(MAKE) -f /usr/share/cdbs/1/rules/utils.mk debian/stamp-copyright-check
	rm debian/stamp-copyright-check