cake3

Third cake the Makefile EDSL

https://github.com/grwlf/cake3

Latest on Hackage:0.6.5

This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.

BSD-3-Clause licensed by Sergey Mironov
Maintained by [email protected]

Cake3 is a EDSL for building Makefiles, written in Haskell. With cake3, developer can write their build logic in Haskell, obtain clean and safe Makefile and distribute it among the non-Haskell-aware users. Currenly, GNU Make is the only backend supported.

Example program

module Cakefile where

import Development.Cake3
import Cakefile_P

cs = map file ["main.c", "second.c"]

main = writeMake (file "Makefile") $ do
  selfUpdate
  d <- rule $ do
    shell [cmd|gcc -M $cs -MF @(file "depend.mk")|]
  os <- forM cs $ \c -> do
    rule $ do
      shell [cmd| gcc -c $(extvar "CFLAGS") -o @(c.="o") $c |]
  elf <- rule $ do
    shell [cmd| gcc -o @(file "main.elf") $os |]
  rule $ do
    phony "all"
    depend elf
  includeMakefile d

Basic workflow

  • Install the cake3

  • Create Cakefile.hs in the project root

  • Build the application using cake3 script provided

  • Execute the application to obtain the Makefile

See the README on the GitHub https://github.com/grwlf/cake3 for more information. Distribution contains several example projects.