LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 08-11-2008, 02:03 AM   #1
RudraB
Member
 
Registered: Mar 2007
Distribution: Fedora
Posts: 262

Rep: Reputation: 23
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?
 
Old 08-11-2008, 03:08 AM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
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
 
Old 08-11-2008, 03:27 AM   #3
RudraB
Member
 
Registered: Mar 2007
Distribution: Fedora
Posts: 262

Original Poster
Rep: Reputation: 23
and what about ccache-ing gfortran?
 
Old 08-11-2008, 04:10 AM   #4
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Never done it, don't know.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
CCACHE and acpid issues vatten Linux - Newbie 0 10-28-2007 06:05 PM
ccache, precompiled headers & C++ - Doesn't work as well as imagined ripat Programming 0 02-20-2005 03:24 PM


All times are GMT -5. The time now is 03:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration