cc: make static or shared cflags apply to all source files

Make static or shared cflags properties apply to all source files,
not just the source files defined in the static or shared block.
Needed for libunwind, which passes -DUNW_ADDITIONAL_PREFIX to source
files for the static library, but not for the shared library.

Change-Id: I3cd88cc1099e505eeee077c697db00de22a8b03a
diff --git a/cc/cc.go b/cc/cc.go
index df5fc57..5d6e124 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -1028,6 +1028,12 @@
 
 	flags.CFlags = append(flags.CFlags, "-fPIC")
 
+	if c.static() {
+		flags.CFlags = append(flags.CFlags, c.LibraryProperties.Static.Cflags...)
+	} else {
+		flags.CFlags = append(flags.CFlags, c.LibraryProperties.Shared.Cflags...)
+	}
+
 	if !c.static() {
 		libName := ctx.ModuleName()
 		// GCC for Android assumes that -shared means -Bsymbolic, use -Wl,-shared instead
@@ -1053,7 +1059,6 @@
 	flags CCFlags, deps CCDeps, objFiles []string) {
 
 	staticFlags := flags
-	staticFlags.CFlags = append(staticFlags.CFlags, c.LibraryProperties.Static.Cflags...)
 	objFilesStatic := c.customCompileObjs(ctx, staticFlags, common.DeviceStaticLibrary,
 		c.LibraryProperties.Static.Srcs)
 
@@ -1076,7 +1081,6 @@
 	flags CCFlags, deps CCDeps, objFiles []string) {
 
 	sharedFlags := flags
-	sharedFlags.CFlags = append(sharedFlags.CFlags, c.LibraryProperties.Shared.Cflags...)
 	objFilesShared := c.customCompileObjs(ctx, sharedFlags, common.DeviceSharedLibrary,
 		c.LibraryProperties.Shared.Srcs)