DO NOT MERGE - Merge pi-dev@5234907 into stage-aosp-master

Bug: 120848293
Change-Id: I13381ac3427156315708f3bfe7f758327ae17dd9
diff --git a/Android.bp b/Android.bp
index 344e6ee..ebd9400 100644
--- a/Android.bp
+++ b/Android.bp
@@ -69,13 +69,11 @@
         "-Wno-unused-parameter",
         "-Wno-missing-field-initializers",
         "-fvisibility=hidden",
-        "-fPIC",
         "-fno-tree-sra",
         "-Wno-psabi",
         "-ffunction-sections",
         "-funwind-tables",
         "-g",
-        "-fstack-protector",
         "-fno-short-enums",
         "-finline-limit=64",
         "-Wa,--noexecstack",
@@ -140,4 +138,20 @@
     },
 
     export_include_dirs: ["cpp/src"],
+
+    target: {
+        android: {
+            cflags: ["-fPIC"],
+        },
+        not_windows: {
+            cflags: ["-fPIC"],
+        },
+        windows: {
+            enabled: true,
+            // "-fstack-protector" is not used by default on Windows, and enabling it
+            // on one library only prevents this library from being linked successfully
+            // when used as a dependency. So we disable it for Windows.
+            cflags: ["-fno-stack-protector"],
+        },
+    },
 }