[Top][All Lists]

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

VPATH question

From: Ishan
Subject: VPATH question
Date: Fri, 4 Jan 2008 04:15:06 -0800 (PST)
User-agent: G2/1.0


I have two simple projects in the directory structure given below.

  | |
  | +-comp01/
  | | |
  | | +-Test01.h
  | | |
  | | +-Test01.cpp
  | | |
  | | +-main.cpp
  | | |
  | | +-Makefile

'child' project needs to build itself using the source from the
'parent' project. This is the Makefile of the 'child' project.

CC = g++

vpath %.cpp .:../../parent/comp01

comp01: main.o Test01.o
        $(CC) Test01.o main.o -o comp01

Test01.o: Test01.h Test01.cpp
        $(CC) -c Test01.cpp

main.o: main.cpp
        $(CC) -c main.cpp

        rm *.o comp01

When I try to build the component 01 (comp01) of the 'child' project,
I get the following error (output given by 'gmake --debug=v')

GNU Make 3.80
Copyright (C) 2002  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
Reading makefiles...
Reading makefile `Makefile'...
Updating goal targets....
Considering target file `comp01'.
 File `comp01' does not exist.
  Considering target file `main.o'.
   File `main.o' does not exist.
    Considering target file `main.cpp'.
     Finished prerequisites of target file `main.cpp'.
    No need to remake target `main.cpp'; using VPATH name `../../
   Finished prerequisites of target file `main.o'.
  Must remake target `main.o'.
g++ -c main.cpp
g++: main.cpp: No such file or directory
g++: no input files
gmake: *** [main.o] Error 1

Can somebody tell me what's wrong here?

My objective is to be able to extend the 'parent' project at the level
of the 'child' by adding some extra source files at the 'child' level.
But, before that I'm trying to just build 'parent' from inside


reply via email to

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