Commit 1b8eca18 authored by thomie's avatar thomie

Build system: check for inconsistent settings (#10157)

`configure` currently detects when the docbook and hscolour tools aren't
available, and instead of failing outright (as it does for missing alex
and happy), sets some variables in mk/config.mk to tell `make` not to
build the documentation.

Sometimes, however, you want to really make sure all documentation gets
built, fully colourized. For example when making a release. To do so,
you can override the mentioned variables from mk/config.mk in
mk/build.mk (e.g. set HSCOLOUR_SRCS=YES).

This patch adds some error checking to make sure that doing so will not
result in weird build failures when those tools are still missing.

Test Plan: ran `make` a couple of times, with different mk/config.mk settings.

Reviewed by: austin

Differential Revision: https://phabricator.haskell.org/D1232
parent e4a73f4f
...@@ -1199,9 +1199,9 @@ echo ["\ ...@@ -1199,9 +1199,9 @@ echo ["\
fi fi
echo ["\ echo ["\
Building DocBook HTML documentation : $BUILD_DOCBOOK_HTML Can build DocBook HTML documentation : $BUILD_DOCBOOK_HTML
Building DocBook PS documentation : $BUILD_DOCBOOK_PS Can build DocBook PS documentation : $BUILD_DOCBOOK_PS
Building DocBook PDF documentation : $BUILD_DOCBOOK_PDF"] Can build DocBook PDF documentation : $BUILD_DOCBOOK_PDF"]
echo ["---------------------------------------------------------------------- echo ["----------------------------------------------------------------------
"] "]
......
...@@ -147,7 +147,13 @@ include mk/custom-settings.mk ...@@ -147,7 +147,13 @@ include mk/custom-settings.mk
SRC_CC_OPTS += $(WERROR) SRC_CC_OPTS += $(WERROR)
SRC_HC_OPTS += $(WERROR) SRC_HC_OPTS += $(WERROR)
# -----------------------------------------------------------------------------
# Check for inconsistent settings, after reading mk/build.mk.
# Although mk/config.mk should always contain consistent settings (set by
# configure), mk/build.mk can contain pretty much anything.
ifneq "$(CLEANING)" "YES" ifneq "$(CLEANING)" "YES"
ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES" ifeq "$(DYNAMIC_GHC_PROGRAMS)" "YES"
ifeq "$(findstring dyn,$(GhcLibWays))" "" ifeq "$(findstring dyn,$(GhcLibWays))" ""
$(error dyn is not in $$(GhcLibWays), but $$(DYNAMIC_GHC_PROGRAMS) is YES) $(error dyn is not in $$(GhcLibWays), but $$(DYNAMIC_GHC_PROGRAMS) is YES)
...@@ -157,12 +163,45 @@ ifeq "$(findstring v,$(GhcLibWays))" "" ...@@ -157,12 +163,45 @@ ifeq "$(findstring v,$(GhcLibWays))" ""
$(error v is not in $$(GhcLibWays), and $$(DYNAMIC_GHC_PROGRAMS) is not YES) $(error v is not in $$(GhcLibWays), and $$(DYNAMIC_GHC_PROGRAMS) is not YES)
endif endif
endif endif
ifeq "$(GhcProfiled)" "YES" ifeq "$(GhcProfiled)" "YES"
ifeq "$(findstring p,$(GhcLibWays))" "" ifeq "$(findstring p,$(GhcLibWays))" ""
$(error p is not in $$(GhcLibWays), and $$(GhcProfiled) is YES) $(error p is not in $$(GhcLibWays), and $$(GhcProfiled) is YES)
endif endif
endif endif
ifeq "$(BUILD_DOCBOOK_HTML)" "YES"
ifeq "$(XSLTPROC)" ""
$(error BUILD_DOCBOOK_HTML=YES, but `xsltproc` was not found. \
Install `xsltproc`, then rerun `./configure`. \
See https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation)
endif
ifeq "$(HAVE_DOCBOOK_XSL)" "NO"
$(error BUILD_DOCBOOK_HTML=YES, but DocBook XSL stylesheets were not found. \
Install `docbook-xsl`, then rerun `./configure`. \
See https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation)
endif
endif
ifneq "$(BUILD_DOCBOOK_PS) $(BUILD_DOCBOOK_PDF)" "NO NO"
ifeq "$(DBLATEX)" ""
$(error BUILD_DOCBOOK_PS or BUILD_DOCBOOK_PDF=YES, but `dblatex` was not found. \
Install `dblatex`, then rerun `./configure`. \
See https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation)
endif endif
endif
ifeq "$(HSCOLOUR_SRCS)" "YES"
ifeq "$(HSCOLOUR_CMD)" ""
$(error HSCOLOUR_SRCS=YES, but HSCOLOUR_CMD is empty. \
Run `cabal install hscolour`, then rerun `./configure`. \
See https://ghc.haskell.org/trac/ghc/wiki/Building/Preparation)
endif
endif
endif # CLEANING
# -----------------------------------------------------------------------------
ifeq "$(phase)" "" ifeq "$(phase)" ""
phase = final phase = final
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment