build: Don't work around cortex-a8 issues when targeting a9 only

Don't work around cortex-a8 issues when other compiler flags
show we want to target cortex-a9 only

Change-Id: If5a077243fc15298fbcbe2ffc857b5e961dd29da
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
build: Add support for TARGET_EXTRA_C{,PP}FLAGS

Add support for setting TARGET_EXTRA_C{,PP}FLAGS in board configs.
This can be used to set compiler flags for a board that break other
boards, such as -march=cortex-a9 or -DUSE_CUSTOM_EXTENSIONS_FOR_XYZ

Change-Id: I0efd4e37578bf6d239bf56dfeeaaed44840ee3af
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
build/core: Use better default compiler flags

Use -O3 for the compiler, -O2 for the linker

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
build/core: Fix build errors

- Include task hooks only if they exists
- Fix typos

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>

Conflicts:
	core/legacy_prebuilts.mk
build/core: Don't use -fno-strict-aliasing

Don't use -fno-strict-aliasing: It's no longer needed.

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
build: Don't add -fno-strict-aliasing to HOST compiler flags

Change-Id: I07eef86f11ec3761e0922855cb6ff881c2773966
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
build: Explicitly disable -Werror=strict-alising for HOST builds

Change-Id: Ib1e834951196ab3ea6acbe47c27eebe5633f55d2
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
build: Add option to disable strict-aliasing optimizations

This is useful for builds that pull in unmodified AOSP repositories
that can't be compiled with strict-aliasing compliance enabled

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Set HAVE_UNWIND_CONTEXT_STRUCT for Clang

Change-Id: I423d650181c6736111e4a5e91ded81c471dd08e1
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
Cleanup build optimization flag whitespace
 4.8 GCC, Strict Aliasing=3, -O3 CFLAG, Opt Flags!!

For those of you who are building cm-11.0 with the neofy script,
none of this stuff applies to you as the script did it all for you ;)

To everyone else:
With this commit, you will be heavily modifying your build environment. What this
will do, is allow you the freedom of using any custom toolchain of your choice,
provided you follow two simple rules:

RULE #1: Both the androideabi and armeabi toolchain folders of your choice HAVE to
be named like the following:

for androideabi, the folder has to be prefixed with: arm-linux-androideabi-
and for arm-eabi, the folder has to be prefixed with: arm-eabi-

ex:

If you want to use GCC-4.8 as your toolchain of choice, both the androideabi and
armeabi folders have to look like this:

arm-linux-androideabi-4.8
arm-eabi-4.8

if you want them to be different, say, 4.8 for the arm-eabi and 4.9 for androideabi,
then they should look like this:

arm-eabi-4.8
arm-linux-androideabi-4.9

Take note, that if usining linaro, you will have to clone in the toolchain twice as
this method requires two different folders (the way it should be IMO). You would need
to rename one of the clones to arme-abi- and the other to arm-linux-androideabi-.

SECTION 2
RULE #2: The default configuration I've set is to build with GCC 4.8 for androideabi and 4.8 for
armeabi by default (in core/combo/TARGET_linux-arm.mk lines 50-51) unless you specify an alternate
target chain on those two lines! So if you want to use a different chain, you'll
need to change the build numbers on those two lines. for Example:

Say you wanted to use a 4.7 chain instead for armeabi and 4.8 for androideabi.. You would
change lines 50 and 51 to the following:

TARGET_GCC_VERSION_ARM := 4.7
TARGET_GCC_VERSION_AND := 4.8

Notice at the end of each line one is for ARM and one is for AND which hints at armeabi
and androideabi and the only thing you're changing is the number.

You also need to make sure rule number 1 is observed if you do this.. Can't build with
an alternate chain if one is not present ;) Personally, I've found the following two
toolchains to be the best without any drawback to rom (sans ART) courtesy of sparksco:

https://github.com/SaberMod/android_prebuilts_gcc_linux-x86_arm_sabermod-arm-eabi-4.8
https://github.com/SaberMod/android_prebuilts_gcc_linux-x86_arm_sabermod-arm-linux-androideabi-4.8

MAKE SURE YOU PULL BOTH FROM THE sm-kk-mr1 BRANCH IF YOU DECIDE TO USE THESE CHAINS!

This build commit also changes your global compiler ARM flags to -O3. -O3 is an option
that enables all -O1 and -O2 flag options as well as some heavy -O3 flag options that build
for optimized performance!

This commit also adds a few optimization flags that I've pre-selected for added performance.

This commit also builds the entire rom using a Strict Aliasing rule set at the highest level
of =3 and set to error on every strict aliasing issue. Make sure that you have all the
proper strict aliasing commits needed! If you can't find them, they will be
available to you on my github account at https://github.com/IAmTheOneTheyCallNeo

to make your search for all those needed easier, you can find all of them in the following script:
https://github.com/vigor/android/blob/cm-11.0/neofy.sh

Contact me if you have any issues and I will help you when and if I can.

-Neo

Conflicts:
	core/combo/TARGET_linux-arm.mk
	core/combo/select.mk
	core/tasks/kernel.mk
	envsetup.sh
Change default toolchains/fix toolchain flags

Conflicts:
	core/dumpvar.mk
	core/linaro_compilerchecks.mk
Revert "Don't set CCACHE_BASEDIR if its already set"

This reverts commit 3bb6b8b4af13ee45ff0f4a1246126f4fc549d2bc.
Revert "build: Set ccache base to build top"

This reverts commit db07c525b1f1e49c7541d2243ceb57dd851c33b7.
build: use the system's ccache by default

ccache 3.x supports direct mode (http://ccache.samba.org/manual.html#_the_direct_mode)
This is not supported in the prebuilt version.
Direct mode has been shown to decrease build time compared to the ccache in prebuilts

Note: this will require your cache to be recreated

Change-Id: Ib146011a3330637c2d306d329fcb39cea058ff12
build: Set ccache base to build top

This enables ccache sharing between different build tree paths.

Change-Id: I99636bdd2779a6ccf0649f027e35cf67df44b6ae
Don't set CCACHE_BASEDIR if its already set

 * enable use of shared ccache

Change-Id: Ic708a5d5169291d674b167aa2c87bf2c8adaafae
Let the variables do their jobs

We dont want to hard code the flags here as it will override device BoardConfig.

This will build ROM 4.8 and Kernel 4.7 as default and still allow you to change them if you want. To build with other toolchains add these flags to your BoardConfig

TARGET_GCC_VERSION_AND := (ROM Toolchain to use)
TARGET_GCC_VERSION_ARM := (Kernel toolchain to use)

If a flag is not set, it will go back to the default value
Update to use samermod as default

Just cause it's much more goodlier
set cortex-a8 optimization for scorpion

Change-Id: I401fecf5314e854a2a0b3bb2f9b6f6afb3a1b4b4