help-make
[Top][All Lists]
Advanced

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

Problems with VPATH and custom rules


From: Alberto Luaces
Subject: Problems with VPATH and custom rules
Date: Mon, 12 Nov 2007 12:52:49 +0100
User-agent: KMail/1.9.7

Hello,

I'm having trouble when trying to build some files stored on a subdirectory. 
The problem arises when the file to be built depends on a custom building 
rule. I have created a testcase, here are the items on my system:

.:
B  Makefile  c.f90

./B:
a.cpp  b.f90

This is my Makefile:

VPATH = B

FORTRAN = gfortran-4.2
FFLAGS = -ffree-line-length-none -g -fopenmp

%.o: %.[fF]90
        $(FORTRAN) -c $(FFLAGS) $<

programa: a.o c.o b.o
        g++ $^ -o programa

clean:
        rm a.o b.o c.o programa

As you can see, I have a custom rule to build the Fortran objects. Everything 
goes well except the file located inside the 'B' directory:

$ make
g++    -c -o a.o B/a.cpp
gfortran-4.2 -c -ffree-line-length-none -g -fopenmp c.f90
make: *** No rule to make target `b.o', needed by `programa'.  Stop.

Notice that the error only appears when dealing with custom rules and outside 
directories.

I have searched the web and the mailing list and I couldn't find anything 
similar. Where could be the error?

$ make -v
GNU Make 3.81
Copyright (C) 2006  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
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu

$ uname -a
Linux 2.6.22-2-amd64 #1 SMP Thu Aug 30 23:43:59 UTC 2007 x86_64 GNU/Linux

Thank you in advance,

Alberto




reply via email to

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