I've been googling and reading up on how to set build optimizations for my system, and after consulting the Arch Wiki, old threads here, and some mailing lists, I've concluded that the way to set CFLAGS, etc. is by putting this in /etc/profile:
Code:
export CHOST="x86_64-unknown-linux-gnu"
export CFLAGS="-march=native -O2 -pipe"
export CXXFLAGS="$CFLAGS"
export MAKEFLAGS="-j3"
However, I'm not sure if this is correct, since a lot of the sources I checked out were for other Linux distributions and even FreeBSD. I have these questions:
Do I need to put "export" before each line, or would it be sufficient to just have the rest (omitting "export")?
I have export CXXFLAGS="$CFLAGS". On the Arch Wiki, it says to put CXXFLAGS="${CFLAGS}", and in another source it says to just put CXXFLAGS=$CFLAGS. Which one is correct for Slackware?
I set MAKEFLAGS to "-j3" because I have a dual core Intel Core 2 Duo processor, but I've also seen this put as MAKEOPTS. Am I looking for MAKEFLAGS, MAKEOPTS or something else?
For my CHOST, would it be sufficient to put "x86_64" instead of "x86_64-unknown-linux-gnu"? Is it even supposed to be CHOST, or should I be setting ARCH?
I'm running Slackware64 v13.0.
I set my CFLAGS to --march=native because according to the Arch Wiki, gcc is able to detect all possible optimizations and enable them after version 4.3.0, and Slackware has 4.3.3. Is it correct to assume this works fine on Slackware?
Thanks for any help. Hopefully this thread will clear some things up for others wondering about the same topic, too.