[Haskell-cafe] GHC: Discovery of source dependencies without --make
Lars Hupel
lars at hupel.info
Mon Nov 24 20:28:48 UTC 2014
Hi everyone,
I've got another problem in our – admittedly complex – build process
(for context, see [0]).
Anyway, I'm struggling with the following: I have an 'out' folder which
contains .hi and .o files from previous compilation stages. I now want
to compile a bunch of .hs files which depend on the modules from
previous stages. I can just say
ghc -c -iout -outputdir out File1.hs File2.hs ...
which works nicely if File*.hs are independent of each other, or are
already topologically sorted wrt dependencies. If not, compilation of
'File1.hs' will fail when importing 'File2'.
However, I can't make it to work if I don't know their precise ordering
in advance. I tried
ghc -c --make -iout -outputdir out ...
but apparently '--make' makes GHC ignore .hi files in the 'out' folder.
(Not even '-hidir' makes it respect them.) Reading a bit further, I
discovered the '-M' flag, however, not only does it output
Makefile-formatted output, it also ignores .hi files.
Is there any way to get the dependency discovery of '--make' without the
rest? Or alternatively, to get '--make' to not just respect source files
[1]?
I know I could probably make it work if I made a package out of the
previous build products, but I really want to avoid that in order to not
increase the build complexity even further.
Cheers
Lars
[0] <http://article.gmane.org/gmane.comp.lang.haskell.cafe/113016>
[1] After reading the section on "the search path" (§4.7.3,
<https://downloads.haskell.org/~ghc/7.6.3/docs/html/users_guide/separate-compilation.html#search-path>),
that doesn't seem to be possible.
More information about the Haskell-Cafe
mailing list