#!/usr/bin/make -f

include /usr/share/dpkg/architecture.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1

include /usr/share/dpkg/buildflags.mk

export DEB_CFLAGS=$(CFLAGS) $(CPPFLAGS)
export DEB_CXXFLAGS=$(CXXFLAGS) $(CPPFLAGS)
export DEB_LDFLAGS=$(LDFLAGS)

%:
	dh $@ --with python3

override_dh_auto_install:
	./scripts/debian/install.pl
	cd src/perl5/glfw && make install
	cd src/glGribTk && make install
	cd src/python3/glfw && make install
	./scripts/debian/cleanInstall.pl

execute_after_dh_install-arch:
	# Removing useless direct_url.json file with build path.
	find debian/python3-glgrib-glfw -name "direct_url.json" -delete

execute_after_dh_install-indep:
	# Removing extra license files
	find debian/glgrib-data -name "*LICENCE.txt" -delete
	find debian/glgrib-data -name "*LICENSE.txt" -delete
	find debian/glgrib-data -name "*LICENSE.TXT" -delete
	find debian/glgrib-data -name "COPYING.LESSERv3" -delete
