问个makefile和shell的问题

sh/bash/dash/ksh/zsh等Shell脚本
回复
snaildr
帖子: 3
注册时间: 2007-05-26 10:35

问个makefile和shell的问题

#1

帖子 snaildr » 2009-05-15 10:46

Here is the pattern rule to generate a file of dependencies (i.e., a makefile)

called `name.d' from a C source file called `name.c':
%.d: %.c
$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< | sed '\"s/$*.o/& $@/g'\" > $@'



不太明白sed里面的 \"是什么意思啊?





sed跟make都不熟悉,弱问,多谢!!
头像
yaoms
帖子: 4952
注册时间: 2007-10-19 14:51
来自: 深圳

Re: 问个makefile和shell的问题

#2

帖子 yaoms » 2009-05-15 10:53

代码: 全选

$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< | sed '\''s/$*.o/& $@/g'\'' > $@'
这样才是正确的。
Nothing 有事请发邮件到 yms541 AT gmail.com
alias 爱慕颇雷尔='mplayer'
snaildr
帖子: 3
注册时间: 2007-05-26 10:35

Re: 问个makefile和shell的问题

#3

帖子 snaildr » 2009-05-15 13:15

双引号改成两个单引号??
回复