zoukankan      html  css  js  c++  java
  • 【已解决】Makefile执行过程中出错:make: *** No rule to make target ` ‘, needed by xxx. Stop(转载)

    转自: http://www.crifan.com/makefile_error_make_no_rule_to_make_target_needed_by_stop/

    【问题】

    有个已有的Makefile,执行过程中出错:

    CLi@PC-CLI-1 ~/develop/docbook/books/python_topic_str_encoding/src
    $ make html
    =============================== cleaning html ==============================
    rm -rf ../output/html/single/*
    make: *** No rule to make target ` ‘, needed by `../output/html/single/python_topic_str_encoding.html’.  Stop.

    【解决过程】

    1.换到别的,和当前文件夹等价的路径中去执行,结果却是正常的:

    CLi@PC-CLI-1 ~/develop/docbook/books/python_topic_str_encoding/src
    $ cd ../../python_topic_web_scrape/src
    
    CLi@PC-CLI-1 ~/develop/docbook/books/python_topic_web_scrape/src
    $ make html
    =============================== cleaning html ==============================
    rm -rf ../output/html/single/*
    =============================== generating html ==============================
    export XML_CATALOG_FILES="/home/develop/docbook/config_root/catalog/catalog.xml" && 
    export XML_DEBUG_CATALOG=1 && 
    
    ……

    2.后来折腾半天,最后终于发现,原来是由于,当前Makefile中的内容是:

    # also means main source file name
    PROJECT_NAME = python_topic_str_encoding
    SUB_SRC_FILES = 
        python_topic_str_encoding.xml 
        preface.xml 
        ch01_2x_vs_3x.xml 
        ch02_common_encoding_error.xml 
        ch03_other_common_case.xml 
        reference.xml    
     
    DOCBOOK_MAKEFILE_ROOT = ../../../config
    ################################################################################
    # Include docbook makefile
    ################################################################################
    include $(DOCBOOK_MAKEFILE_ROOT)/docbook.mk

    其中,注意到,所依赖的

    reference.xml 

    后面还有几个空格的,截图才能看出来:

    xml follow with space

    导致了此错误。

    把最后的,多余的空格去掉:

    removed unuseful space

    就可以消除此问题了。

    【总结】

    Makefile在编译执行过程中,对于所依赖的条件,此处即一堆xml文件,最后一个是reference.xml,结果由于最后 reference.xml后面,有多余的4个空格,导致Makefile将该处的4个空格,视为一个文件了,所以,必然找不到该“文件”,所以才报错 的。

    所以,如果Makefile出现:

    make: *** No rule to make target ` ‘, needed by xxx. Stop.

    的错误,那么基本上都是属于找不到所依赖的文件所导致的,所以应该去:

    检测确保,所依赖的文件,是否真实存在。

    很可能,很常见的一个现象就是,此处的,误写了多余的空格,导致被视为依赖文件,导致找不到,导致报此错误。

    解决办法就很简单,去掉多余的空格即可。

  • 相关阅读:
    第二章作业
    算法第五章作业及学期总结
    71 最大子列和问题 | 采用二分法+递归
    算法第一章作业
    算法第四章作业
    算法第三章作业
    Windows charles安装、配置及Android手机ca证书
    git出现fatal: Authentication failed for 'http:xxxx.git/''错误的解决办法
    如何用c#将十六进制转换成字符串?
    系统配置win7(64位),vs2010,没有注册类别 (异常来自 HRESULT:0x80040154 (REGDB_E_CLASSNOTREG))
  • 原文地址:https://www.cnblogs.com/lance-ehf/p/3962572.html
Copyright © 2011-2022 走看看