Re: bmake and .USEBEFORE

From: Simon J. Gerraty <sjg_at_juniper.net>
Date: Sat, 31 Jan 2015 08:59:39 -0800
Julian Elischer <julian_at_freebsd.org> wrote:

> On 1/28/15 1:41 PM, Julian Elischer wrote:
> > If I try the following:
> >
> > bar: .USE
> >         _at_echo _at_ = $(_at_)
> > all: bar
> >         _at_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
        _at_echo u1 $_at_

u2:     .USE
        _at_echo u2 $_at_

ub:     .USEBEFORE
        _at_echo; echo ub $_at_

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.
Received on Sat Jan 31 2015 - 15:59:47 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:55 UTC