# Local GHC-build-tree customization for Cabal makefiles.  We want to build
# libraries using flags that the user has put in build.mk/validate.mk and
# appropriate flags for Mac OS X deployment targets.

# Careful here: including boilerplate.mk breaks things, because paths.mk and
# opts.mk overrides some of the variable settings in the Cabal Makefile, so
# we just include config.mk and custom-settings.mk.
include ../defineTOP.mk
SAVE_GHC := $(GHC)
SAVE_AR  := $(AR)
SAVE_LD  := $(LD)
include $(TOP)/mk/config.mk
include $(TOP)/mk/custom-settings.mk
GHC := $(SAVE_GHC)
AR  := $(SAVE_AR)
LD  := $(SAVE_LD)

# We want all warnings on
GhcLibHcOpts += -Wall

# Cabal has problems with deprecated flag warnings, as it needs to pass
# deprecated flags in pragmas in order to support older GHCs. Thus for
# now at least we just disable them completely.
GhcLibHcOpts += -fno-warn-deprecated-flags

ifeq "$(filter-out Win32-% dph%,$(package))" ""
# XXX We are one of the above list, i.e. we are a package that is not
# yet warning-clean. Thus turn warnings off for now so that validate
# goes through.
GhcLibHcOpts += -w
endif

# Now add flags from the GHC build system to the Cabal build:
GHC_OPTS    += $(SRC_HC_OPTS)
GHC_OPTS    += $(GhcLibHcOpts)

include $(TOP)/mk/bindist.mk

