【问题标题】:What is the easiest way to get flymake to work with an autoconf project with a separate build directory?让flymake与具有单独构建目录的autoconf项目一起工作的最简单方法是什么?
【发布时间】:2013-06-22 13:51:37
【问题描述】:

有时我希望将构建目录与源目录分开(例如,我使用安装到多个不同构建环境的相同源 NFS)。在此配置中,我无法使用 flymake,因为它找不到 Makefile。谁能推荐一个让flymake找到正确的构建目录并运行make -C check-syntax的好方法?我觉得这一定是一个常见问题,但谷歌在这里让我失望了。

【问题讨论】:

    标签: flymake


    【解决方案1】:

    为了记录,我最终这样做了(欢迎改进):

    (defadvice flymake-find-buildfile
      (around advice-find-makefile-separate-obj-dir
              activate compile)
      "Look for buildfile in a separate build directory"
      (let* ((source-dir (ad-get-arg 1))
         (bld-dir (ac-build-dir source-dir)))
        (ad-set-arg 1 bld-dir)
        ad-do-it))
    
    (defun ac-find-configure (source-dir)
      (locate-dominating-file source-dir "configure"))
    
    (defvar project-build-root nil
      "top build directory of the project")
    
    (defun ac-build-dir (source-dir)
      "find the build directory for the given source directory"
      (condition-case nil
          (let* ((topdir (ac-find-configure source-dir))
             (subdir (file-relative-name (file-name-directory source-dir) topdir))
             (blddir (concat (file-name-as-directory project-build-root) subdir)))
            blddir)
        (error source-dir)))
    

    并将project-build-root 设置为我的顶级源目录.dir-locals.el 中的构建目录

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-10-04
      • 1970-01-01
      • 2017-08-23
      • 2014-03-17
      • 2023-01-26
      • 1970-01-01
      相关资源
      最近更新 更多