complex custom makefiles in kdevelop4

Andreas Pakulat apaku at gmx.de
Sun Sep 6 16:08:02 UTC 2009


On 06.09.09 01:13:20, Thomas Neumann wrote:
> Hi,
> 
> I would like to use KDevelop4 with a reasonably complex makefile (with 
> conditionals, include statements etc.). The basic functionality is there, of 
> course, but KDevelop does not pick up the required include path.
> 
> After looking at CustomMakeManager::includeDirectories I see why (the 
> function is empty ;), but after some more browsing around and looking at 
> CustomMakeManager::parseCustomMakeFile I think that the current approach is 
> not suited for complex makefiles. KDevelop tries to parse and analyze the 
> makefiles itself, but this will not work for non-trivial makefiles (and 
> complexity is usually the reason that people use hand-written makefiles).
> 
> IMHO KDevelop should instead call
> 
>    make -n -p
> 
> and analyze the output of this call. This basically uses make as a pre-
> processor to expand macros, conditionals, include statements etc. The result 
> is then easy to parse, and includes both targets and variable definitions. 
> KDevelop should examine the definitions of CFLAGS/CXXFLAGS/IFLAGS to locate 
> -I statements that give the include directories.
> 
> This would make handling of complex makefiles much more robust, but of 
> course has the disadvantage of calling an external program and probably 
> tying oneself to GNU make (I don't know how portable -n -p is).

Tying with GNU make is not an ultimate option. But of course we can
simply fallback to the current code for something other than GNU make.
Currently nmake isn't supported at all.

> Therefore I do not want to implement a patch without getting some feedback. 
> Do you think this is right way to approach the problem? Should KDevelop fall 
> back to custom parsing if GNU make is not available?

Yeap to both I think.

-- 
You have the capacity to learn from mistakes.  You'll learn a lot today.




More information about the KDevelop-devel mailing list