Sign in to follow this  
Holland

new to linux...makefiles & kdevelop

Recommended Posts

So...I could be going about this the wrong way. I've installed Ubuntu 9.04 and got the latest version of Kdevelop, and of course g++ and all of that. I'm trying to figure out how to get started with Kdevelop. I've made a project and have only found the basic "hello world" project to be the least "developed" project start. As far as I can tell, this comes with a makefile for the code to be compiled with. I don't always want to have to start with one of these premade projects. I prefer to create my own file hierarchy and such. I tried to take my old win32 code from my SVN and get it to build in Kdevelop but it's complaining that there is no makefile present. This makes perfect sense to me, but all of the makefile tutorials I have found are saying you have to list every single .cpp file in your project. This is a bit of work since I have about 40-50 .cpp files, all in 3 or 4 different directories. Does Kdevelop provide some way of selecting a group of files+folders and creating a basic makefile out of them? Also, how would I include dependencies like libraries (SDL, OpenGL, OpenAL, etc) and includes? Is there some sort of makefile generator that will start at some base folder and recursively dig in and generate one based on the files and code? Sorry for the wordiness here. Thanks so much for any and all help. :) - Trevor [Edited by - Holland on June 7, 2009 7:34:38 PM]

Share this post


Link to post
Share on other sites
I tried this before and I ended up using the automake facilities of KDevelop. It seemed the easiest way. The project contains of source files spread across different directories, using sources which are synchronized over svn with an MSVC project (I didn't set up the svn control as part of the KDevelop project).

You will need to create a new automake based project.
Then use the automake tool.

Read from the link above onwards to first add new files and become familiar with the concept.
The menu entry "Create automake and friends" should take care of building the makefiles in the background.

Try to link against libraries by looking at the Library FAQ. Add some code to use the linked library/ies. Compile this simple new project.
Try to add a subfolder and the files contained in it.

When this works try a new automake project and add your existing sources using the automake manager.

Please report if you can make any progress.


Share this post


Link to post
Share on other sites
Quote:
all of the makefile tutorials I have found are saying you have to list every single .cpp file in your project. This is a bit of work since I have about 40-50 .cpp files, all in 3 or 4 different directories.


Yes, you have to list them, or just use a special rule that will apply to all files with the same extension:

.cpp.o:
$(CPP) -c $(ANY_OPTIONS_YOU_LIKE) $*.cpp
.c.o:
$(CC) -c $(ANY_OPTIONS_AGAIN) $*.c

This will just apply the commands above to all .cpp and .c files producing .o files.
[biased comment]But, frankly, I'd just create a project with all files with CodeBlocks or QTCreator and let it roll..[/biased comment]

Share this post


Link to post
Share on other sites
It shouldn't take you to long to add files from just 3,4 directories. Multiple file add is possible afaik.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this