GNU Make有-B
選項,強制make
忽略現有目標。它允許重建目標,但它也重建目標的所有依賴樹。我不知道有沒有辦法強制重建目標而不重建它的依賴關係(使用GNU Make選項,Makefile中的設置,兼容make
的軟件等)?有沒有辦法強制重建目標(make -B)而不重建它的依賴關係?
插圖的問題:
$ mkdir test; cd test
$ unexpand -t4 >Makefile <<EOF
huge:
@echo "rebuilding huge"; date >huge
small: huge
@echo "rebuilding small"; sh -c 'cat huge; date' >small
EOF
$ make small
rebuilding huge
rebuilding small
$ ls
huge Makefile small
$ make small
make: 'small' is up to date.
$ make -B small
rebuilding huge # how to get rid of this line?
rebuilding small
$ make --version | head -n3
GNU Make 4.0
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2013 Free Software Foundation, Inc.
當然一個可以rm small; make small
,但有一個內置的方式?
確實[這個問題](http://stackoverflow.com/questions/12199237/tell-make-to-ignore-dependencies-when-the-top-has-been-created)幫助你? – sycko
謝謝,但不是很多:正如我使用'ls'顯示的那樣,'huge'保存在這裏(沒有'.SECONDARY:'目標),而重建則是由於'-B'。 –