LinuxQuestions.org
Social Bookmarking all things Linux and Open Source
Go Back   LinuxQuestions.org > Forums > Linux > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Tags used in this thread
Popular LQ Tags , ,

Reply
 
Thread Tools
Old 10-27-2009, 10:12 AM   #1
xirtyllo
LQ Newbie
 
Registered: Oct 2009
Location: Netherlands
Distribution: Slackware 13
Posts: 13
Thanked: 0
how do i pass my CFLAGS when compiling the Kernel?


[Log in to get rid of this advertisement]
Hi,

I have my CFLAGS="-blabla" and CXXFLAGS="-blabla" setted in my .bashrc file, and i can see that the optimizations are applied every time i compile some application (i actually see them printed many times among the lines scrolling in the console..)

When i compile a Kernel, on the other hand, i have no feedback if the CFLAGS that are set in my .bashrc are taken in consideration or not...

what can you tell me about this..?

THX!
Tomm
windows_xp_2003 xirtyllo is offline  
Tag This Post , ,
Reply With Quote
Old 10-27-2009, 11:25 AM   #2
JohnGraham
Member
 
Registered: Oct 2009
Posts: 65
Thanked: 12
Quote:
Originally Posted by xirtyllo View Post
Hi,

I have my CFLAGS="-blabla" and CXXFLAGS="-blabla" setted in my .bashrc file, and i can see that the optimizations are applied every time i compile some application (i actually see them printed many times among the lines scrolling in the console..)

When i compile a Kernel, on the other hand, i have no feedback if the CFLAGS that are set in my .bashrc are taken in consideration or not...

what can you tell me about this..?

THX!
Tomm
You can see the actual commands that are being run by setting V=1 on the command-line to make, e.g.:

Code:
make V=1 ...
linuxubuntu JohnGraham is offline     Reply With Quote
Thanked by:
Old 10-27-2009, 12:03 PM   #3
xirtyllo
LQ Newbie
 
Registered: Oct 2009
Location: Netherlands
Distribution: Slackware 13
Posts: 13
Thanked: 0

Original Poster
THanks!!
great tip, i'll try it soon!

but by the way, is .bashrc the right way to set the CFLAGS (i use Slackware 13) or are there better methods?

Searching on google i saw someone putting the CFLAGS argument just after the make bzImage command...
windows_xp_2003 xirtyllo is offline     Reply With Quote
Old 10-27-2009, 12:39 PM   #4
JohnGraham
Member
 
Registered: Oct 2009
Posts: 65
Thanked: 12
Quote:
Originally Posted by xirtyllo View Post
THanks!!
great tip, i'll try it soon!

but by the way, is .bashrc the right way to set the CFLAGS (i use Slackware 13) or are there better methods?

Searching on google i saw someone putting the CFLAGS argument just after the make bzImage command...
Yeah, putting CFLAGS on the make command-line works in the same way as the command I showed earlier - e.g:

Code:
export CFLAGS='-flag'
make
is the same as:

Code:
make CFLAGS='-flag'
...BUT this is only because of the way the `make' program parses its arguments - don't expect that to work for other programs.

As for if there are 'better' methods, I personally prefer to set CFLAGS on the make command-line, or manually in the environment before a particular compilation, and not in any configuration files. This is simply because I might forget about it and have it infest a compilation I don't want to.

Oh, and just in case you're wanting to compile the kernel with `-O3' (I'm getting that feeling from you ), you should definitely make sure you can compile a kernel AND get it working without setting any `-O*' CFLAGS - the Linux kernel is a big system, and if I remember correctly, compiling with `-O3' is basically guaranteed to break it. By all means try it, but make sure you can do it without -O3 first, so if it does fail to build/run, you know why.

John G
linuxubuntu JohnGraham is offline     Reply With Quote
Thanked by:
Old 11-02-2009, 02:30 AM   #5
xirtyllo
LQ Newbie
 
Registered: Oct 2009
Location: Netherlands
Distribution: Slackware 13
Posts: 13
Thanked: 0

Original Poster
Thx JohnGraham, it worked fine!
bythe way my kernel compiled with -O3 and works!
windows_xp_2003 xirtyllo is offline     Reply With Quote
Old 11-03-2009, 04:27 AM   #6
JohnGraham
Member
 
Registered: Oct 2009
Posts: 65
Thanked: 12
Quote:
Originally Posted by xirtyllo View Post
Thx JohnGraham, it worked fine!
bythe way my kernel compiled with -O3 and works!
Nice one - I stand corrected

John G
linuxubuntu JohnGraham is offline     Reply With Quote

Reply

Bookmarks


Thread Tools

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
Linux kernel API. Cflags needed? rvca Programming 2 02-28-2008 01:20 AM
Compiling w/ CFLAGS=-O2 matsko Linux - Software 6 05-03-2007 07:28 PM
Compiling Xmame - which CFlags in makefile? lets-eat-gary Linux - Games 2 03-12-2005 06:15 AM
CFLAGS to compile kernel frzburn Linux - Software 4 03-05-2005 06:42 AM
./configure, CFLAGS, checkinstall, and kernel arch type rgiggs Slackware 3 12-28-2004 02:39 AM


All times are GMT -5. The time now is 08:05 PM.

Main Menu
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
RSS2  LQ Podcast
RSS2  LQ Radio
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration