# Generating Makefiles with OCaml?

**URL:** <https://discuss.ocaml.org/t/generating-makefiles-with-ocaml/7711>\
**Category:** Ecosystem\
**Tags:** build\
**Created:** [April 20, 2021, 8:37pm UTC](https://discuss.ocaml.org/t/generating-makefiles-with-ocaml/7711 "2021-04-20T20:37:31Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![jeremiedimino](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/jeremiedimino/32/699_2.png) [@jeremiedimino](https://discuss.ocaml.org/u/jeremiedimino)\
**Post date:** [April 26, 2021, 8:44am UTC](https://discuss.ocaml.org/t/generating-makefiles-with-ocaml/7711/20 "2021-04-26T08:44:48Z")

</div>

> [@yawaramin](#):
>
> Has anyone ever tried to generate Makefiles for OCaml projects using OCaml itself?

Dune started as a makefile generator.

I wrote an OCaml program that was generating a Makefile for the [Base library](https://opensource.janestreet.com/base/) about 5 years ago. I then extended it to build more packages and after several months of work it became Jbuilder. It was a standalone tool that could build all Jane Street packages. Jbuilder then became Dune with the help of the community.

The original code of this Makefile generator can be found [here](https://github.com/janestreet/base/blob/05a3cdc443258e3e586c1bb9ac565836e9236a06/build/gen_rules.ml). The Dune repository still has a file called [gen\_rules.ml](https://github.com/ocaml/dune/blob/main/src/dune_rules/gen_rules.ml) today.

---

_[View the full topic](https://discuss.ocaml.org/t/generating-makefiles-with-ocaml/7711)._
