可能重複:
GNU Makefile rule generating a few targets from a single source fileGNU使:多個目標的單一規則
如果我有一個Makefile規則是這樣的:
a b c:
echo "Creating a b c"
touch a b c
output: a b c
cat a b c > output
,我跑make -j9輸出
make看到3個依賴項(a,b,c),尋找如何生成它們:(上面的「a b c」規則),但接下來會發生什麼?是否應該認識到,只需要運行一次「a b c」規則即可創建全部3個目標?
這是什麼使實際做:
[[email protected] test]$ make -j9 output -n
echo "Creating a b c"
touch a b c
echo "Creating a b c"
touch a b c
echo "Creating a b c"
touch a b c
cat a b c > output
[[email protected] test]$
相同的配方運行3次,一旦每個依存性的統治「輸出」!
有誰知道它爲什麼這樣表現?
相關:http:// stackoverflow。com/questions/3016258/generate-multiple-target-using-single-action-rule and http://stackoverflow.com/questions/2973445/gnu-makefile-rule-generating-a-few-targets-from-a-單源文件 – krlmlr