make clean を 2 回実行すると、2 回目の呼び出しで、削除予定の依存 Makefile がビルドされます。削除予定のファイルを Makefile に認識させ、そのディレクトリに対する make の再帰呼び出しをスキップするにはどうすればよいですか? つまり、サブディレクトリごとに、各サブディレクトリにメイクファイルが既に存在する場合にのみ、サブディレクトリでクリーンアップを行います。GNU-Make の構文はわかりませんが、次のようなものを探しています。
Dependencies=[dependency1,dependency2,dependency3,dependency4]
DoNotMake=[bool1,bool2,bool3,bool4]
for all (i < 4):
if (! Dependencies(i)/Makefile):
DoNotMake(i)=true
make clean の現在のルールは次のとおりです。
.PHONY: clean
clean:
$(MAKE) MAKEDEPEND=off SUBDIR_ARGS=clean
rm -f dependency1/Makefile
rm -f dependency2/Makefile
rm -f dependency3/Makefile
rm -f dependency4/Makefile
rm -f dependency4/src/config.h.in