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: Garrett Cooper
Subject: Re: setting a make "include" path right from the get-go
Date: Tue, 9 Dec 2008 01:10:59 -0800

On Tue, Dec 9, 2008 at 12:35 AM, Robert P. J. Day <address@hidden> wrote:
> On Mon, 8 Dec 2008, Garrett Cooper wrote:
>
>> On Sun, Dec 7, 2008 at 5:49 AM, Robert P. J. Day <address@hidden> wrote:
>> > On Sun, 7 Dec 2008, Robert P. J. Day wrote:
>> >
>> >>
>> >>   i realize this is a trivial question but i just want to be
>> >> absolutely sure i'm doing this the right way.
>> >>
>> >>   i have a sizable recursive make structure and i want to add
>> >> "include"s in various makefiles to pull in useful "utility" makefiles
>> >> in various places.
>> >>
>> >>   i know the proper way to do that is to use the "-I" option on the
>> >> make invocation.  now, if my *top* level Makefile doesn't need to do
>> >> any includes, i'm fairly sure i can set the include search path in
>> >> that makefile, then use ${MAKE} from there on to make sure everyone
>> >> below picks up the search path.
>> >>
>> >>   if the top-level makefile *does* need that include search path, my
>> >> idea was to alias "make" to "make -I..." so that one doesn't need to
>> >> keep typing that option explicitly.
>> >>
>> >>   is that about right?  or is there a more elegant way to do this?
>> >> thanks.
>> >
>> >  i guess a simpler question (which i'm sure i know the answer to) is:
>> > a Makefile that wants to use the "include" directive can *not* set its
>> > own include search path -- only those of its sub-makes, correct?
>> >
>> > rday
>>
>> As I discovered last week, yes.
>
>  here's a clearer description of what i'm faced with.  i've been
> handed a sizable multi-level recursive make-based software repository,
> which takes advantage of including some useful utility makefiles
> throughout.  however, all of those includes *hardcode* the address of
> the utility makefile, as in
>
>  include ../../someutil.mak
>
>  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
>
> the question is how to set the include-dir at the top level, and have
> it percolate down through sub-make after sub-make.  many of the
> existing makefiles perform further makes just by running "make" when,
> at the very least, they should use ${MAKE}, but even that won't solve
> the problem.
>
>  is there a simple solution to somehow setting the include-dir value
> upon invocation and having it then apply throughout the recursive make
> structure?  yes, i have the freedom to go in and hack any makefiles i
> want.
>
> rday

Yes, that's the easiest way given Make's current configuration. I'd
really like an enhancement to this to allow for dynamic adding of
include directories from within Makefiles, but I don't think that
that's going to happen anytime soon.
-Garrett




reply via email to

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