summaryrefslogtreecommitdiff
path: root/deps/gyp/test/assembly/src
diff options
context:
space:
mode:
Diffstat (limited to 'deps/gyp/test/assembly/src')
-rw-r--r--deps/gyp/test/assembly/src/as.bat4
-rw-r--r--deps/gyp/test/assembly/src/assembly.gyp62
-rw-r--r--deps/gyp/test/assembly/src/lib1.S15
-rw-r--r--deps/gyp/test/assembly/src/lib1.c3
-rw-r--r--deps/gyp/test/assembly/src/override.gyp34
-rw-r--r--deps/gyp/test/assembly/src/override_asm.asm8
-rw-r--r--deps/gyp/test/assembly/src/program.c12
7 files changed, 138 insertions, 0 deletions
diff --git a/deps/gyp/test/assembly/src/as.bat b/deps/gyp/test/assembly/src/as.bat
new file mode 100644
index 0000000000..b796db97ca
--- /dev/null
+++ b/deps/gyp/test/assembly/src/as.bat
@@ -0,0 +1,4 @@
+@echo off
+:: Mock windows assembler.
+cl /MD /c %1 /Fo"%2"
+
diff --git a/deps/gyp/test/assembly/src/assembly.gyp b/deps/gyp/test/assembly/src/assembly.gyp
new file mode 100644
index 0000000000..565cb0fa0e
--- /dev/null
+++ b/deps/gyp/test/assembly/src/assembly.gyp
@@ -0,0 +1,62 @@
+# 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.
+
+{
+ 'target_defaults': {
+ 'conditions': [
+ ['OS=="win"', {
+ 'defines': ['PLATFORM_WIN'],
+ }],
+ ['OS=="mac" or OS=="ios"', {
+ 'defines': ['PLATFORM_MAC'],
+ }],
+ ['OS=="linux"', {
+ 'defines': ['PLATFORM_LINUX'],
+ }],
+ ['OS=="android"', {
+ 'defines': ['PLATFORM_ANDROID'],
+ }],
+ ],
+ },
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'dependencies': ['lib1'],
+ 'sources': [
+ 'program.c',
+ ],
+ },
+ {
+ 'target_name': 'lib1',
+ 'type': 'static_library',
+ 'sources': [
+ 'lib1.S',
+ ],
+ },
+ ],
+ 'conditions': [
+ ['OS=="win"', {
+ 'target_defaults': {
+ 'rules': [
+ {
+ 'rule_name': 'assembler',
+ 'msvs_cygwin_shell': 0,
+ 'extension': 'S',
+ 'inputs': [
+ 'as.bat',
+ ],
+ 'outputs': [
+ '<(INTERMEDIATE_DIR)/<(RULE_INPUT_ROOT).obj',
+ ],
+ 'action':
+ ['as.bat', 'lib1.c', '<(_outputs)'],
+ 'message': 'Building assembly file <(RULE_INPUT_PATH)',
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ },
+ },],
+ ],
+}
diff --git a/deps/gyp/test/assembly/src/lib1.S b/deps/gyp/test/assembly/src/lib1.S
new file mode 100644
index 0000000000..7de9f19cf9
--- /dev/null
+++ b/deps/gyp/test/assembly/src/lib1.S
@@ -0,0 +1,15 @@
+#if PLATFORM_WINDOWS || PLATFORM_MAC
+# define IDENTIFIER(n) _##n
+#else /* Linux */
+# define IDENTIFIER(n) n
+#endif
+
+.globl IDENTIFIER(lib1_function)
+IDENTIFIER(lib1_function):
+#if !defined(PLATFORM_ANDROID)
+ movl $42, %eax
+ ret
+#else /* Android (assuming ARM) */
+ mov r0, #42
+ bx lr
+#endif
diff --git a/deps/gyp/test/assembly/src/lib1.c b/deps/gyp/test/assembly/src/lib1.c
new file mode 100644
index 0000000000..be21ecd5f6
--- /dev/null
+++ b/deps/gyp/test/assembly/src/lib1.c
@@ -0,0 +1,3 @@
+int lib1_function(void) {
+ return 42;
+}
diff --git a/deps/gyp/test/assembly/src/override.gyp b/deps/gyp/test/assembly/src/override.gyp
new file mode 100644
index 0000000000..39a4072eff
--- /dev/null
+++ b/deps/gyp/test/assembly/src/override.gyp
@@ -0,0 +1,34 @@
+# Copyright (c) 2012 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.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'program',
+ 'type': 'executable',
+ 'sources': [
+ 'program.c',
+ 'override_asm.asm',
+ ],
+ 'rules': [
+ {
+ # Test that if there's a specific .asm rule, it overrides the
+ # built in one on Windows.
+ 'rule_name': 'assembler',
+ 'msvs_cygwin_shell': 0,
+ 'extension': 'asm',
+ 'inputs': [
+ 'as.bat',
+ ],
+ 'outputs': [
+ 'output.obj',
+ ],
+ 'action': ['as.bat', 'lib1.c', '<(_outputs)'],
+ 'message': 'Building assembly file <(RULE_INPUT_PATH)',
+ 'process_outputs_as_sources': 1,
+ },
+ ],
+ },
+ ],
+}
diff --git a/deps/gyp/test/assembly/src/override_asm.asm b/deps/gyp/test/assembly/src/override_asm.asm
new file mode 100644
index 0000000000..be93b23baa
--- /dev/null
+++ b/deps/gyp/test/assembly/src/override_asm.asm
@@ -0,0 +1,8 @@
+; Copyright (c) 2012 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 is a placeholder. It should not be referenced if overrides work
+; correctly.
+
+Bad stuff that shouldn't assemble.
diff --git a/deps/gyp/test/assembly/src/program.c b/deps/gyp/test/assembly/src/program.c
new file mode 100644
index 0000000000..eee862712e
--- /dev/null
+++ b/deps/gyp/test/assembly/src/program.c
@@ -0,0 +1,12 @@
+#include <stdio.h>
+
+extern int lib1_function(void);
+
+int main(void)
+{
+ fprintf(stdout, "Hello from program.c\n");
+ fflush(stdout);
+ fprintf(stdout, "Got %d.\n", lib1_function());
+ fflush(stdout);
+ return 0;
+}