compile only changed?
I''m currently developing an opengl app using g++ and my own makefile. Is there a way to only compile files that have changed since the last compile? As it is, it''s rebuilding EVERY line of code in the whole damn project every time I need to compile, which sucks when I only change one variable in one file.
Properly made makefiles should do that for you.
Post your makefile here.
How appropriate. You fight like a cow.
Post your makefile here.
How appropriate. You fight like a cow.
OK, now please don''t hurt me, because I just switched to linux two weeks ago and I was very excited to get my makefile to compile my project AT ALL.
CC = gcc -Wall -ansiSOURCE = window.cpp implementation.cpp keyboard.cpp ./utils/strutil.cpp ./utils/fltutil.cpp ./math/vec3.cpp ./math/matrix33.cpp ./math/matrix44.cpp ./objects/clock.cpp ./fonts/freetypefont.cppLIBRARIES = -lGL -lGLU -lglut -lfreetypeFLAGS = `sdl-config --cflags --libs`FT_INC = /usr/include/freetype2OBJECTS = ./output/BINARY = runall: $(CC) $(SOURCE) -o $(BINARY) $(LIBRARIES) $(FLAGS) -I$(FT_INC)rebuild:clean: @echo Cleaning up... @rm $(BINARY) @echo Done.[/clean]
Okay, that''s a good start. Make these changes:
* change SOURCE to OBJECTS, a list of .o files that should be produced. Basically everything you have there, but change .cpp to .o. Dunno what that current OBJECTS thingy is there for, but take it out.
* put flags for CC into CFLAGS, not CC
* rename LIBRARIES to LIBS
* what the heck are you doing with FLAGS? take it out, and put whatever you actually need into CFLAGS or CPPFLAGS (CPPFLAGS for preprocessor stuff, like include directories and #defines)
* take out the FT_INC thingy and replace it with
CPPFLAGS = -I/usr/include/freetype2
(CPPFLAGS is the proper place to define include directories)
* change the rule for "all" to something like:
all: $(OBJECTS)
$(LD) $(LDFLAGS) -o $(BINARY) $(OBJECTS) $(LIBRARIES)
That''ll build it from the objects instead.
How appropriate. You fight like a cow.
* change SOURCE to OBJECTS, a list of .o files that should be produced. Basically everything you have there, but change .cpp to .o. Dunno what that current OBJECTS thingy is there for, but take it out.
* put flags for CC into CFLAGS, not CC
* rename LIBRARIES to LIBS
* what the heck are you doing with FLAGS? take it out, and put whatever you actually need into CFLAGS or CPPFLAGS (CPPFLAGS for preprocessor stuff, like include directories and #defines)
* take out the FT_INC thingy and replace it with
CPPFLAGS = -I/usr/include/freetype2
(CPPFLAGS is the proper place to define include directories)
* change the rule for "all" to something like:
all: $(OBJECTS)
$(LD) $(LDFLAGS) -o $(BINARY) $(OBJECTS) $(LIBRARIES)
That''ll build it from the objects instead.
How appropriate. You fight like a cow.
Oh shit....I added rm $(OBJECTS) to make clean, but I didn''t notice that I still had a .cpp in objects.....
well if you were using gentoo all you would have had to do was emerge -U gnome .
quote:
Original post by raincoat
well if you were using gentoo all you would have had to do was emerge -U gnome .
i think you''re a bit out of subject. He''s trying to compile one of his own apps. Not gnome so emerge -U gnome wouldn''t do crap for him except update gnome. What would the point be?
[Cyberdrek | the last true sorcerer | Spirit Mage - mutedfaith.com][ Administrator & WebMaster GuLSE]
[Cyberdrek | ]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement