List Info

Thread: Problems with VPATH and custom rules




Problems with VPATH and custom rules
country flaguser name
Spain
2007-11-12 05:52:49
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


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

Re: Problems with VPATH and custom rules
country flaguser name
Israel
2007-11-12 14:40:16
> From: Alberto Luaces <aluacesudc.es>
> Date: Mon, 12 Nov 2007 12:52:49 +0100
> 
> %.o: %.[fF]90

Does it help to replace the above with this:

%.o: %.f90

?


_______________________________________________
Help-make mailing list
Help-makegnu.org
http:
//lists.gnu.org/mailman/listinfo/help-make

Re: Problems with VPATH and custom rules
country flaguser name
Spain
2007-11-13 02:50:53
EL MONDAY 12 NOVEMBER 2007 21:40:16 ELI ZARETSKII ESCRIBIó:
> > FROM: ALBERTO LUACES
> > DATE: MON, 12 NOV 2007 12:52:49 +0100
> >
> > %.O: %.[FF]90
>
> DOES IT HELP TO REPLACE THE ABOVE WITH THIS:
>
> %.O: %.F90
>
> ?

YES, IT WORKS! I DID THAT BECAUSE MY CODE CAME FROM WINDOWS,
SO I HAD MIXED 
CASE FILENAME EXTENSIONS. I THINK THAT I WILL SET AN
ADDITIONAL RULE FOR F90 
FILES INSTEAD OF MY ORIGINAL MIXED ONE.

THANK YOU VERY MUCH.


_______________________________________________
HELP-MAKE MAILING LIST
HELP-MAKEGNU.ORG
HTTP://LISTS.GNU.ORG/MAILMAN/LISTINFO/HELP-MAKE

[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )