Commit d6512c74 authored by Sergei Trofimovich's avatar Sergei Trofimovich
Browse files

ghc.mk: don't run mkUserGuidePart more than once



When building 'html' and 'man' manuals
build system reports mkUserGuide is ran
more than once (up to 3 times in parallel).

See Note [Blessed make target file] for
more details.
Signed-off-by: default avatarSergei Trofimovich <siarheit@google.com>
parent 314bc99a
...@@ -39,11 +39,18 @@ utils/mkUserGuidePart_GENERATED_FLAGS_SETS := \ ...@@ -39,11 +39,18 @@ utils/mkUserGuidePart_GENERATED_FLAGS_SETS := \
verbosity \ verbosity \
warnings warnings
utils/mkUserGuidePart_GENERATED_RST_SOURCES := \ # See Note [Blessed make target file]
utils/mkUserGuidePart_GENERATED_RST_SOURCES_BLESSED_FILE := \
docs/users_guide/what_glasgow_exts_does.gen.rst
utils/mkUserGuidePart_GENERATED_RST_SOURCES_OTHER_FILES := \
$(addprefix docs/users_guide/flags-,$(addsuffix .gen.rst,$(utils/mkUserGuidePart_GENERATED_FLAGS_SETS))) \ $(addprefix docs/users_guide/flags-,$(addsuffix .gen.rst,$(utils/mkUserGuidePart_GENERATED_FLAGS_SETS))) \
docs/users_guide/what_glasgow_exts_does.gen.rst \
docs/man/all-flags.gen.rst docs/man/all-flags.gen.rst
utils/mkUserGuidePart_GENERATED_RST_SOURCES := \
$(utils/mkUserGuidePart_GENERATED_RST_SOURCES_BLESSED_FILE) \
$(utils/mkUserGuidePart_GENERATED_RST_SOURCES_OTHER_FILES)
utils/mkUserGuidePart_USES_CABAL = YES utils/mkUserGuidePart_USES_CABAL = YES
utils/mkUserGuidePart_PACKAGE = mkUserGuidePart utils/mkUserGuidePart_PACKAGE = mkUserGuidePart
utils/mkUserGuidePart_dist_PROGNAME = mkUserGuidePart utils/mkUserGuidePart_dist_PROGNAME = mkUserGuidePart
...@@ -52,7 +59,36 @@ utils/mkUserGuidePart_dist_INSTALL_INPLACE = YES ...@@ -52,7 +59,36 @@ utils/mkUserGuidePart_dist_INSTALL_INPLACE = YES
$(eval $(call build-prog,utils/mkUserGuidePart,dist,2)) $(eval $(call build-prog,utils/mkUserGuidePart,dist,2))
$(eval $(call clean-target,utils/mkUserGuidePart,gen,$(utils/mkUserGuidePart_GENERATED_RST_SOURCES))) $(eval $(call clean-target,utils/mkUserGuidePart,gen,$(utils/mkUserGuidePart_GENERATED_RST_SOURCES)))
$(utils/mkUserGuidePart_GENERATED_RST_SOURCES) : $(mkUserGuidePart_INPLACE) $(utils/mkUserGuidePart_GENERATED_RST_SOURCES_OTHER_FILES) :
$(utils/mkUserGuidePart_GENERATED_RST_SOURCES_BLESSED_FILE) : $(utils/mkUserGuidePart_GENERATED_RST_SOURCES_OTHER_FILES) $(mkUserGuidePart_INPLACE)
$(mkUserGuidePart_INPLACE) $(mkUserGuidePart_INPLACE)
$(TOUCH_CMD) $@
all_utils/mkUserGuidePart: $(mkUserGuidePart_INPLACE) all_utils/mkUserGuidePart: $(mkUserGuidePart_INPLACE)
# Note [Blessed make target file]
#
# make cannot express nicely a single build rule
# with multiple targets:
#
# > all: a b
# > a b:
# > touch a b
#
# This code will run 'touch' rule twice when parallel
# make is used:
# > $ make -j
# > touch a b
# > touch a b
#
# But there is a workaround for it:
# We pick a single file of a group and depend on it
# as an ultimate target. We also need to make sure
# that file has latest timestamp in the group:
#
# > all: a b
# > b:
# > a: b
# > touch a b
# > touch $@
Supports Markdown
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