NetBSD-Users archive

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

Re: make-dependency with multiple targets



On Wed, Apr 02, 2008 at 07:42:41PM +0200, Petar Bogdanovic wrote:
> 
> I'm just doing my first steps with make(1). The following Makefile
> should create some postfix maps upon invocation:
> 
>       MAPS = client sender
> 
>       ${MAPS:S/$/.db/g}: ${MAPS}
>               postmap ${.ALLSRC}
> 
> This does work pretty well but if nothing has to be done, make confuses
> me with an inconsistent message:
> 
>       `client.db' is up to date.
> 

This is equivalent to this:

        client.db sender.db: client sender
                postmap client sender

The default target is just the first named target -- in this case,
``client.db''.

You probably want:

        MAPS=   client sender

        all: ${MAPS:S/$/.db/}

        .for map in MAPS
        ${map}.db: ${map}
                postmap ${map}
        .endfor

This is equivalent to:

        all: client.db sender.db

        client.db: client
                postmap client

        sender.db: sender
                postmap sender

Then just typing ``make'' will invoke the ``all'' target, which will
ensure that both the client.db and sender.db are current.

        Cheers,

        -- Johnny C. Lam


Home | Main Index | Thread Index | Old Index