On Oct 2, 2008, at 11:55 PM, Stephan Beal wrote:

On Fri, Oct 3, 2008 at 8:00 AM, parth <[EMAIL PROTECTED]> wrote:
all: $(DEPENDENCIES) $(PROGRAM).cc
      g++ Maze.o Astar.cc -o $(PROGRAM)

See "Paul's 2nd Rule of Makefiles":

http://make.paulandlesley.org/rules.html#rule2

These rules are very interesting. I have a question about applying rule #3:
Life is simplest if the targets are built in the current working directory. Use VPATH to locate the sources from the objects directory, not to locate the objects from the sources directory.

I have a project with sources and the Makefile in, for example, /src/ project, and I need to place the object files and executables in /dst/ project. I'm not sure how to "locate the sources from the object directory" in this case. It would be possible to do a recursive make, I suppose:

        all:
                $(MAKE) -C /dst/project -f /src/project/Makefile 
all-in-dst-directory

Aside from that, I'm not sure how to force make to change its working directory, so that it was "locating the sources from the objects directory" — unless I'm misunderstanding the rule.

Thanks in advance for any insight.

Derek
[EMAIL PROTECTED]
_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to