Automatically extracting gcc -I paths for indexing source code in Emacs
Asked Answered
R

1

6

After reading:

I learn that when creating a project folder with an existing make file and source code, I can have semantic index the files by either:

  1. defining a simple EDE project with:

    (ede-cpp-root-project ... :system-include-path '( "~/exp/include/boost_1_37" )

  2. or by specifying the include paths to semantic directly with

    (semantic-add-system-include "~/exp/include/boost_1_37" 'c++-mode)

But this still requires me to type the paths manually. Is there any way to automatically extract the include paths for semantic from an existing make file?

Background: Some IDEs have a function to autodiscover gcc -I paths from an existing make file. For example, in Eclipse, you can create a project on a path with an existing make file and source code, and Eclipse would infer the include paths for its "intellisense" when building the project (I presume Eclipse parses the output of GNU make to do this). I would like to do the same in Emacs.

Rhetorical answered 11/10, 2012 at 23:41 Comment(0)
A
1

The answer is "yes": There's a way to discover this include path. AFAIK the code for it hasn't been written yet (tho I may be mistaken on this one). All you need to do is to run make -n and look for the "-I" in the output. Of course, the devil is in the details, but it should be possible to write a proof-of-concept fairly easily.

Adjective answered 12/10, 2012 at 0:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.