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>

Conflicts:
	core/combo/select.mk
Aprof Interpreter : Android Profiler Interpreter

Change-Id: Ibfcf596d2968f5acc178d98f891185fb4fa77fb5
Fix determination of java version

The script requires the java version to be on
line one of the output of `java -version`.
If you use _JAVA_OPTIONS to inject parameters
to each JVM, that will produce an output before
each VM is started, and the script won't be able
to find the java version, since `head -n 1` now
returns the wrong line. Grep for 'version' instead
to always get the right line from the output.

Change-Id: Iaf2798ba805d1b289b7e82239113b99479250dd8
Signed-off-by: Tim Roes <mail@timroes.de>

Conflicts:
	core/main.mk
Fix parsing string parameters in BOARD_MKBOOTIMG_ARGS

The existing logic in common.py breaks string arguments incorrectly:
e.g. --para1 val1 --para2 "val2 is a string" will be output as:

'--para', 'val1, '--para2', 'val2' 'is' 'a' 'string'

This will cause mkbootimg command fails due to the invalid arguments
generated from the wrong parsing.

The patch fixes this issue to get:

'--para', 'val1, '--para2', 'val2 is a string'

Change-Id: Ia34ec357550f11ae9d6adc719d86a0c6a9099fbc
Signed-off-by: Jianxun Zhang <jianxun.zhang@intel.com>
Add checksyntax

With "checksyntax", build system invokes "clang -fsyntax-only"
to utilize clang's better diagnostic before calling LOCAL_CC for
code generation.  The compilation time is slightly longer, and
the generated object file should be the same as w/o "checksyntax"

Change-Id: I5689586788ef049bd967364f71f31f1e359bd121
Re-tighten default compiler options.

Remove "-Wno-unused-parameter -Wno-unused-but-set-parameter" added for
GCC 4.8 experiment.

BUG: 10495043
(cherry picked from internal master 1cea0755f400c1d183d22679d5b931c3a04ae4a4)

Change-Id: Ifa221709b1351a9268c06872e2b667138995c3da