Yarn: Remove BUILD_ASM define from build settings

This can be #defined in the assembly files, reducing per-build-system complexity.

Bug: b/139010488
Change-Id: Ided03000dc5e93e4d1e04ce6f0b57c6e45565545
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/35210
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 16f6867..d0e552e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -279,7 +279,7 @@
 ###########################################################
 
 # Run assembly files through the C preprocessor.
-SET(CMAKE_ASM_FLAGS "-x assembler-with-cpp -DBUILD_ASM=1")
+SET(CMAKE_ASM_FLAGS "-x assembler-with-cpp")
 
 # Flags for project code (non 3rd party)
 set(SWIFTSHADER_COMPILE_OPTIONS "")
diff --git a/src/Android.bp b/src/Android.bp
index a458859..e72bd6c 100644
--- a/src/Android.bp
+++ b/src/Android.bp
@@ -515,10 +515,6 @@
     cflags: [
         "-Wno-unused-parameter",
     ],
-
-    asflags: [
-        "-DBUILD_ASM",
-    ],
 }
 
 
diff --git a/src/Yarn/OSFiber_asm_aarch64.S b/src/Yarn/OSFiber_asm_aarch64.S
index 95abb06..6a15cc7 100644
--- a/src/Yarn/OSFiber_asm_aarch64.S
+++ b/src/Yarn/OSFiber_asm_aarch64.S
@@ -14,6 +14,7 @@
 
 #if defined(__aarch64__)
 
+#define YARN_BUILD_ASM 1
 #include "OSFiber_asm_aarch64.h"
 
 // void yarn_fiber_swap(yarn_fiber_context* from, const yarn_fiber_context* to)
diff --git a/src/Yarn/OSFiber_asm_aarch64.h b/src/Yarn/OSFiber_asm_aarch64.h
index d6b99ea..fa3456c 100644
--- a/src/Yarn/OSFiber_asm_aarch64.h
+++ b/src/Yarn/OSFiber_asm_aarch64.h
@@ -44,7 +44,7 @@
 #define YARN_ASM_SYMBOL(x) x
 #endif
 
-#ifndef BUILD_ASM
+#ifndef YARN_BUILD_ASM
 
 #include <stdint.h>
 
@@ -115,4 +115,4 @@
 static_assert(offsetof(yarn_fiber_context, LR)  == YARN_REG_LR,  "Bad register offset");
 #endif // __cplusplus
 
-#endif // BUILD_ASM
+#endif // YARN_BUILD_ASM
diff --git a/src/Yarn/OSFiber_asm_arm.S b/src/Yarn/OSFiber_asm_arm.S
index 9162f57..a810b33 100644
--- a/src/Yarn/OSFiber_asm_arm.S
+++ b/src/Yarn/OSFiber_asm_arm.S
@@ -14,6 +14,7 @@
 
 #if defined(__arm__)
 
+#define YARN_BUILD_ASM 1
 #include "OSFiber_asm_arm.h"
 
 // void yarn_fiber_swap(yarn_fiber_context* from, const yarn_fiber_context* to)
diff --git a/src/Yarn/OSFiber_asm_arm.h b/src/Yarn/OSFiber_asm_arm.h
index d40c8d4..641d614 100644
--- a/src/Yarn/OSFiber_asm_arm.h
+++ b/src/Yarn/OSFiber_asm_arm.h
@@ -34,7 +34,7 @@
 #define YARN_REG_SP  0x4c
 #define YARN_REG_LR  0x50
 
-#ifndef BUILD_ASM
+#ifndef YARN_BUILD_ASM
 #include <stdint.h>
 
 // Procedure Call Standard for the ARM 64-bit Architecture
@@ -96,4 +96,4 @@
 static_assert(offsetof(yarn_fiber_context, LR)  == YARN_REG_LR,  "Bad register offset");
 #endif // __cplusplus
 
-#endif // BUILD_ASM
+#endif // YARN_BUILD_ASM
diff --git a/src/Yarn/OSFiber_asm_x64.S b/src/Yarn/OSFiber_asm_x64.S
index 47af304..3232b71 100644
--- a/src/Yarn/OSFiber_asm_x64.S
+++ b/src/Yarn/OSFiber_asm_x64.S
@@ -14,6 +14,7 @@
 
 #if defined(__x86_64__)
 
+#define YARN_BUILD_ASM 1
 #include "OSFiber_asm_x64.h"
 
 // void yarn_fiber_swap(yarn_fiber_context* from, const yarn_fiber_context* to)
diff --git a/src/Yarn/OSFiber_asm_x64.h b/src/Yarn/OSFiber_asm_x64.h
index 420d578..506351c 100644
--- a/src/Yarn/OSFiber_asm_x64.h
+++ b/src/Yarn/OSFiber_asm_x64.h
@@ -29,7 +29,7 @@
 #define YARN_ASM_SYMBOL(x) x
 #endif
 
-#ifndef BUILD_ASM
+#ifndef YARN_BUILD_ASM
 
 #include <stdint.h>
 
@@ -66,4 +66,4 @@
 static_assert(offsetof(yarn_fiber_context, RIP) == YARN_REG_RIP, "Bad register offset");
 #endif // __cplusplus
 
-#endif // BUILD_ASM
+#endif // YARN_BUILD_ASM
diff --git a/src/Yarn/OSFiber_asm_x86.S b/src/Yarn/OSFiber_asm_x86.S
index a57d1d6..e1bb1f3 100644
--- a/src/Yarn/OSFiber_asm_x86.S
+++ b/src/Yarn/OSFiber_asm_x86.S
@@ -14,6 +14,7 @@
 
 #if defined(__i386__)
 
+#define YARN_BUILD_ASM 1
 #include "OSFiber_asm_x86.h"
 
 // void yarn_fiber_swap(yarn_fiber_context* from, const yarn_fiber_context* to)
diff --git a/src/Yarn/OSFiber_asm_x86.h b/src/Yarn/OSFiber_asm_x86.h
index 503bf8c..42f355f 100644
--- a/src/Yarn/OSFiber_asm_x86.h
+++ b/src/Yarn/OSFiber_asm_x86.h
@@ -19,7 +19,7 @@
 #define YARN_REG_ESP 0x10
 #define YARN_REG_EIP 0x14
 
-#ifndef BUILD_ASM
+#ifndef YARN_BUILD_ASM
 #include <stdint.h>
 
 // Assumes cdecl calling convention.
@@ -47,4 +47,4 @@
 static_assert(offsetof(yarn_fiber_context, EIP) == YARN_REG_EIP, "Bad register offset");
 #endif // __cplusplus
 
-#endif // BUILD_ASM
+#endif // YARN_BUILD_ASM