繁体   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