LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
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 06-16-2005, 11:02 AM   #1
TieN
LQ Newbie
 
Registered: Feb 2003
Location: UK
Distribution: Slackware/Gentoo
Posts: 19

Rep: Reputation: 0
export CFLAGS GCC help


Hi all i hope this is the correct place to post this question!

I am trying to put the following optimisations into a script that i can call if i want to compile apache (or anything) for a web server. I can do an "export" on the command line and see these variables using env but if i put them in an (chmod 755) file then run it they seem not to be set. I am running slackware 10.1 and manually created /etc/bashrc with these entrys but with no joy. I also tried to add them to the /etc/profile.

export CFLAGS="-O2 -march=pentium4"
export MAKEOPTS="-j5"
export CXXFLAGS=$CFLAGS

my eventual goal is to be able to build any software without specifically typing these 3 lines.


Thanks in advance.
 
Old 06-16-2005, 11:31 AM   #2
perfect_circle
Senior Member
 
Registered: Oct 2004
Location: Athens, Greece
Distribution: Slackware, arch
Posts: 1,783

Rep: Reputation: 53
Re: export CFLAGS GCC help

Quote:
Originally posted by TieN
Hi all i hope this is the correct place to post this question!

I am trying to put the following optimisations into a script that i can call if i want to compile apache (or anything) for a web server. I can do an "export" on the command line and see these variables using env but if i put them in an (chmod 755) file then run it they seem not to be set. I am running slackware 10.1 and manually created /etc/bashrc with these entrys but with no joy. I also tried to add them to the /etc/profile.

export CFLAGS="-O2 -march=pentium4"
export MAKEOPTS="-j5"
export CXXFLAGS=$CFLAGS

my eventual goal is to be able to build any software without specifically typing these 3 lines.


Thanks in advance.
In 99% of the cases you do this when you compile program:
Code:
CFLAGS="-O2 -march=pentium4" ./configure
I would stay with this. Making those changes global can only cause trouble

You could also put them in a script in /usr/local/bin and call the script every time you run configure,

something like my_flags:
Code:
 #!/bin/bash
CFLAGS="-O2 -march=pentium4" MAKEOPTS="-j5" CXXFLAGS=$CFLAGS "$1"
then try :
Code:
my_flags ./configure
 
Old 06-17-2005, 03:24 AM   #3
TieN
LQ Newbie
 
Registered: Feb 2003
Location: UK
Distribution: Slackware/Gentoo
Posts: 19

Original Poster
Rep: Reputation: 0
Thanks for the reply, i see that setting these options globally maybe just asking for some problems but i still cannot put these lines in a script and work - if i do an env after i have run the script i see no entries for CFLAGS or MAKEOPTS but if i type them directly to the command line and do an env i can see these settings set, this is my problem.

Again thanks for the help.
 
  


Reply



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
cflags exodist Linux - Software 2 01-14-2005 07:44 PM
Using CFLAGS and other options vexer Linux From Scratch 7 08-18-2004 09:04 AM
CFLAGS library -l and -i abs Programming 2 04-11-2004 10:03 PM
how to unset cflags? shanenin Linux - Software 4 01-25-2004 09:36 PM
export CC=/usr/bin/gcc-3.2 - switch gcc version? ferreter Linux - Software 1 08-20-2003 12:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:48 PM.

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
Open Source Consulting | Domain Registration