help-make
[Top][All Lists]
Advanced

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

Re: targets built to an "output" directory.


From: Ken Smith
Subject: Re: targets built to an "output" directory.
Date: Sat, 18 Sep 2004 13:08:01 -0400
User-agent: Mutt/1.5.6i

On Sat, Sep 18, 2004 at 12:07:02PM +0900, Ian Dunbar wrote:

> The pre-requisite doesn't exist in either case, so I don't really see how it
> can cause failure in one case, and success in another.

There must be a rule to make the prerequisite in one case and not the other.

> I am not trying to make more than one "OUTDIR" in any invocation of make, so
> it doesn't need more than one pre-requisite at a time, and I think I have
> rules to make the pre-requisite from the initial file, or am I missing
> something?
> 
> At the start I have one file existing: "src/a.txt.conf.lang.arch" and one
> phony target "default" that requires "${OUTDIR}/conf/lang/arch/a.txt" to be
> made.
> 
> I have rules to make:
> 
> ${OUTDIR}/arch/a.txt.conf.lang from a.txt.conf.lang.arch (which can be got
> so long as src is in VPATH)
> ${OUTDIR}/lang/arch/a.txt.conf from arch/a.txt.conf.lang (which can be made
> from the previous rule so long as ${OUTDIR} is in VPATH)
> ${OUTDIR}/conf/lang/arch/a.txt from lang/arch/a.txt.conf (which can be made
> from the previous rule so long as ${OUTDIR} is in VPATH)
> default: whose prerequisites are satisfied if the previous rule is made.

It sounds like you have thought about the various possibilities but this
is a pretty complicated way to run a build.  Perhaps there is another
simpler approach that you could take.  You may already have seen it but
I think that you might be able to glean some good advice from Paul's
VPATH tips.

http://make.paulandlesley.org/vpath.html

> >From what I see I have a chain of rules going from default to the
> pre-existing file, so make should be able make it. And make does make it, so
> long as OUTDIR=.
> 
> Either I have misunderstood the use of VPATH, the use of variables in
> pattern rules, or I am missing something else obvious.

The solution to subtle dependency issues in gmake is often the opposite
of obvious.  Here are some general tips I can give since I can't seem to
be able to figure out a specific solution.

1) Rethink your assumptions. (good advice from Noel Y.)
2) Keep in mind that Gmake uses simple string matching to apply the
rules.  Small differences in the strings can cause a rule not to apply.
3) 'gmake -p' is your friend.  You may be able to print the database for
both BUILDDIR=. and BUILDDIR=build and compare the resultant rules.
This might make the problem obvious.

Best of luck,
Ken




reply via email to

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