Posts

Showing posts from January, 2019

Build Haskell projects using Make

Make has been around for a long time . It does, however, have a moderate learning curve. Once you understand and overcome some of its idiosyncrasies, it is a very powerful generic build tool. Below are my variants for building Haskell projects using make. Most of my projects now use Stack . Even so, having a Makefile helps to coordinate building project artefacts. It becomes an organising script for the project. A full description on building modules can be found in the chapter Using Make in the GHC documentation . For a single target, you can use make to build a Haskell project. Make is whitespace sensitive. You must use tabs. The default is to use a tab setting of 8 spaces. GHC Below is a version using just GHC for compilation. We are defining a custom pattern to build from Haskell source (.hs) to an object (.o). This rule is cheating, as the end result is actually a executable, but as I didn't want to add a .exe extension, we are 'faking' it with ...