Using Makefile

If you writing gtk application. You will have to use more than one source file to make the code more manage able. To compile the application you need to use make.

makefile tutorial
makefile tutorial

It is all you need to compile a c code with libgnomedb. This code will output an executable
file with name ekoken. A more complicated makefiles using variable is like this

CC = gcc
LD = gcc
RM = rm -f
LDFLAGS = `pkg-config --libs gtk+-2.0`


all : $(PROG)

%.o : %.c
$(CC) $(CFLAGS) -c $< -o $@

$(PROG) : $(OBJS)
$(LD) $(LDFLAGS) $(OBJS) -o $(PROG)

clean :
$(RM) $(OBJS) $(PROG)

Where PROG is the executable output and OBJS is the object file output with .o suffix.

You can read more from this link
Makefile in C or C++
A simple makefile tutorial


Published by


Different. In a good way

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s