1#! /bin/sh 2command="" 3infile="" 4o_opt=no 5pic=no 6while [ $# -gt 0 ]; do 7 case "$1" in 8 --silent) 9 exec > /dev/null 10 ;; 11 -DPIC|-fPIC|-fpic|-Kpic|-KPIC) 12 if [ "$pic" != "yes" ] ; then 13 command="$command -DPIC" 14 pic=yes 15 fi 16 ;; 17 -f|-fbin|-faout|-faoutb|-fcoff|-felf|-felf64|-fas86| \ 18 -fobj|-fwin32|-fwin64|-frdf|-fieee|-fmacho|-fmacho64) 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 52done 53if [ "$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" 58fi 59echo $command 60exec $command 61