bug-make
[Top][All Lists]
Advanced

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

Re: Management for relative paths in global build parameters


From: Duane Griffin
Subject: Re: Management for relative paths in global build parameters
Date: Thu, 8 Jun 2017 11:54:30 +1200

Hi Markus,

I'm not entirely sure what you are asking, so apologies if I'm telling
you things you already know...

Relative paths are fine when including makefiles from sub-directories.
What matters is that targets use *consistent* paths. You can't safely
refer to the same target with a relative and an absolute path (or two
different relative ones). As long as that requirement is met it
doesn't matter whether paths are relative or absolute. So as long as
your relative paths are relative *to the same thing* it is fine. I.e.
don't do this:

Makefile in foo:
DIR := $(TOP)/foo
foo: $(DIR)/../baz

Makefile in bar:
DIR := $(TOP)/bar
bar := $(DIR)/../baz

That gives you two "baz" targets that point to the same file. Instead do this:

foo: $(TOP)/baz
bar: $(TOP)/baz

Now there is just one "baz" target, make will only build it once, and
you aren't going to get nasty intermittent errors with parallel
builds. This has caused bugs for us in the past. In practice we've
fixed it pretty much by just ensuring that dependencies don't include
"..". I've found that to be straight-forward (in a system with ~20k
LoC in over 200 makefiles).

This assumes your make system is non-recursive, of course. Otherwise
you have more to worry about (and not just wrt to this).

Cheers,
Duane.

On Thu, Jun 8, 2017 at 3:13 AM, SF Markus Elfring
<address@hidden> wrote:
> Hello,
>
> Software development projects can grow in the way that corresponding 
> components
> will be stored in several subdirectories. Such a project organisation has got
> consequences on the management of some dependencies.
>
> Now I am looking for advanced support possibilities by the make software
> once more.
>
> Components in these subdirectories will usually need some information also 
> from
> the global build system settings. A portion of the involved configuration
> variables will eventually store relative paths.
> I imagine that desired data processing for them can trigger special 
> development
> challenges then.
> How do you prefer to achieve consistent and safe access for paths across
> the directory hierarchy?
>
> I looked at the possibility to convert such data into absolute paths (by the
> function “abspath” for example).
> But make variables do not directly support higher level data structures for 
> the
> transformation of passed build parameters in the way I would find convenient.
>
> How portable can extensions become for the provided function library?
>
> Regards,
> Markus
>
> _______________________________________________
> Bug-make mailing list
> address@hidden
> https://lists.gnu.org/mailman/listinfo/bug-make



-- 
"I never could learn to drink that blood and call it wine" - Bob Dylan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]