Make in Prolog 2: Hashes
Part two of Make in Prolog. This is extending the make implementation with using hashes of inputs instead of modification time for out-of-date detection.
Path Patterns
But first, a discussion on matching on paths. In the previous implementation I used a representation of paths that has some flags in it. Let me show the pathology by studying a few simple paths.
- The simplest is
main.cpp, which doesn’t work in the build system because we use the patternDirs/Fileso you have to use'.'/main.cpp. - The
path_segments_atomtranslates into a left-associative(a/b)/cwhich is contrary to expectations and actual the filesystem hierarchy. (Which isa/(b/c)to be clear). This makes matching on filenames easy but makes adding a root directory (or checking the root directory) inconvenient.
The first issue is going away here as we will put the sources into the src
directory (and use build for build files).
Make in Prolog
This turned out to be a long post, so here is an outline.
Make in Prolog code at https://git.kovirobi.uk/kovirobi/prolog-make.
I have maintained for a long time that Prolog and Makefiles are very similar, recently I spent some time showing this is so. Let’s explore this. The similarity comes from the way they both operate, looking at a database of facts, trying to prove what the user asked.