0
我有時想保持我的編譯目錄與我的源代碼目錄分開(例如,我使用與多個不同的編譯環境相同的源NFS)。在此配置中,我無法使用flymake,因爲它無法找到Makefiles。任何人都可以推薦一個很好的方法來獲取flymake來找到正確的編譯目錄並運行make -C檢查語法嗎?我覺得這一定是一個普遍問題,但Google在這裏失敗了。讓flymake使用獨立構建目錄的autoconf項目最簡單的方法是什麼?
我有時想保持我的編譯目錄與我的源代碼目錄分開(例如,我使用與多個不同的編譯環境相同的源NFS)。在此配置中,我無法使用flymake,因爲它無法找到Makefiles。任何人都可以推薦一個很好的方法來獲取flymake來找到正確的編譯目錄並運行make -C檢查語法嗎?我覺得這一定是一個普遍問題,但Google在這裏失敗了。讓flymake使用獨立構建目錄的autoconf項目最簡單的方法是什麼?
爲了記錄在案,我終於實現了這個(改善歡迎):
(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
我的build目錄.dir-locals.el