tech-pkg archive

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

bmake: : vs :: and :?



I suppose my question may as well be asked in tech-toolchain, but first its
devel/bmake and second pkgsrc seems to be the single largest bmake application,
so I suppose knowledgeable people here.

My first question (probably a documentation issue) is about : vs ::.
I thought (and ws@ taught me) that :: was for things like

default:: install

.if(have_foo)
default:: install_foo
.endif
.if(have_bar)
default:: install_bar
.endif

so I would expect

default: x

default: y

to give syntax error, which it doesn't.
OTOH, man bmake says

Sources for a target accumulate over dependency lines [for :]
and
Sources for a target do not accumulate over dependency lines [for ::]

Also, I can't tell a difference in the behavior of : and :: other than that ::
with no dependencies always rebuilds the target while : only rebuilds if the
target doesn't exist.

Can someone enlighten me? Am I misunderstanding something?


My second question is about the intended use of the :? modifier.
At a glance, it looks most useful in situations like

.for i in foo bar ding dong ...
dir/${i}: ...
        ...
        install -m <mode> ...
.endfor

where <mode> is, i.e. 644 except for target bar, where it's 600.
However, I can't figure out how to deal with this without using empty(), which
seems to be evaluated only once, during parsing, like conditionals are.
Yes, I could use

.for i m in foo 644 bar 600 ding 644 dong 644 ...

an I have an even weirder solution using several :C modifiers.

Any hints?



Home | Main Index | Thread Index | Old Index