What about using the make utility? [GTK 2.x]

This is a sample makefile which compiles a GTK+ based program:

# basic GTK+ app makefile
SOURCES = myprg.c foo.c bar.c
OBJS    = ${SOURCES:.c=.o}
CFLAGS  = `pkg-config gtk+-2.0 --cflags`
LDADD   = `pkg-config gtk+-2.0 --libs`
CC      = gcc
PACKAGE = myprg

all : ${OBJS}
  ${CC} -o ${PACKAGE} ${OBJS} ${LDADD}

  ${CC} ${CFLAGS} -c $<

# end of file

For more information about the make utility, you should read either the related man page or the relevant info file.