#!/usr/bin/make -f

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

# The custom build system doesn't support CPPFLAGS
CFLAGS:=$(CPPFLAGS) $(CFLAGS)
CXXFLAGS:=$(CPPFLAGS) $(CXXFLAGS)

# The trailing slashes are very important to the build system
subdirectories:= $(filter-out debian/, $(shell ls -d */))
meryl:= libbio/ libkmer/ libmeryl/ libseq/ libutil/ meryl/

%:
	dh $@ 

override_dh_auto_build:
        # The Makefile apparently doesn't use regular LDFLAGS.
        # It defines CLDFLAGS and CXXLDFLAGS as empty strings, so let's
        # use them here.
	$(MAKE) \
            CLDFLAGS="$(LDFLAGS)" \
            CXXLDFLAGS="$(LDFLAGS)" \
            WITHOUT="$(filter-out $(meryl), $(subdirectories))" install
	ln -sf $(shell uname)-* installdir

override_dh_auto_clean:
	$(MAKE) real-clean
	rm -rf $(shell uname)-* installdir

get-orig-source:
	. debian/get-orig-source
