help-make
[Top][All Lists]
Advanced

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

Makefile question


From: Ole Amund Søvde
Subject: Makefile question
Date: Tue, 09 Mar 2010 10:27:33 +0100
User-agent: Thunderbird 2.0.0.23 (X11/20090812)




Dear Gnu-guys,

I'd like to ask a question about make, and hope you could help me with
it. :-) Maye it's trivial, but I cannot seem to find out how to solve it...

I have some directories with fortran files, say
src/fil1.f
src/fil2.f
src2/fil2.f

where you can see fil2.f is in both directories.

I would like to list all files I want to compile in a variable:
SRCFILES = src/fil1.f src2/fil2.f

and compile them to a separate object directory:
OBJFILES = tmp/fil1.o tmp/fil2.o

Whether fil2.f is compiled from src/ or src2/ should therefore be
defined by SRCFILES.

Hopefully, something like this would be possible:
$(OBJFILES): $(SRCFILES)
        @echo "Compiling $< ... $@"

But I cannot make it work, and wonder if it is possible?



Cheers and thanks,
Amund Søvde
Department of Geosciences
University of Oslo
Norway





reply via email to

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