View Full Version : Compiling a single source file from an entire application (Nautilus)

April 18th, 2009, 11:11 AM
Hi, I almost have no experience with C (I usually do Python development) and I'm wondering if somebody can help me out and explain how to compile a single source file (nautilus-location-dialog.c) from an entire application (Nautilus).

You can checkout Nautilus using the following command, after which nautilus-location-dialog.c can be found in the src/ directory:

svn co http://svn.gnome.org/svn/nautilus/trunk nautilus

I'm not particularly interested in the location dialog itself as much as I am interested in learning about the process involved. For example, how do you know what libraries to include using pkg-config to generate the needed cflags/libs? Or, what are the minimum required bits from Nautilus to compile this single file?

Bonus points to anyone who can give an example of a very simple Makefile to do just this.

Here's an example of something I'm looking for (this compiles the example-service.c example from dbus-glib, as long as example-service-glue.h has been generated by the Makefile, but that's something else I don't understand yet):

gcc `pkg-config --libs --cflags dbus-1 dbus-glib-1 glib-2.0` example-service.c -o example-service