【问题标题】:Makefile and sub makefile, phony task nothing to be doneMakefile和子makefile,假任务无事可做
【发布时间】:2012-02-13 16:17:52
【问题描述】:

目录树

.
| Makefile
| src
    | Makefile
| spec
| test

在 ./Makefile 中

default: all

.DEFAULT: 
    $(MAKE) -C $@

在 src/Makefile 中

.PHONY: all spec test ...

spec:
    bundle exec cucumber ../spec

当我在 src 目录中时,“make spec”运行良好。

..././src/# make spec
blablabla

但是当我在根目录中时,我发现“无事可做”,但这是一个虚假目标

..././# make spec
make: Nothing to be done for `spec'.

我认为是任务名称与目录名称相同的问题,带有子makefile。

【问题讨论】:

    标签: makefile gnu-make


    【解决方案1】:

    我想是任务名称与目录名称相同的问题,带有子makefile。

    是的。

    尝试类似:

    all :
    
    forward_ : ;
    
    % : forward_
        $(MAKE) -C $@
    
    .PHONY : all forward_
    

    假的forward_ 目标应该触发% 目标的重新评估,即使存在具有$@ 名称的现有文件或目录。

    【讨论】:

      猜你喜欢
      • 2021-09-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多