如以下makefile文件
all: data voice
data:
@ (cd data ; $(MAKE) all)
voice:
echo "Running a training/synthesis perl script (Training.pl) in background...."
/usr/bin/perl scripts/Training.pl scripts/Config.pm > log 2>&1 &
clean: clean-data clean-voice
clean-data:
@ (cd data ; $(MAKE) clean)
clean-voice:
rm -rf models stats edfiles trees gv mspf voices gen proto configs
distclean: clean
@ (cd data; $(MAKE) distclean)
rm -f scripts/Config.pm
rm -f Makefile
rm -f config.log
rm -f config.status
rm -rf autom4te.cache
.PHONY: data voice clean distclean
其中target……: prerequisites……
……command……
如编译all需要data 和voice
而data不需要什么,但是会执行@ (cd data ; $(MAKE) all),如果make
执行的命令前面加了@字符,则不显示命令本身而只显示它的结果; 只输出命令执行的结果,出错的话停止执行。如果在rm前面加-表示出错的话忽略错误,继续执行,因为有可能rm的文件为空
.PHONY后面跟的表示伪目标,这里all才是最终目标