]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cmake: wrapper nasm as assembler to deal with some options
authorChangcheng Liu <changcheng.liu@aliyun.com>
Thu, 22 Oct 2020 05:05:17 +0000 (13:05 +0800)
committerChangcheng Liu <changcheng.liu@aliyun.com>
Thu, 29 Oct 2020 04:35:26 +0000 (12:35 +0800)
1. unify some options, such as "-I -isystem"
2. ignore some known options, such as "-W*"
3. ignore some unknown options, such as '-fPIC"

Signed-off-by: Changcheng Liu <changcheng.liu@aliyun.com>
src/nasm-wrapper [new file with mode: 0755]

diff --git a/src/nasm-wrapper b/src/nasm-wrapper
new file mode 100755 (executable)
index 0000000..9e480ff
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/bash -e
+
+refine_nasm_options=""
+while [ -n "$*" ]; do
+    case "$1" in
+    -f )
+        shift
+        refine_nasm_options="$refine_nasm_options -f $1"
+        shift
+        ;;
+    -c | --param* | -m* | -pipe | -thread )
+        # unknown options under nasm & yasm
+        shift
+        ;;
+    -g* )
+        # ignore debug format
+        shift
+        ;;
+    -W* )
+        # Warning/error option
+        shift
+        ;;
+    -f* )
+        shift
+        ;;
+    -I | -isystem )
+        shift
+        refine_nasm_options="$refine_nasm_options -i $1"
+        shift
+        ;;
+    * )
+        # Keep other options
+        refine_nasm_options="$refine_nasm_options $1"
+        shift
+        ;;
+    esac
+done
+
+nasm $refine_nasm_options
+
+true