You will need to have two separate rules: one for the .f
files and one for the .f90
files. For example:
TARGET := a.out
OBJFILES := foo.f bar.f90
OBJ := ./obj
%.o: %.f90
$(FC) $(FFLAGS) -c $< -o $(OBJ)/$@
%.o: %.f
$(FC) $(FFLAGS) -c $< -o $(OBJ)/$@
%(TARGET): $(OBJFILES)
$(FC) $(FFLAGS) -o $@ $(addprefix $(OBJ)/,$(OBJFILES))
or something similar should do the trick.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…