1. 6

Does anyone have any favorite toy implementations?

  1. 6

    The thing which comes to mind is https://github.com/apenwarr/redo; it’s not make and not toy, but interesting!

    1. 1

      I second this, it’s such a pleasure to use it once you grok it. I have used it for my masters thesis for the experimental setup, which turned out to be a huge help.

      Although I have to admit that having only the granularity up to a file was sometimes not enough as a simple change in one file could cause a rerun of the entire experiment eventually the code in question was not changed at all. But all in all I recommend it and I am a bit annoyed that I haven’t set it up for my current work.

      1. 4

        I’m pretty sure Kernighan does a toy make in awk in this classic book:


        (maybe you can find it at the library, etc.)

        I transcribed it into Python many years ago (and thus learned a bunch of awk).

        1. 3

          Very nice. Looks like internet archive has several copies:


          1. 3

            Oh cool… I definitely recommend this book, it’s thin and packed with information. One of the few programming books I can say I’ve read more or less cover to cover. Although it’s aged, Awk is still useful, and it’s one of the few languages that fits in your head!

        2. 3

          I’ve been working on my own toy version of make for a while, available here .

          There’s lots of UNIX versions out there that are quite capable; my goal was to improve on Windows-based NMAKE, which is ancient in comparison, but also has some different grammar and features. The most pressing thing was multiprocessor support, and second to that was to improve on recursive directory handling.

          Mine loads many makefiles from different directories, translates all of the targets into fully qualified paths, so individual files can refer to objects from different directories, and execution follows the dependency graph. I’m happy enough with the result - it takes ~200ms to parse all of the makefiles, but subsequent execution efficiency is high, and each directory can still be built independently or as part of the global graph.

          Discovering and reimplementing all of the various hidden quirks has been challenging though. NMAKE documentation is pretty scarce, and every time I run it against a new project I end up finding new tasks to complete.

          1. 3

            Not really toy implementations but ninja is make if make was good and samurai is a smaller reimplementation of ninja.

            1. 3

              This paper is a nice overview of build system implementation such as Make though included code is in Haskell, so caveat emptor. “Build Systems à la Carte” https://www.microsoft.com/en-us/research/uploads/prod/2018/03/build-systems.pdf

              1. 2


                Pure Python implementation of make (note: Makefiles are written in Python too) written to support cross-platform development some time ago.