#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1


# see FEATURE AREAS in dpkg-buildflags(1)
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 $@

override_dh_auto_configure:
	dh_auto_configure -- --libdir=\$${prefix}/lib --libexecdir=\$${prefix}/bin --enable-native=no --disable-stripping target_alias=${DEB_HOST_MULTIARCH} --with-incdir=/usr/include/

override_dh_install:
	dh_install
	rm -r debian/pcc/usr/lib
	mv debian/pcc/usr/bin/${DEB_HOST_MULTIARCH}-cpp debian/pcc/usr/bin/${DEB_HOST_MULTIARCH}-pcc-cpp
	mv debian/pcc/usr/share/man/man1/${DEB_HOST_MULTIARCH}-ccom.1 debian/pcc/usr/share/man/man1/ccom.1
	mv debian/pcc/usr/share/man/man1/${DEB_HOST_MULTIARCH}-cpp.1 debian/pcc/usr/share/man/man1/pcc-cpp.1

override_dh_installman:
	dh_installman
	ln -s ccom.1.gz debian/pcc/usr/share/man/man1/cxxcom.1.gz

override_dh_link:
	dh_link
	for name in ccom cxxcom pcc-cpp p++ pcc pcpp; do \
		ln -s ${DEB_HOST_MULTIARCH}-$$name debian/pcc/usr/bin/$$name; \
	done
