Monday, June 18, 2007

Eclipse CDT

I've been hearing good things about Eclipse CDT (the C/C++ development tools for Eclipse), and I finally sat down and tried it out today. [Back in the day I was a vi/make/bash die hard, but I was won over by the huge (huge!) productivity gains I experienced using the Eclipse JDT (Java development tools) when doing Java, and now I really want something similar for C.]

So far, I'm very impressed. I was able to get the source code to a new version of GeekOS I'm working in imported and (almost) compiling, without writing a makefile. Based on the project settings, CDT generates makefiles automatically. The settings seem pretty flexible---for example, I was able to redefine the command for assembly files with very little effort. (I use gcc to convert assembly files into object files so that they can include C header files.)

Code completion seems relatively functional; not always totally up to date, but in general pretty good. I was actually able to do an automatic renaming of a variable, which is something I now take for granted in JDT and pains me greatly to have to do by hand using grep and vi. Of course, GeekOS is straight C code, so the underlying problem of extracting symbol information from the source code is not as complicated as for C++, but I don't care about C++.

I still have to customize the linking command and add a post-build step to get the kernel into some bootable form, but that should (in theory) be pretty easy. Eventually I would like to be able to support other hardware targets out of the same source base, which would require a mechanism in the build system to select a subset of source directories based on the current configuration (target).