On 08/31/18 03:23, Kristaps Dzonsons wrote:
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?
Your example and request aren't clear to me.
Do you mean you have index000.xml, index001.xml, ... index999.xml
and you want index000.html, index001.html, ... index999.html
such that if you touch *any* .xml you want to compile *all* the xml
to produce *all* the html?
You can introduce a set of proxy files to represent the dates
of the xml files.
.suffixes .xml .dummy
.xml.dummy:
<sblg command> *.xml
touch $@
Once you have the dummy files to represent individual dates,
you can use various make variables ($<, etc), pattern matching
and substitution functions to produce filenames.
If this isn't what you want I can't understand your question.
The gnu-style makefile doesn't make sense to me and I've used
the % feature in gmake.
If I were doing your project I would work *very* hard
to work around the many-to-many dependency.
Geoff Steckel