LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   ccache (http://www.linuxquestions.org/questions/programming-9/ccache-661910/)

RudraB 08-11-2008 01:03 AM

ccache
 
how can i use ccache to MAKE my code?
my make file looks like:
Code:

FC=~/gfortran/bin/gfortran
CC=gcc
irun:$(oall)
        $(FC) $(FFLAG) $(oall) -o irun
cptimer.o:lib/cptimer.c
        $(CC) $(CFLAG) -c lib/cptimer.c
bit.o:bit.c
        $(CC) -c $(CFLAG) bit.c
main.o : main.f90
        $(FC) $(FFLAG) -c main.f90

now when I do make clean;make, how can i know if it is using ccache or not? if it is not, how can i force compiler to use ccache?

matthewg42 08-11-2008 02:08 AM

When you have ccache installed, it installs a program called gcc, but it is not in the same place as the regular gcc. You cn either set the PATH so that th ccache gcc is found before the normal gcc, or you can just hard-code the full path to the ccache version of the program in your Makefile.

Not sure what distro you are on but here's how to find out the path the ccache gcc on a debian based system (the ccache package is called simply 'ccache'):
Code:

$ dpkg --listfiles ccache |grep '/gcc$'
which outputs:
Code:

/usr/lib/ccache/gcc
So you can simply set in your Makefile
Code:

CC=/usr/lib/ccache/gcc

RudraB 08-11-2008 02:27 AM

and what about ccache-ing gfortran?

matthewg42 08-11-2008 03:10 AM

Never done it, don't know.


All times are GMT -5. The time now is 09:46 AM.