On Thu, Aug 29, 2019 at 01:04:07PM +0200, Marc Espie wrote:
> After some musings, I realized I just had to reorder a few things to
> make MAKEOBJDIR way more powerful (and possibly useful)
>
> The idea here is to init vars early, which is easy, and to set up
> .CURDIR, MACHINE, MACHINE_ARCH, MACHINE_CPU, so that
> MAKEOBJDIR can actually become a full-blown make expression.
>
> e.g., with this something like
>
> MAKEOBJDIR='${.CURDIR}:S/src/obj/}'
>
> will work.
>
> any takers ?
I did a make regress without problems.
Although I have no use for the feature, why not.
OK bluhm@
> - if ((path = getenv("MAKEOBJDIR")) == NULL) {
> + Var_Set(".CURDIR", d->current);
> + if ((path = getenv("MAKEOBJDIR")) == NULL)
> path = _PATH_OBJDIR;
> - }
> + /* if there's a $ in there, allow substitution */
> + else if (strchr(path, '$'))
I would keep the { } around the if block. Technically not neccessary
as one of the two lines is a comment, but it looks odd anyway.