为啥目标文件不能删除呢

sh/bash/dash/ksh/zsh等Shell脚本
回复
wnyh
帖子: 54
注册时间: 2011-11-24 9:00

为啥目标文件不能删除呢

#1

帖子 wnyh » 2012-04-25 16:16

下面是我现学现用的makefile
#!/bin/bash
obj=ligdr.o trimlen.o filesize.o
gdr:$(obj)
gfortran -o gdr ligdr.o trimlen.o filesize.o
ligdr.o : ligdr.f
gfortran -c ligdr.f
trimlen.o : trimlen.f
gfortran -c trimlen.f
filesize.o:filesize.c
gcc -c filesize.c
.PHONY:clean
clean:
rm $(obj)
在makefile 的结尾,我需要删除目标文件(*。o),但最后一句貌似没用(即 rm $(obj)),为啥呢?请指教,谢谢
wnyh
帖子: 54
注册时间: 2011-11-24 9:00

Re: 为啥目标文件不能删除呢

#2

帖子 wnyh » 2012-04-25 16:35

wnyh 写了:下面是我现学现用的makefile
#!/bin/bash
obj=ligdr.o trimlen.o filesize.o
gdr:$(obj)
gfortran -o gdr ligdr.o trimlen.o filesize.o
ligdr.o : ligdr.f
gfortran -c ligdr.f
trimlen.o : trimlen.f
gfortran -c trimlen.f
filesize.o:filesize.c
gcc -c filesize.c
.PHONY:clean
clean:
rm $(obj)
在makefile 的结尾,我需要删除目标文件(*。o),但最后一句貌似没用(即 rm $(obj)),为啥呢?请指教,谢谢
原来还需要make clean 一把,不好意思,占用宝地,浪费 各位公子的时间了
回复