4 # Wrapper around MS's cl.exe and link.exe to make them act more like
7 # Copyright (C) 2000-2003 Geoffrey Wossum (gwossum@acm.org)
9 # This program is free software; you can redistribute it and/or modify
10 # it under the terms of the GNU General Public License as published by
11 # the Free Software Foundation; either version 2 of the License, or
12 # (at your option) any later version.
14 # This program is distributed in the hope that it will be useful, but
15 # WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 # General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 cccl is a wrapper around Microsoft's cl.exe and link.exe. It translates
30 parameters that Unix cc's and ld's understand to parameters that cl and link
44 # prog specifies the program that should be run (cl.exe or link.exe)
45 # We'll assume cl to start out
47 # opts specifies the command line to pass to the MSVC program
48 clopt="${slash}nologo"
49 linkopt="${slash}nologo"
50 # gotparam is 0 if we didn't ever see a param, in which case we show usage()
54 clopt="$clopt ${slash}EHsc"
56 ### Run through every option and convert it to the proper MS one
57 while test $# -gt 0; do
60 -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
70 Copyright 2000-2003 Geoffrey Wossum
71 This is free software; see the source for copying conditions. There is NO
72 waranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
78 clopt="$clopt ${slash}Za"
82 # -c (compile only) is actually the same, but for clarity...
83 clopt="$clopt ${slash}c"
87 # cl only supports one debugging level
88 clopt="$clopt ${slash}Zi"
89 linkopt="$linkopt ${slash}DEBUG"
93 path=`echo "$1" | sed 's/-L//'`
94 linkopt="$linkopt ${slash}LIBPATH:\"$path\""
95 cl_linkopt="${slash}link ${slash}LIBPATH:\"$path\""
99 lib=`echo "$1" | sed 's/-l//'`
103 linkopt="$linkopt $lib"
107 clopt="$clopt ${slash}G3"
111 clopt="$clopt ${slash}G4"
115 clopt="$clopt ${slash}G5"
119 clopt="$clopt ${slash}G6"
123 # specifying output file, is it an object or an executable
127 clopt="$clopt ${slash}Fo$1"
130 clopt="$clopt ${slash}Fe$1";
131 linkopt="$linkopt ${slash}out:$1"
156 # C++ source file with non .cpp extension, make sure cl understand
158 clopt="$clopt ${slash}Tp$1"
161 *.o | *.obj | *.a | *.lib)
162 # Object files/libraries seen, this command will require link
163 # Switch the prog to link
164 linkopt="$linkopt $1"
170 linkopt="$linkopt $1"
171 if test x$optarg != x ; then
172 clopt="$clopt=$optarg"
173 linkopt="$linkopt=$optarg"
181 if test x$gotparam = x ; then
186 # choose which opts we built up based on which program will actually run
187 if test x$prog = xcl ; then
188 opts="$clopt $cl_linkopt"