how to save time from compiling whole project?
I am implementing some idea on sqlite3. Every time I want to test my codes, I have to compile the whole project. The following is exactly what I do :
sudo make uninstall
sudo make clean
./configure
sudo make
sudo m开发者_StackOverflowake install
some of above commands cost long time. What should I do to save time?
Skip other steps and do only
sudo make
sudo make install
after you changed some source codes.
Also, don't use sudo
at all. You should be able to run an instance without actually "installing" it anywhere. This is what developers will normally do, rather than having to keep installing code they're working on into the very system they're using.
If you have a dual-core machine, use make -j2
to compile 2 files at a time in parallel. Quad core: make -j4
, etc. This helps a lot if you make header file changes.
And listen to S.Mark: only do the steps you need to do each time. You probably won't need to run the slow ./configure
again. If you run/link your tests against the sqlite in your build directory, you don't need make install
either, leaving you with just make
.
ccache might be your friend.
On Ubuntu (or similar systems), you start with apt-get install ccache
and then before you compile, do PATH=/usr/lib/ccache:$PATH
. It'll cache stuff in ~/.ccache
and likely speed up subsequent compiles.
精彩评论