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>
--- /dev/null
+#!/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