Commit 09ff6a25 authored by Yuto KAWAMURA(kawamuray)'s avatar Yuto KAWAMURA(kawamuray) Committed by Petr Pudlak

Fix broken haskell dependencies

Fixes issues 758 and 912.
Since ghc -M does not generate inter object dependency rule for object
files, dependencies from a target executable seed object
(e.g. src/hluxid.o) to objects which finally will be linked to the
target object (e.g. src/Ganeti/Daemon.o) are missing in Makefile.ghc.
For instance, following commands will not rebuild src/hluxid inspite of
its dependent object src/Ganeti/Daemon.o has been updated.

    $ make # rebuild all once
    $ touch src/Ganeti/Daemon.hs
    $ make # this will rebuild src/Ganeti/Daemon.o, not src/hluxid.o

This patch adds simple substitution code after the Makefile.ghc
generation to add additional inter object dependency for all object
files to force relink related objects when a linked object has been
updated.
Signed-off-by: default avatarYuto KAWAMURA(kawamuray) <kawamuray.dadada@gmail.com>
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarPetr Pudlak <pudlak@google.com>
parent cd0d5ce5
......@@ -1041,6 +1041,17 @@ Makefile.ghc: $(HS_MAKEFILE_GHC_SRCS) Makefile \
| $(built_base_sources) $(HS_BUILT_SRCS)
$(GHC) -M -dep-makefile $@ -dep-suffix $(HTEST_SUFFIX) $(HFLAGS) -itest/hs \
$(HS_PARALLEL3) $(HS_REGEX_PCRE) $(HEXTRA_COMBINED) $(HS_MAKEFILE_GHC_SRCS)
# Since ghc -M does not generate dependency line for object files, dependencies
# from a target executable seed object (e.g. src/hluxid.o) to objects which
# finally will be linked to the target object (e.g. src/Ganeti/Daemon.o) are
# missing in Makefile.ghc.
# see: https://www.haskell.org/ghc/docs/7.6.2/html/users_guide/separate-compilation.html#makefile-dependencies
# Following substitutions will add dependencies between object files which
# corresponds to the interface file already there as a dependency for each
# object listed in Makefile.ghc.
# e.g. src/hluxid.o : src/Ganeti/Daemon.hi
# => src/hluxid.o : src/Ganeti/Daemon.hi src/Ganeti/Daemon.o
sed -i -re 's/([^ ]+)\.hi$$/\1.hi \1.o/' $@
@include_makefile_ghc@
......
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