summaryrefslogtreecommitdiffstats
path: root/src/nasm-wrapper
blob: 84da2cb23e2dfc86c6355d2eba67af2b4930ef43 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env bash 

set -e

refine_nasm_options=""
while [ -n "$*" ]; do
    case "$1" in
    -f )
        shift
        refine_nasm_options+=" -f $1"
        shift
        ;;
    -c | --param* | -m* | -pipe | -thread )
        # unknown options under nasm & yasm
        shift
        ;;
    -g* )
        # ignore debug format
        shift
        ;;
    -MD )
        # before CMake v3.18, its ninja build rule always passes `-MD $DEP_FILE``
        # to ASM_COMPILER. both nasm and GNU assembler accepts this option, but
        # somehow the ninja generator fails to pass the <DEPFILE> argument. so
        # just drop it.
        shift
        ;;
    -W* )
        # Warning/error option
        shift
        ;;
    -f* )
        shift
        ;;
    -I | -isystem )
        shift
        refine_nasm_options+=" -i $1"
        shift
        ;;
    -O* )
        # ignore C optimisations
        shift
        ;;
    * )
        # Keep other options
        refine_nasm_options+=" $1"
        shift
        ;;
    esac
done

nasm $refine_nasm_options

true