Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 31 Jan 2015 08:59:39 -0800
From:      "Simon J. Gerraty" <sjg@juniper.net>
To:        Julian Elischer <julian@freebsd.org>
Cc:        "current@freebsd.org" <current@freebsd.org>
Subject:   Re: bmake and .USEBEFORE
Message-ID:  <20656.1422723579@chaos>
In-Reply-To: <54C878BD.1090805@freebsd.org>
References:  <54C876A1.20105@freebsd.org> <54C878BD.1090805@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Julian Elischer <julian@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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20656.1422723579>