简体   繁体   English

Makefile中存在循环依赖

[英]Circular dependency exists in makefile

I tried executing the following (found on a website) 我尝试执行以下命令(在网站上找到)

.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 $@

But I am getting Circular dependency error when executed on cygwin. 但是在cygwin上执行时,出现循环依赖错误。 Here is the output 这是输出

     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

Need help... 需要帮忙...

Use GNU make. 使用GNU make。 Here's the evidence: 这是证据:

  1. You are using a make copyrighted to Borland, which indicates that the make you are using is not GNU make. 您正在使用Borland拥有版权的商标,这表明您使用的商标不是GNU商标。

  2. I've found the example here . 我在这里找到了例子。 The author provides a link to GNU make, suggesting that his examples expect GNU make. 作者提供了指向GNU make的链接,建议他的示例希望使用GNU make。

  3. The make you are running interprets ; 使您运行的解释; as a dependency. 作为依赖。 Clearly it is not interpreting your Makefile correctly. 显然,它不能正确解释您的Makefile。

  4. If I use GNU make with your example, here's what I get: 如果我在您的示例中使用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