clawpack / clawutil

General utility programs
BSD 3-Clause "New" or "Revised" License
10 stars 31 forks source link

Rules to make .o files inadequate when both .f and .f90 files are present #50

Open rjleveque opened 11 years ago

rjleveque commented 11 years ago

In clawutil/src/Makefile.common, the rules

OBJECTS = $(subst .F,.o, $(subst .F90,.o, $(subst .f,.o, $(subst .f90,.o, $(SOURCES))))) %.o : %.f90 ; $(CLAW_FC) -c $< $(ALL_INCLUDE) $(ALL_FFLAGS) -o $@ %.o : %.f ; $(CLAW_FC) -c $< $(ALL_INCLUDE) $(ALL_FFLAGS) -o $@

were written assuming there might be either a file fname.f or fname.f90 but not both. If both are present and only one is listed in the Makefile, the wrong one might be compiled.

This sometimes bites us when updating a file from .f to .f90 form and the old one is still present.

ahmadia commented 11 years ago

What's the desired behavior here? You could try switching the order of the pattern rules to match, but I suggest you explicitly specify SOURCES instead of using a glob :)

mandli commented 11 years ago

The line with the OBJECTS definition preferences f90 source before f when making the object list. As Aron pointed out, unless we go back to specifying the object list as well as the source list we have to make some compromise like this.