summaryrefslogtreecommitdiffstats
path: root/third_party/python/gyp/test/rules/src/subdir4
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/python/gyp/test/rules/src/subdir4')
-rw-r--r--third_party/python/gyp/test/rules/src/subdir4/asm-function.assem10
-rw-r--r--third_party/python/gyp/test/rules/src/subdir4/build-asm.gyp49
-rw-r--r--third_party/python/gyp/test/rules/src/subdir4/program.c19
3 files changed, 78 insertions, 0 deletions
diff --git a/third_party/python/gyp/test/rules/src/subdir4/asm-function.assem b/third_party/python/gyp/test/rules/src/subdir4/asm-function.assem
new file mode 100644
index 0000000000..ed47cade95
--- /dev/null
+++ b/third_party/python/gyp/test/rules/src/subdir4/asm-function.assem
@@ -0,0 +1,10 @@
+#if PLATFORM_WINDOWS || PLATFORM_MAC
+# define IDENTIFIER(n) _##n
+#else /* Linux */
+# define IDENTIFIER(n) n
+#endif
+
+.globl IDENTIFIER(asm_function)
+IDENTIFIER(asm_function):
+ movl $41, %eax
+ ret
diff --git a/third_party/python/gyp/test/rules/src/subdir4/build-asm.gyp b/third_party/python/gyp/test/rules/src/subdir4/build-asm.gyp
new file mode 100644
index 0000000000..fe0fe93787
--- /dev/null
+++ b/third_party/python/gyp/test/rules/src/subdir4/build-asm.gyp
@@ -0,0 +1,49 @@
+# Copyright (c) 2009 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# This one tests that assembly files ended as .s and .S are compiled.
+
+{
+ 'target_defaults': {
+ 'conditions': [
+ ['OS=="win"', {
+ 'defines': ['PLATFORM_WIN'],
+ }],
+ ['OS=="mac"', {
+ 'defines': ['PLATFORM_MAC'],
+ }],
+ ['OS=="linux"', {
+ 'defines': ['PLATFORM_LINUX'],
+ }],
+ ],
+ },
+ 'targets': [
+ {
+ 'target_name': 'program4',
+ 'type': 'executable',
+ 'sources': [
+ 'asm-function.assem',
+ 'program.c',
+ ],
+ 'conditions': [
+ ['OS=="linux" or OS=="mac"', {
+ 'rules': [
+ {
+ 'rule_name': 'convert_assem',
+ 'extension': 'assem',
+ 'inputs': [],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).S',
+ ],
+ 'action': [
+ 'bash', '-c', 'cp <(RULE_INPUT_PATH) <@(_outputs)',
+ ],
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ }],
+ ],
+ },
+ ],
+}
diff --git a/third_party/python/gyp/test/rules/src/subdir4/program.c b/third_party/python/gyp/test/rules/src/subdir4/program.c
new file mode 100644
index 0000000000..ad647f4eb9
--- /dev/null
+++ b/third_party/python/gyp/test/rules/src/subdir4/program.c
@@ -0,0 +1,19 @@
+#include <stdio.h>
+
+// Use the assembly function in linux and mac where it is built.
+#if PLATFORM_LINUX || PLATFORM_MAC
+extern int asm_function(void);
+#else
+int asm_function() {
+ return 41;
+}
+#endif
+
+int main(void)
+{
+ fprintf(stdout, "Hello from program.c\n");
+ fflush(stdout);
+ fprintf(stdout, "Got %d.\n", asm_function());
+ fflush(stdout);
+ return 0;
+}