bmake and .USEBEFORE
Simon J. Gerraty
sjg at juniper.net
Sat Jan 31 16:59:47 UTC 2015
Julian Elischer <julian at freebsd.org> wrote:
> On 1/28/15 1:41 PM, Julian Elischer wrote:
> > If I try the following:
> >
> > bar: .USE
> > @echo @ = $(@)
> > all: bar
> > @echo here is all
> oops
> the failing example should be .USEBEFORE.. I pasted the wrong clip.
> >
> > I always get "bar is up to date"
If you put all: as the first target or add
.MAIN: all
or explicitly do make all
you will get the output you expect.
As is; 'bar' is the default target but it's .USEBEFORE
which doesn't make a lot of sense (sort of being applied to itself ;-)
It would probably make sense for .USE* to imply .NOTMAIN.
Anyway, to illustrate the purpose of .USEBEFORE consider:
--------------------8<--------------------
.MAIN: all
u1: .USE
@echo u1 $@
u2: .USE
@echo u2 $@
ub: .USEBEFORE
@echo; echo ub $@
all: foo1 foo2 foo3
foo1: u1 u2 ub
foo2: u2 ub u1
foo3: u2 u1 ub
--------------------8<--------------------
when this makefile is run the output is
ub foo1
u1 foo1
u2 foo1
ub foo2
u2 foo2
u1 foo2
ub foo3
u2 foo3
u1 foo3
note that u1 and u2 are applied in the order given, but ub is always
done first.
More information about the freebsd-current
mailing list