Using a simple makefile is the fastest way to compile a small GNOME application. If you require a more sophisticated build environment, you should use an autoconf/automake setup, which I will briefly talk about later.
The command line to the C compiler for building a GNOME application can be quite long and would be hard to figure out by hand. So gnome-libs installs a script to simplify this. It is called gnome-config and it takes two options, --cflags and --libs. The --cflags option will give you the compiler flags, needed for the compilation step, and --libs will give you the libraries you need to pass to the linker. You also need to pass another set of arguments to gnome-config. It needs to know what libraries you wish to use. For our purposes, this is gnome and gnomeui. So for example to get the compiler flags for some program using the standard gnome and gnomeui libraries, you would call "gnome-config --cflags gnome gnomeui".
Now to build a simple makefile, you can use variables CFLAGS and LDFLAGS and the implicit rules that at least GNU make supports (others probably do as well, but I'm not familiar with other makes). So for example let's say you have an application that has a main.c, main.h, extra.c and extra.h and the executable is called gnome-foo.Now let's build a small Makefile for this app.
CFLAGS=-g -Wall `gnome-config --cflags gnome gnomeui` LDFLAGS=`gnome-config --libs gnome gnomeui` all: gnome-foo gnome-foo: main.o extra.o main.o: main.c main.h extra.h extra.o: extra.c extra.h clean: rm -f core *.o gnome-foo |