MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | command="" |
| 3 | infile="" |
| 4 | o_opt=no |
| 5 | pic=no |
| 6 | while [ $# -gt 0 ]; do |
| 7 | case "$1" in |
DRC | 8a26fde | 2010-02-16 22:34:12 +0000 | [diff] [blame] | 8 | -DPIC|-fPIC|-fpic|-Kpic|-KPIC) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 9 | if [ "$pic" != "yes" ] ; then |
| 10 | command="$command -DPIC" |
| 11 | pic=yes |
| 12 | fi |
| 13 | ;; |
DRC | cdc8ac3 | 2009-06-25 20:38:31 +0000 | [diff] [blame] | 14 | -f|-fbin|-faout|-faoutb|-fcoff|-felf|-felf64|-fas86| \ |
DRC | 8b014d7 | 2010-02-18 13:03:41 +0000 | [diff] [blame] | 15 | -fobj|-fwin32|-fwin64|-frdf|-fieee|-fmacho|-fmacho64) |
MIYASAKA Masaru | a2e6a9d | 2006-02-04 00:00:00 +0000 | [diff] [blame] | 16 | # it's a file format specifier for nasm. |
| 17 | command="$command $1" |
| 18 | ;; |
| 19 | -f*) |
| 20 | # maybe a code-generation flag for gcc. |
| 21 | ;; |
| 22 | -[Ii]*) |
| 23 | incdir=`echo "$1" | sed 's/^-[Ii]//'` |
| 24 | if [ "x$incdir" = x -a "x$2" != x ] ; then |
| 25 | case "$2" in |
| 26 | -*) ;; |
| 27 | *) incdir="$2"; shift;; |
| 28 | esac |
| 29 | fi |
| 30 | if [ "x$incdir" != x ] ; then |
| 31 | # In the case of NASM, the trailing slash is necessary. |
| 32 | incdir=`echo "$incdir" | sed 's%/*$%/%'` |
| 33 | command="$command -I$incdir" |
| 34 | fi |
| 35 | ;; |
| 36 | -o*) |
| 37 | o_opt=yes |
| 38 | command="$command $1" |
| 39 | ;; |
| 40 | *.asm) |
| 41 | infile=$1 |
| 42 | command="$command $1" |
| 43 | ;; |
| 44 | *) |
| 45 | command="$command $1" |
| 46 | ;; |
| 47 | esac |
| 48 | shift |
| 49 | done |
| 50 | if [ "$o_opt" != yes ] ; then |
| 51 | # By default, NASM creates an output file |
| 52 | # in the same directory as the input file. |
| 53 | outfile="-o `echo $infile | sed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.o" |
| 54 | command="$command $outfile" |
| 55 | fi |
| 56 | echo $command |
| 57 | exec $command |