Library: makefile-edn

..

Idea - provide mappers from/to Makefiles

Makefile EDN spec

:comment Makefile comment with # string
:target Makefile target string
:dependencies Dependencies for makefile target sequence of strings
:commands Sequence of commands to produce target sequence of strings

Example makefile as EDN

(def makefile
  [{:comment "Generate target for root index"}
   ;; # Generate target for root index

   {:target "index.html"
    :dependencies ["index.clj" "aphorisms/index.html" "aphorisms/play.edn"]
    :commands ["./index.clj"]}
   ;; index.html: index.clj aphorisms/index.html aphorisms/play.edn
   ;;     ./index.clj

   {:target "aphorisms/index.html"
    :dependencies ["aphorisms/index.org"]
    :commands ["pandoc -s --shift-heading-level-by=1 --toc --from=org+smart -H live.html -i aphorisms/index.org -o aphorisms/index.html"]}
   ;; aphorisms/index.html: aphorisms/index.org
   ;;   pandoc -s --shift-heading-level-by=1 --toc --from=org+smart -H live.html -i aphorisms/index.org -o aphorisms/index.html
   ])

Library API

makefile-edn/<-makefile-str - read from makefile string makefile-edn/->makefile-str - write to makefile string

Usage

Either as Clojure library or as babashka script. Could perhaps just provide the library — then babashka pulls in the library as needed.