Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 20 Jul 2002 17:45:30 +0100 (BST)
From:      Mark Valentine <mark@thuvia.demon.co.uk>
To:        Ruslan Ermilov <ru@freebsd.org>
Cc:        arch@freebsd.org
Subject:   Re: [POLL] need a good name for share/mk API versioning
Message-ID:  <200207201645.g6KGjUvS085419@dotar.thuvia.org>
In-Reply-To: <20020719074504.GC39934@sunbay.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> From: Ruslan Ermilov <ru@freebsd.org>
> Date: Fri 19 Jul, 2002
> Subject: Re: [POLL] need a good name for share/mk API versioning

> Yes, sys.mk is not the best place, but technically it's the only place
> sufficient for what I need, and I need some variable defined before we
> include bsd.lib.mk; this is only possible with sys.mk.

The real problem is a design issue with the FreeBSD build system, in that
the Makefile doesn't know which version of the bsd.*.mk files it's going
to get before it includes one of them.

    PARAMETER = some value

    .include <bsd.foo.mk>

A better design might have been to include build system default parameters
seperately:

    .include <bsd.sys.mk>

    .if defined(_WHATEVER_)
    PARAMETER = some value
    .else
    OTHERPARAMETER = other value
    .endif

    .include <bsd.foo.mk>

The present design assumes that make(1)'s ``?='' feature allowing defaults to
be set as "fallback" values is sufficient, but we now see that this isn't good
enough to cope with architectural changes (but supporting multiple build
system versions probably wasn't a design goal).

However, it's obviously too late to change every Makefile in the world to
correct that design issue now.

Putting information about bsd.*.mk in sys.mk, however, is also insufficient,
since sys.mk doesn't know which versions of bsd.*.mk the makefile will pick
up, if any (consider using ``-m'' or ``-I'' options to pick up bsd.*.mk from
a directory other than the one containing sys.mk, which should be legitimate).

One possible workaround might be to have sys.mk include a file defined by a
variable (if defined, perhaps in the environment), which for the FreeBSD build
system could be set to "bsd.sys.mk" or similar.  This allows any build system
to have a component included before the Makefile is read.

    .if defined(__BUILD_SYS_MK)
    .include "${__BUILD_SYS_MK}"
    .endif

If really needed for compatibility/POLA reasons, sys.mk could default the
variable:

    __BUILD_SYS_MK?=bsd.sys.mk

The user could set the variable to /dev/null to avoid the existing pollution
to his own build system.

This mechanism would allow the make.conf stuff, etc. to be moved out of sys.mk.

		Cheers,

		Mark.

-- 
Mark Valentine, Thuvia Labs <mark@thuvia.co.uk>       <http://www.thuvia.co.uk>;
"Tigers will do ANYTHING for a tuna fish sandwich."       Mark Valentine uses
"We're kind of stupid that way."   *munch* *munch*        and endorses FreeBSD
  -- <http://www.calvinandhobbes.com>;                  <http://www.freebsd.org>;

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




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