[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: why does touching Makefile allow make to know how to build dependenc
From: |
Luke Shumaker |
Subject: |
Re: why does touching Makefile allow make to know how to build dependency? |
Date: |
Mon, 07 Mar 2011 16:18:13 -0500 |
I'm willing to write that off as a fault belonging to his email editor;
otherwise I would expect make to bork about a syntax error.
The problem is that recursive make doesn't track dependencies between
instances of make. However, it is hard to diagnose, because you have
fabricated the error message. I suspect that it is actually closer to
one of the following:
(example 1)
make: *** No rule to make target `subdir/outfile', needed by
`subdir/anotherFile'. Stop.
(example 2)
make[1]: *** No rule to make target `outfile', needed by `anotherFile'. Stop
make[1]: Leaving directory `/path/to/subdir'
If it is closer to example 2, I have no idea.
If it is closer to example 1, the problem is that it doesn't know to
look in subdir/Makefile for the dependencies. You probably have
something like this in the top-level Makefile:
subdir/%: subdir/Makefile
$(MAKE) -C subdir $*
Fix this by changing it to
subdir/%: subdir/ subdir/Makefile
$(MAKE) -C subdir $*
This way, subdir/Makefile will be checked whenever anything in subdir/
changes, not just when subdir/Makefile changes. Leaving the
subdir/Makefile bit prevents it from going into non-make directories.
I hope this helps.
--
~ LukeShu
http://lukeshu.ath.cx
On Fri, 2011-03-04 at 10:45 +0100, Erik Rull wrote:
> Graham Menhennitt wrote:
> > In a Makefile in a subdirectory of our top level directory, I have some
> > rules:
> >
> >
> > outfile: infile
> >
> > cmd< infile> outfile
> >
> >
> >
cmd < infile > outfile
> > anotherFile: outfile
> >
>
> Have you considered newlines and tabs set correctly?
>
> It should look like this:
> outfile: infile
> cmd < infile > outfile
> (where the spaces before cmd must be a tab char!)
> No blank line between the first and the second line.
>
> > Regards,
> >
> > Graham
>
> Best regards,
>
> Erik
>
> _______________________________________________
> Help-make mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/help-make