|Re: Some questions regarding using autotools [message #524702 is a reply to message #524515]
||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.01673 seconds