Use: vpath %.cc $(srcdir) and leave out all references to directories in the rules. See the make documentation for "vpath directive" and/or the VPATH variable. See also Paul's website at http://www.paulandlesley.org/gmake/vpath.html
HTH, Johan Bezem CSK Software AG Stefan Seefeld wrote: > > hi there, > > I have a Makefile covering not only the current directory > but also some subdirectories, i.e. the source code is in > various subdirectories. I'd like to generate the object files > such that the build tree is isomorphic to the source tree, > i.e. there is a trivial correspondance between the object file > name and the source file name... > Here is a snipped of the Makefile I attempted to use: > > srcdir := .. > > all: > foo.o Console/bar.o > > %.o: $(srcdir)/%.cc > @echo processing $^ > > #Console/%.o: $(srcdir)/Console/%.cc > # > @echo processing $^ > > It is my understanding that I shouldn't need a rule to explicitely > define how to make stuff in the Console/ subdirectory. (Thus is is > commented out above). This works indeed if I build in the source tree, > i.e. if 'srcdir == .' In all other cases I get > 'No rule to make target `Console/bar.o'' > > This problem is still present in the make 3.79.2a snapshot you sent me > last friday... > > Regards, > Stefan > > _______________________________________________ > Bug-make mailing list > [EMAIL PROTECTED] > http://mail.gnu.org/mailman/listinfo/bug-make _______________________________________________ Bug-make mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-make