#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
include /usr/share/dpkg/default.mk
pkg    := cufflinks
mandir := $(CURDIR)/debian/$(pkg)/usr/share/man/man1
bindir := $(CURDIR)/debian/$(pkg)/usr/bin

# build the legacy C code with -std=gnu11 so that old-style
# declarations "extern f();" keep their pre-C23 meaning of
# "unspecified arguments" instead of "no arguments" (Closes: #1114084)
export DEB_CFLAGS_MAINT_APPEND=-std=gnu11

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- LIBS="-lboost_thread -lboost_serialization" --with-boost-system=no

override_dh_auto_clean:
	dh_auto_clean
	rm -rf autom4te.cache

override_dh_auto_install:
	dh_auto_install
	# skip gffread binary provided by gffread package
	rm -rf $(bindir)/gffread

override_dh_installman:
	dh_installman

	# try to create man pages whereever possible
	mkdir -p $(mandir)
	for i in cuffcompare compress_gtf gtf_to_sam cuffmerge \
cuffdiff cuffquant cuffnorm cufflinks ; do \
	help2man --no-info --no-discard-stderr  -h "" \
	    --name='component of cufflinks suite' \
	    --version-string="$(DEB_VERSION)" \
		$(bindir)/$$i > $(mandir)/$$i.1; \
	done
