help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

FEATURE:? binding variables to prerequisites


From: Cook, Malcolm
Subject: FEATURE:? binding variables to prerequisites
Date: Fri, 22 Jan 2021 21:18:44 +0000

Hi Paul et. al.,

When a rule has multiple prerequisites I sometimes use make variables to refer 
to them positionally, like this:

^1=$(word 1,$^)
^2=$(word 2,$^)
^3=$(word 3,$^)
^2..=$(wordlist 2,$(words $^),$^)
^3..=$(wordlist 3,$(words $^),$^)

%.foo: %.bar %.baz %.bat1 %.bat2 %.bat3
        process --baz ${^2}--bar ${^1} --bat ${^3..} > $@

What do you think of such syntactic sugar?  

Is there any sweeter version?

Is there some way to bind pattern specific variables to prerequisite using some 
syntax allowing rules such as: 

%.foo: a:=%.bar b:=%.baz c:=%.bat1 %.bat2 %.bat3
        process --baz ${b}--bar ${a} --bat ${c} > $@

Might this be candidate for a new feature request?  Are there any other similar 
such ideas percolating?

FWIW - I mainly use make to structure bioinformatics analysis pipelines.

Cheers,

Malcolm Cook
Manager, Database Applications
Big Data AI and GenomicsĀ 
Stowers Institute for Medical Research




reply via email to

[Prev in Thread] Current Thread [Next in Thread]