Friday, August 31, 2018

make(1) and multiple outputs

Short: is there a way to manage multiple outputs from a single command
with OpenBSD's make(1)?

Longer story. I have a site that generates a few hundred articles using
sblg(1). Each output article is indexNNN.html, which depends upon every
input indexNNN.xml. So a change to any indexNNN.xml must result in
rebuilding all indexNNN.html using a single command.

In GNU make, I can use the pattern substring match to effect this:

all: index001.html index002.html

index001%html index002%html: index001.xml index002.xml
sblg -L index001.xml index002.xml

But obviously that's GNU-only. It is, as a fallback, possible to have
sblg(1) create one output per input and play nice with make(1):

index001.html: index001.xml index002.xml
sblg -C index001.xml index001.xml index002.xml

But with hundreds of articles (each of which depends upon parsing
hundreds of articles), those are a lot of wasted cycles.

I currently just use the GNU make, but I'd rather use only stock
components on the server. Any thoughts?

No comments:

Post a Comment