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