The K Desktop Environment

3.2. Make és Makefile s

I have everything I need: an editor, a Compiler and I can execute my own C++ program. But it isn't all that easy. What happens if you have more than one source file ? And, do you have to compile all sources over and over again only if you changed one file ? Compiling will become more and more complicated and time-consuming, because you have to type in all the commands and options yourself. Therefore, you could write a so-called "Makefile ". You could also call it some other name except the name of the program to build. Then, you should have the tool make or gmake installed, or any other tool that is capable of keeping track of a project's compilation. Insert all your Compiler commands in a certain syntax into that Makefile and save it; then you will only have to type make or gmake on the console in the directory where your Makefile is located, and then make takes over, leading the Compiler to create your application. The make utility has many other advantages and can be used to a lot of purposes. To get a complete overview, open a console and type:

man make

or search for "GNU Make" in KDEHelp, "System GNU Info contents". At least, you have an insight, why a developer needs the make utility for making it easier to compile his application. Now, writing Makefile s is not only handwork until now, you also have to dig yourself into the whole syntax and options. But here is the good news about KDevelop and any Make-utility: You just have to set the Make-Command in the KDevelop Setup dialog, and then you're done. All projects generated with KDevelop will use that Make command to build the target application, and no typing at all. Just hit the buttons on the toolbar of KDevelop, beginning with the one after the second separator line, or choose the desired function for Make in the "Build" menu.

The toolbar and the build-menu then offer the most-common functions that you need to let make do the dirty work:

But this is not the only way how KDevelop works together with make- for KDE applications, there are some things that are special, like creating the message files for internationalization. These functions are also included, so no worry about these things anymore.

Until now, you know about sources, the Compiler and why make is needed. In the next section, we'll discuss how it comes that projects created with KDevelop automatically can be compiled on most other Unix-platforms using the configure- script.