diff options
author | Sergei Trofimovich <siarheit@google.com> | 2015-12-05 00:03:05 +0000 |
---|---|---|
committer | Sergei Trofimovich <siarheit@google.com> | 2015-12-05 10:17:08 +0000 |
commit | d6512c740c653d2a58a7fc73b777e50d02f786b1 (patch) | |
tree | c5c6d6f331614660d8cd5b623fee7ea3c075da20 /utils | |
parent | 314bc99abfdf7dc6ece5813fdc2e4e1f1fdeb291 (diff) | |
download | haskell-d6512c740c653d2a58a7fc73b777e50d02f786b1.tar.gz |
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: Sergei Trofimovich <siarheit@google.com>
Diffstat (limited to 'utils')
-rw-r--r-- | utils/mkUserGuidePart/ghc.mk | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/utils/mkUserGuidePart/ghc.mk b/utils/mkUserGuidePart/ghc.mk index 86492e12f1..3a654da8ec 100644 --- a/utils/mkUserGuidePart/ghc.mk +++ b/utils/mkUserGuidePart/ghc.mk @@ -39,11 +39,18 @@ utils/mkUserGuidePart_GENERATED_FLAGS_SETS := \ verbosity \ 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))) \ - docs/users_guide/what_glasgow_exts_does.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_PACKAGE = mkUserGuidePart utils/mkUserGuidePart_dist_PROGNAME = mkUserGuidePart @@ -52,7 +59,36 @@ utils/mkUserGuidePart_dist_INSTALL_INPLACE = YES $(eval $(call build-prog,utils/mkUserGuidePart,dist,2)) $(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) + $(TOUCH_CMD) $@ 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 $@ |