LinuxQuestions.org
Review your favorite Linux distribution.
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 10-11-2013, 09:50 AM   #1
peng6662001
LQ Newbie
 
Registered: Mar 2013
Posts: 17

Rep: Reputation: Disabled
Unhappy I want to modify the Makefile for using distcc


I use "make -j4 CC=distcc" to compile a project,and use distccmon-text to check whether distcc is runing.
When I set CC = distcc,and use "make -j4",distcc does not work.
Another thing,is "-j4" can be write in Makefile?So I only implement "make",the distcc and 4 jobs will work.

Console print follow thing when compile:
gcc -o dbus-cleanup-sockets dbus-cleanup-sockets.o


How do I modify the Makefile,console can print like this:
distcc gcc -o dbus-cleanup-sockets dbus-cleanup-sockets.o

Last edited by peng6662001; 10-11-2013 at 09:52 AM.
 
Old 10-11-2013, 11:51 AM   #2
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 1,948

Rep: Reputation: 524Reputation: 524Reputation: 524Reputation: 524Reputation: 524Reputation: 524
change every occurance of gcc to ${CC}
 
Old 10-12-2013, 12:01 AM   #3
peng6662001
LQ Newbie
 
Registered: Mar 2013
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by NevemTeve View Post
change every occurance of gcc to ${CC}
I modify all gcc to distcc,and g++ to distcc,but when I use "make",the distcc does not work.
Can I only use "make"?I do't want to use "make CC=distcc"
 
Old 10-12-2013, 09:19 AM   #4
peng6662001
LQ Newbie
 
Registered: Mar 2013
Posts: 17

Original Poster
Rep: Reputation: Disabled
I write "export CC=distcc" to the PATH,the distcc does not run.

I find many Makefile in sub directory,but I only modify Makefile in root directory.
When I modify All the Makefile,distcc can work normally.
But it is complex to modify all the Makefile,can I set a flag to do that?
 
Old 10-12-2013, 10:06 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,284

Rep: Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664
Quote:
I find many Makefile in sub directory
When you have "many Makefile" you may also have a "configure"
script in the top directory ?

How to use "./configure" to generate new Makefile's :
$ export CC=distcc && ./configure


-

Last edited by knudfl; 10-12-2013 at 10:07 AM.
 
Old 10-12-2013, 10:56 AM   #6
peng6662001
LQ Newbie
 
Registered: Mar 2013
Posts: 17

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by knudfl View Post
When you have "many Makefile" you may also have a "configure"
script in the top directory ?

How to use "./configure" to generate new Makefile's :
$ export CC=distcc && ./configure


-


Dear knudfl:
Thank you for your anwser.
After I use "./configure CC=distcc",all the Makefile is modify "CC = gcc" to "CC = distcc".
But I want to know how can I modify a parent Makefile,all the sub Makefile will USE "CC = distcc",can this flag inherit from parent to child?

And,how achieve multi jobs by modify parent Makefile instead of call "make -j4"
 
Old 10-12-2013, 01:09 PM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,284

Rep: Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664Reputation: 2664
Quote:
multi jobs by modify parent Makefile instead of call "make -j4"
May be not ? But you can set an alias for 'make'.
http://en.wikipedia.org/wiki/Alias_%28command%29

For a .bashrc, it is : alias make='make -j4"
http://tldp.org/LDP/abs/html/sample-bashrc.html

The Ubuntu "dash" shell uses the same syntax.
6.4 http://www-rohan.sdsu.edu/doc/debian/ch-shell.html

-

Last edited by knudfl; 10-13-2013 at 05:42 AM.
 
Old 10-15-2013, 05:27 AM   #8
peng6662001
LQ Newbie
 
Registered: Mar 2013
Posts: 17

Original Poster
Rep: Reputation: Disabled
Talking

Quote:
Originally Posted by knudfl View Post
May be not ? But you can set an alias for 'make'.
http://en.wikipedia.org/wiki/Alias_%28command%29

For a .bashrc, it is : alias make='make -j4"
http://tldp.org/LDP/abs/html/sample-bashrc.html

The Ubuntu "dash" shell uses the same syntax.
6.4 http://www-rohan.sdsu.edu/doc/debian/ch-shell.html

-

export CC=distcc
alias make="make -j4"
make -e

when compile with -e,all the CC can be set by enviorment,the distcc can work normal.
Thank you very much.
 
Old 10-28-2013, 09:52 PM   #9
peng6662001
LQ Newbie
 
Registered: Mar 2013
Posts: 17

Original Poster
Rep: Reputation: Disabled
Add MAKEFLAG += -j8 in Makefile can impliment multi make process.
 
  


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
What should I modify in following Makefile so that it can work on my machine jamesbon Programming 5 11-01-2010 10:05 PM
Can I Modify a Driver Makefile? YAOMK Red Hat 3 04-11-2008 04:09 PM
How to modify makefile.in or makefile.am QiangWan Linux - Newbie 1 05-17-2005 12:07 PM
new system call, modify Makefile for .o feetyouwell Programming 0 11-16-2004 10:58 AM
modify file access & modify timestamps i2itstud Linux - General 1 05-20-2003 04:34 AM


All times are GMT -5. The time now is 04:09 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