簡體   English   中英

Makefile中存在循環依賴

[英]Circular dependency exists in makefile

我嘗試執行以下命令(在網站上找到)

.PHONY: coat shoes mobile sweater socks trousers shirt pants undershirt

# target    prerequisite           command
# ------------------------------------------------
coat:       shoes mobile sweater;  @echo put on $@
shoes:      socks trousers;        @echo put on $@
mobile:     trousers;              @echo put on $@
sweater:    shirt;                 @echo put on $@
socks:      ;                      @echo put on $@
trousers:   pants shirt;           @echo put on $@
shirt:      undershirt;            @echo put on $@
pants:      ;                      @echo put on $@
undershirt: ;                      @echo put on $@

但是在cygwin上執行時,出現循環依賴錯誤。 這是輸出

     1  MAKE Version 5.2  Copyright (c) 1987, 2000 Borland
     2  Error: Circular dependency exists in makefile
     3    socks -> socks
     4  Error: Circular dependency exists in makefile
     5    shoes -> socks
     6  Error: Circular dependency exists in makefile
     7    mobile -> mobile
     8  Error: Circular dependency exists in makefile
     9    coat -> shoes
    10  Fatal: ';' does not exist - don't know how to make it

需要幫忙...

使用GNU make。 這是證據:

  1. 您正在使用Borland擁有版權的商標,這表明您使用的商標不是GNU商標。

  2. 我在這里找到了例子。 作者提供了指向GNU make的鏈接,建議他的示例希望使用GNU make。

  3. 使您運行的解釋; 作為依賴。 顯然,它不能正確解釋您的Makefile。

  4. 如果我在您的示例中使用GNU make,則得到的是:

     $ make put on socks put on pants put on undershirt put on shirt put on trousers put on shoes put on mobile put on sweater put on coat 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM