help-make
[Top][All Lists]
Advanced

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

Re: setting a make "include" path right from the get-go


From: Robert P. J. Day
Subject: Re: setting a make "include" path right from the get-go
Date: Tue, 9 Dec 2008 07:55:11 -0500 (EST)
User-agent: Alpine 2.00 (LFD 1167 2008-08-23)

On Tue, 9 Dec 2008, Sam Ravnborg wrote:

> >
> >   i want to clean all that up and have make use an include-dir path
> > and be able to change all of the above to, of course, the simpler:
> >
> >   include someutil.mak
>
> Why not just use:
>
> include $(call magic,someutil.mak)
>
> Where magic is a macro that based on a variabes passed
> or something decide on the directory to try.
>
> Something like this mockup for example:
> magic = $(if $(wildcard $(mydir)/$1),$(mydir)/$1, \
>             $(if $(wildcard $(anotherdir)/$1),$(anotherdir)/$1,NOTFOUND))
>
> mydir could be set recursively or could be the dir of Makefile or
> could be absolute.
> In other words the possibilities are many to fidn the dir.

  perhaps i'm just being thick, but i don't see how this solves the
problem.  sure, that "magic" macro would work fine.  but where would a
makefile get its definition?  it could get it via including a handy
makefile of macros.  and where would it find that handy makefile of
macros to include?  oh ...

  i would still like the ability to define something like
--include-dir at the top level, and have that option propagate
throughout my build to be used by all subsequent sub-makes.  can't
that be done?

rday

p.s.  as a top-level solution, i can set up the alias

  alias mymake="make -I..."

and tell everyone to use "mymake" from now on, so that's how i could
get my includes into that top-level makefile.  but it's the subsequent
propagation through all submakes that is still an issue.

  perhaps i should just set an environment variable and have everyone
do:

include ${MKFILESDIR}/handy.mak

but i still consider that aesthetically unpleasant.  i want people to
need to say nothing other than:

include handy.mak

--

========================================================================
Robert P. J. Day
Linux Consulting, Training and Annoying Kernel Pedantry:
    Have classroom, will lecture.

http://crashcourse.ca                          Waterloo, Ontario, CANADA
========================================================================




reply via email to

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