Re: Making a Makefile



Kevin Mahoney wrote:

Hi,
I am new to this list and makefiles. From the online documentation I was able to compile a simple 1 file program using:


$ g++ -Wall -g helloworld.cpp -o helloworld `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`

I need help creating a makefile. No big deal for this example but it will become necessary for larger programs.

Thanks,
Kevin


_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*. http://join.msn.com/?page=features/featuredemail

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Making a Makefile is verry easy:

__________________________________

CFLAGS += -g3 -O2 `pkg-config --cflags gtk+-2.0` <-- watch the ` instead of ' LDFLAGS += `pkg-config --libs gtk+-2.0`
program_name:  mainwindow,o other.o file.o source.o
                      g++ $(CFLAGS) $(LDFLAGS) $* $+




------------------------------

thats all!

program_name should be the name of the ouput file. if you have the sourcefiles called source1.c source2.c and source3.c after the : there should be: source1.o source2.o source3.o Make sure that is is on the same line of program_name: !!!!! if it doesnt fit on one line, put an \ on the end of the first line.

like:

program_name:  source1.o\
                       source2.o\
                       source3.o







[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]