Skip to content

`ghc -M` doesn't emit dependencies for header files included either via CPP or CApiFFI

Given the following simple module

{-# LANGUAGE CPP, CApiFFI #-}

#include "Bar.hs.inc"

module Foo where

foreign import capi unsafe "cbits.h foo" c_foo :: Int -> IO ()

The dependency information produced by ghc -dep-suffix '' -M Foo.hs is

# DO NOT DELETE: Beginning of Haskell dependencies
Foo.o : Foo.hs
# DO NOT DELETE: End of Haskell dependencies

And neither mention the include header dependency cbits.h nor Bar.hs.inc.

See also https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/separate_compilation.html#makefile-dependencies

Edited by Herbert Valerio Riedel
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information