#!/usr/bin/make -f

LFS_CFLAGS := $(shell getconf LFS_CFLAGS)
GHC_LFSFLAGS := $(LFS_CFLAGS) $(patsubst %,-optc %,$(LFS_CFLAGS))

DEB_SETUP_GHC_CONFIGURE_ARGS = --hsc2hs-options="$(LFS_CFLAGS)" --gcc-options="$(LFS_CFLAGS)" --ghc-options="$(GHC_LFSFLAGS)"

DEB_ENABLE_TESTS := yes

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/hlibrary.mk

# Avoid haddock bug with ppHsc2hs by first running cabal build, which does the
# preprocessing of the .hsc files correctly. Then haddock doesn't choke on the
# preprocessing, and builds the docs for the library component.
# For more information, see:
# https://github.com/haskell/cabal/issues/4215#issuecomment-273486201
build-haddock-stamp: build-ghc-stamp
