|Some questions regarding using autotools [message #568673]
||Thu, 01 April 2010 08:36
Registered: April 2010
I am now in the process of moving my project from kdevelop to eclipse. Reason being that I was not able to get some code to compile as a shared library within a project, and kdevelop being quite buggy.
I am using Ubuntu 9.10 as my development machine. What I have done is installed eclipse 3.5.1, CDT 6.0 and the latest version of linux tools.
I have created a GNU autotools project.
My directory structure is as follows:
So far, when it compiles, I get the following result (I have changed the built path to be in "debug"):
Firstly, where in the settings can I change so that myapp is compiled as myapp and not a.out?
Secondly, I would like to have myplugin.c compiled as myplugin.so. How do I do this?
Thirdly, I would like the filestructure of debug to be as follows
How do I go about setting this?
Thank you :)
|Re: Some questions regarding using autotools [message #568688 is a reply to message #568673]
||Thu, 01 April 2010 21:14
| Jeff Johnston
Registered: July 2009
If you indeed have an autotools project, that means you should have a configuration script, (configure) generated from configure.in or configure.ac and an automake file (Makefile.am). You should end up with a generated Makefile in your build tree. |
The Autotools plugin does not generate autotool files for you, though, when creating a new C or C++ GNU Autotools project, you can elect to create a sample ANSI Hello world project which includes autotool files for you to create a simple hello world executable with the name of the project. You can change this after-the-fact to replace the hello world source with your own code and just take advantage of the autotool files created.
If you are unfamiliar with autotools, I suggest you look at the online documentation you can find at:
To set up an executable with name myapp, there are multiple ways.
To do it via Makefile.am and have automake generate appropriate stuff in your Makefile, you can put:
bin_PROGRAMS = myapp
myapp_SOURCES = myapp.c
You can add additional sources to myapp_SOURCES if you need to.
When you run this through automake, you will get what you want. Automake will generate other targets for you such as info, install, etc...
Alternatively, you could just hard-code the Makefile targets in your Makefile.am:
gcc -o $@ $<
gcc -c $<
These will end up in your generated Makefile as-is.
A shared library should use libtool. In your Makefile.am, you might have:
myplugin_la_LDFLAGS= -lc -lgcc
for libtool, you must have AC_PROG_LIBTOOL in your configure.ac file.
Here is not a place to do a course on autotools or GNU make, so take a look at the documentation in conjunction with the examples above.
Powered by FUDForum
. Page generated in 0.01628 seconds