I had to integrate a haskell program into an existing make-based intrastructure this week. After a few false starts I managed to proxy to cabal through make with the following Makefile. I also added a feature to copy the binary created to a “bin” folder at the same level as the src folder. I’ve used the Haq example name from How to Write a Haskell Program and my cabal setup is similar to the one described there. Trying to compile Setup.lhs or anything more complicated is a mistake and I am assured that runhaskell is portable.
all: runhaskell Setup.lhs configure runhaskell Setup.lhs build cp dist/build/haq/haq ../bin/ clean: runhaskell Setup.lhs clean rm -rf ../bin/*