#!/usr/bin/make -f

# Uncommented to turn on verbose mode.
export DH_VERBOSE=1

export DEB_BUILD_HARDENING=1
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

export ICMAKE_CPPSTD = --std=c++26

export CXXFLAGS = $(shell dpkg-buildflags --get CXXFLAGS)
export CXXFLAGS += ${ICMAKE_CPPSTD}  -Wall -D_FORTIFY_SOURCE=2

export LDFLAGS = $(shell dpkg-buildflags --get LDFLAGS)
# export LDFLAGS += -Wl,bindnow
# export LDFLAGS += -Wl,-z,now

export CXX = g++

%:
	dh $@

override_dh_auto_clean:
	rm -rf tmp
	find . -type f -name '*.ih.gch' -delete
	dh_auto_clean

override_dh_auto_build:
	# compile the package.
	./prepare   x
	./buildlib  x
	./build     x
	dh_auto_build

override_dh_auto_install:
	# Add here commands to install the package into debian/icmake
	./install all debian/icmake
	dh_auto_install
	# Do not ship the bobcat.tgz in the icmake binary package.
	# The inclusion of the tarball in src:icmake is temporary until
	# the bobcat-source package is in the archive.
	rm -fv debian/icmake/usr/share/icmake/bobcat.tgz
