help-make
[Top][All Lists]
Advanced

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

Lower-casing filenames in pattern rules


From: Van Snyder
Subject: Lower-casing filenames in pattern rules
Date: Fri, 18 Apr 2008 19:34:23 -0700

To compile Fortran 90 programs, I'd like to use pattern rules.  Most
Fortran 90 compilers create a .mod file with a base name that is the
name of the module, all in lower case.  If I've used any upper-case
letters in the file name, even if it's otherwise identical (sans
extension) to the module name, I apparently can't use a pattern rule.

For example, I have a module named foo in a source file named Foo.f90:

foo.mod Foo.o: Foo.f90
        $(FC) -c $(FOPTS) -o Foo.o Foo.f90 -I MyModuleLibrary

and numerous other files with the same sort of rules.

To avoid compilation cascades I write my inter-module dependencies in
terms of .mod files, not .o files.  First I save the .mod file, then I
compile the source file.  Then I compare the new .mod file to the old
one.  If they're the same, I replace the new one with the old one, being
careful to preserve its time stamp.

This prevents compiling B.f90 if it accesses a.mod by use association,
and none of the interfaces in A.f90 have changed.  Of course, I get a
new .o file.

I tried

%.mod %.o: %.f90
        $(FC) -c $(FOPTS) -o $@ $< -I MuModuleLibrary

but "make foo.mod" says

make: *** No rule to make target `foo.mod'.  Stop.

"make Foo.o" works.

Is there a way to lower-case a filename as it works its way into or
through a pattern rule?

-- 
Van Snyder                    |  What fraction of Americans believe 
address@hidden       |  Wrestling is real and NASA is fake?
Any alleged opinions are my own and have not been approved or
disapproved by JPL, CalTech, NASA, the President, or anybody else.





reply via email to

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