# make rules

# I am sure that there must be a way of combining all the multiple
# rules that are identical apart from their suffices

# This is a list of allowed suffices
.SUFFIXES:  .mod .f .f90 .f95 .F .F90 .F95 .c .o

# This is a list of rules for generating .mod and .o files
%.mod %.o : %.f
	$(FC) $(FFLAGS) $(INC) -c $< -o objects/$*.o

%.mod %.o : %.f90
	$(FC) $(FFLAGS) $(INC) -c $< -o objects/$*.o

%.mod %.o : %.f95
	$(FC) $(FFLAGS) $(INC) -c $< -o objects/$*.o

%.mod %.o : %.F
	$(CPP) -P -C $(CPPFLAGS) $(INC) $< > tmp/$*.f;\
        $(FC) $(FFLAGS) -c tmp/$*.f -o objects/$*.o;

%.mod %.o : %.F90
	$(CPP) -P -C $(CPPFLAGS) $(INC) $< > tmp/$*.f90;\
        $(FC) $(FFLAGS) -c tmp/$*.f90 -o objects/$*.o;

%.mod %.o : %.F95
	$(CPP) -P -C $(CPPFLAGS) $(INC) $< > tmp/$*.f95;\
        $(FC) $(FFLAGS) -c tmp/$*.f95 -o objects/$*.o;

%.o : %.c
	$(CC) -c $(CPPFLAGS) $(CFLAGS) $(INC) $< -o objects/$*.o

