My students and I have developed some Haskell programs that import some
functionality from the GHC compiler -- in particular a number of modules
for manipulating Core. We can't figure out an elegant way to construct a
Makefile that will link our programs with all of the object files that it
needs from the compiler implementation

To be concrete, suppose that we have a single Haskell source file Main.hs
that imports CoreSyn. When we include the path to CoreSyn in a "-i" option
to ghc within a "standard" Makefile and execute "make depend", the
following dependency is added to the Makefile:

  Main.o : /home/lumberjacks2/krc/fptools/ghc/compiler/coreSyn/CoreSyn.hi

So far, so good. Now suppose we "make all". When ghc comes to the point of
trying to link Main.o, it cannot find the symbols exported by CoreSyn.o.
If we add CoreSyn.o to the line in the Makefile that is executed when
"make all" is called, then ghc can't find the symbols that CoreSyn.o
imports.  We can keep on adding .o files to this list until we enumerate
the transitive closure of all linked files, but we hope there is a better
way. 

How do we tell ghc to link our .o files with the transitive closure of a
root set of .o files from the compiler implementation? 

Thanks for any advice on this problem. 

- lyn -


Reply via email to