[dev] requirements of build systems

From: Petros Pateros <petratman_AT_gmail.com>
Date: Mon, 31 Jan 2022 00:10:27 +0200

Hello, I hope you all are doing well.

Some time ago, I was using redo for building a C project, but redo, unlike make is
non-standard, so one needed a redo implementation to build the project. At the
time, redo implementations where either written in Python,Go or had annoying bugs
like creating a target even when it was phony. Also, it seemed to me that no
redo really reflected how powerful redo's simplicity is, so I tried implementing
it myself, resulting in baredo [0]. It should be stable enough to be used
in C projects without much effort, since a C compiler is already required.

However, it was pointed out to me that relying on mtime can give wrong results,
for example:
(a) if the clock is set backwards or in case of insufficient granularity in mtime
then a file that gets modified might have the same mtime
(b) an mmap(2)-ed file can get modified but its mtime might not get updated
soon enough

Various redo implementations store a hash of the file's contents so they can
safely decide if its contents have changed or not.

Personally, I find that mtime is reliable enough, (redo especially compares for

What would you expect from a build system? Should it trust mtime?
Is it responsible for verifing the file's contents for actual changes?
More generally, what are the key features that make a build system useful?

For example,
        - handles filenames correctly (including those with spaces and
        newlines). This depends on the scripts respecting that
        - can use any executable as building "script"
        - does no macro processing etc. and instead leaves that to the
        .do file
        - flexible/easy dependencies declartions, redo doesn't need to know
        the whole dependency tree in advance, e.g.
                redo-ifchange hdrs $(cat hdrs)
        - can handle dependencies for inexistent files
        - each target is treated the same independently of who requires it
        - creates its targets atomically
        - it basically does only dependecy checking and executing the .do files
        so it is needs few code
        - easilly supports building targets in parallel without issues
        - has standardized behavior
        - depends on error-prone mtime comparisons
        - doesn't support filenames with spaces (feel free to correct me)

I'm interested in hearing your opinions/experiences about building systems
in general.


[0] https://github.com/gotroyb127/baredo
Received on Sun Jan 30 2022 - 23:10:27 CET

This archive was generated by hypermail 2.3.0 : Sun Jan 30 2022 - 23:12:07 CET