Avoiding ``No rule to make target ...'' Errors
GNU makeハンド・バック4.14節では、基本的な依存関係を自動的に生成するrulesを与える. -MPオプションfrom gcc manual This option instructs CPP to add a phony target for each dependency other than the main file,causing each to depend on nothing.These dummy rules work around errors make gives if you remove header files without updating the Makefile to match. This is typical output: test.o: test.c test.htest.h:
%.d: %.c
@set -e; rm -f $@; /
$(CC) -M $(CPPFLAGS) $< > $@.$$$$; /
sed 's,/($*/)/.o[ :]*,/1.o $@ : ,g' < $@.$$$$ > $@; /
rm -f $@.$$$$
, ,GNU Make Paul Smith ,
, , make , No rule to make target ...'' Errors
Paul sed , prerequisites target,
, , http://mad-scientist.net/make/autodep.html#advanced