1.针对f77格式代码的,编译器f77
#setting of the compiler parameters
CC=f77
OBJECTS=main.o
TARGET=demo
CFLAGS=-c -g
#linking the objects
$(TARGET)(OBJECTS)
$(CC) -o $@ $^
#compiler the objects
%.o:%.f
$(CC) $(CFLAGS) -o $@ $^
#remove all the middle files and rubbish files
.PHONY:clean purge style
clean:
rm -f *.o *.*~ *~
purge:clean
rm -f $(TARGET)
2,针对f90格式代码的,编译器ifort(intel fortran compiler)
#cal some nucleus' half death time in fortran language.
#setting of the compiler parameters
CC=ifort
OBJECTS=main.o
TARGET=demo
CFLAGS=-c -g
#linking the objects
$(TARGET)(OBJECTS)
$(CC) -o $@ $^
#compiler the objects
%.o:%.f90
$(CC) $(CFLAGS) -o $@ $^
#remove all the middle files and rubbish files
.PHONY:clean purge
clean:
rm -f *.o *.*~ *~