From 0042d244d48fa37995155682ed98987ba9f2c4af Mon Sep 17 00:00:00 2001 From: Changcheng Liu Date: Thu, 22 Oct 2020 13:05:17 +0800 Subject: [PATCH] cmake: wrapper nasm as assembler to deal with some options 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 --- src/nasm-wrapper | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 src/nasm-wrapper diff --git a/src/nasm-wrapper b/src/nasm-wrapper new file mode 100755 index 0000000000000..9e480ff694101 --- /dev/null +++ b/src/nasm-wrapper @@ -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 -- 2.39.5