This site is built with one medium-complicated Makefile, and there are quite a few places where there is a mkdir in a recipe before some other file gets copied into place under /public/.

I managed to get rid of some of those.

Copy a file and create destination directory

Replace a mkdir and cp with install using the -D option to create the destination directory if needed. Before:

public/i/% : i/%
    mkdir -p public/i
    cp $< $@
    chmod 644 $@

After:

public/i/% : i/%
    install -m 644 -D $< $@

Create destination directory in a Python script

This is one extra line, using pathlib

Before opening the output file for writing,

    Path(outfile).parent.mkdir(parents=True, exist_ok=True)

This creates a Path object for the intended pathname of the output file, gets its parent directory, and makes that directory and all parents if it does not exist.

So I know this blog still starts a lot of processes to rebuild, but I got rid of a few.