help-gnu-utils
[Top][All Lists]
Advanced

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

Re: include of include


From: Eric
Subject: Re: include of include
Date: Tue, 15 Sep 2009 00:26:29 -0700 (PDT)
User-agent: G2/1.0

On Sep 14, 11:49 pm, Henrik Carlqvist <Henrik.Carlqv...@deadspam.com>
wrote:
> No, ./ means your current directory, not the directory of your last
> included file.
>
> > Now that I witnessed this strange include methods, does someone have an
> > idea how I could solve my problem?
>
> You could move instrdeps.rule to your current directory which probably is
> application/models/BD or you could give the relative path to
> ../../services/makerules/instrdeps.rule

Hi Henrik,

thanks for your answer, I understand that ./ is the cwd, even if I
include a file which includes another file... Nevertheless we have to
be careful when including makefiles which include other makefile,
since the relative path has to be given from the cwd, which in my case
could be several paths locations.

I would like to spare the operations like:
oldcwd=`pwd`
cd ../../services/makerules
include ./check.rule
cd ${oldcwd}

and as I said before, it becomes tricky as soon as the include call to
check.rule is changing, imagine:

application/services/makerules/check.rule:
[...]
include ./instrdeps.rule
include ../otherrules/example.rule # the file to include is located in
application/services/otherrules/ dir.
[...]

application/services/makerules/instrdeps.rule
[...]

application/models/BD/Makefile:
[...]
include ../../services/makerules/check.rule
[...]

application/models/Makefile:
[...]
include ../services/makerules/check.rule
[...]

as the check.rule can be included from 2 different location: models/
Makefile and models/BD/Makefile, the check.rule does not have just one
possibility for including the "instrdeps.rule" file. (../../services/
makerules/instrdeps.rule and ../services/makerules/instrdeps.rule)
what about the include of "example.rule" ? (../../services/otherrules/
example.rule and ../services/otherrules/example.rule are the
possibilities)

it would be much more elegant and human readable if we could specify
an include from the current file location, let's say not ./ anymore
but something like -/ or !/
anyway for the moment I use the -include which ignores error when a
file could not be included... Meaning check.rule has the following
include calls:

-include ../../services/makerules/instrdeps.rule
-include ../services/makerules/instrdeps.rule

Best Regards
--
Eric



reply via email to

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