make clean 中的 clean
rm 命令后面记得加 -f 选项,否则如果文件不存在就会出错导致 make 就会失败
goal: file1 file2 ...
command1
command2
.f90.o:
gfortran -c $<
其中 $< 是 auto variable 中的一个(见 10.5.3 Automatic Variables),在执行的时候被替换成 : 右边的第一个 dependency.现在如果有
file1.o: file1.f90 file2.o file3.o
那么应该会执行 gfortran -c file1.f90.另外,如果 “file2.o” 或 “file3.o” 被更新了,这条命令应该也会再执行一次.
$^ 列出所有的 prerequisites (“:” 右边的内容)
$(shell ...) 可以执行 shell 命令,如 $(shell echo *.f90) 可以在当前位置列出所有 “.f90” 文件.
$@ 大概就是 target file(如果 “:” 左边只有一个文件的话)