blob: 817be1612acb3378ba26b6c0919ced55bd261fef [file] [log] [blame]
MIYASAKA Masarua2e6a9d2006-02-04 00:00:00 +00001#! /bin/sh
2command=""
3infile=""
4o_opt=no
5pic=no
6while [ $# -gt 0 ]; do
7 case "$1" in
DRC3b7015d2015-02-23 19:03:29 +00008 --silent)
9 exec > /dev/null
10 ;;
DRC8a26fde2010-02-16 22:34:12 +000011 -DPIC|-fPIC|-fpic|-Kpic|-KPIC)
MIYASAKA Masarua2e6a9d2006-02-04 00:00:00 +000012 if [ "$pic" != "yes" ] ; then
13 command="$command -DPIC"
14 pic=yes
15 fi
16 ;;
DRCcdc8ac32009-06-25 20:38:31 +000017 -f|-fbin|-faout|-faoutb|-fcoff|-felf|-felf64|-fas86| \
DRC8b014d72010-02-18 13:03:41 +000018 -fobj|-fwin32|-fwin64|-frdf|-fieee|-fmacho|-fmacho64)
MIYASAKA Masarua2e6a9d2006-02-04 00:00:00 +000019 # 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