开发者

Fix source file search path when doing out-of-source autotools build within emacs

I have a project that uses autotools. A nice feature of autotools is 'out-of-source' builds, wheras instead of doing :

cd foobar
./configure
make

I actually create a folder for builds, in which I do the configuration :

cd foobar/builds/linux
../../configure
make

(The nicety is that my source folder is not crippled with the generated Makefiles, and it helps when cross-compiling).

So when I am working on my code in emacs, to run the compilation I'll do M-x compile specifying the compile command as cd ~/foobar/builds/linux ; make .

This works fine until a compilation error occurs. The compilation buffer will list the files with ugly path (like ../.开发者_开发技巧./../../src...), which points to a source file, relative to the build folder.However, it seems like emacs does not stay in the build folder at the end of the compile, so the link does not point to anything. Hence, I cannot easily browse back to the error.

I tried playing with compilation-search-path, whithout luck.

Is there a way to force emacs to 'stay' in the compilation folder (so that the paths in the compilation buffer reference existing files ?)

Thanks

PH


If you instead use make -C ~/foobar/builds/linux, emacs should be able to track the Entering directory ..., Leaving directory ... messages that make emits and use this to keep proper references to the files.


Using jamessan advice, I could partially fix the issue by :

  • setting 'compilation-directory to be one of the 'source' folders (builds/linux/current/src/client)
  • settting 'compilation-command to change to one of those source folders using -C

Not so sure if both are needed or if it is the best way to do things ...

Thanks anyway !

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜