1 # $NetBSD: transform-sunpro-cc,v 1.30 2008/06/17 12:58:28 sketch Exp $
3 # Copyright (c) 2004 The NetBSD Foundation, Inc.
6 # This code is derived from software contributed to The NetBSD Foundation
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
12 # 1. Redistributions of source code must retain the above copyright
13 # notice, this list of conditions and the following disclaimer.
14 # 2. Redistributions in binary form must reproduce the above copyright
15 # notice, this list of conditions and the following disclaimer in the
16 # documentation and/or other materials provided with the distribution.
17 # 3. All advertising materials mentioning features or use of this software
18 # must display the following acknowledgement:
19 # This product includes software developed by the NetBSD
20 # Foundation, Inc. and its contributors.
21 # 4. Neither the name of The NetBSD Foundation nor the names of its
22 # contributors may be used to endorse or promote products derived
23 # from this software without specific prior written permission.
25 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26 # ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29 # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 # CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 # POSSIBILITY OF SUCH DAMAGE.
37 transform_setname "transform-sunpro-cc"
41 # libstdc++ is specific to the GNU C++ compiler.
42 -lstdc++ ) transform_discard_with_warning ;;
44 # Standard options, except -O0 and -O1.
46 -[DILlU]?* ) transform_pass ;;
48 # Create dependency lines for Makefiles
49 -MM ) transform_to "-xM1" ;;
51 # SunPro can handle -xO<n> (n={0|1|2|3|4|5}), so optimistically
52 # convert those GCC -O<n> values to -xO<n>.
53 -O[012345] ) transform_to "-xO${arg#-O}" ;;
55 # Ignore all other -O* options.
56 -O* ) transform_discard_with_warning ;;
58 # Directories for the runtime library search path are passed via
59 # simply "-R<dir>", not "-Wl,-R<dir>". This is because the C++ compiler
60 # does not know about the -W?,* options.
61 -Wl,-R* ) transform_to "${arg#-Wl,}" ;;
62 -R* ) transform_pass ;;
64 # SunPro uses -h to set the shared object name.
65 -Wl,-soname=* ) transform_to "-h${arg#-Wl,-soname=}" ;;
67 # Solaris' linker exports all dynamic symbols by default when
68 # building a shared object.
70 -Wl,--export-dynamic |\
71 -Wl,-E ) transform_discard ;;
73 -W[02aclmop],* ) case $wrapper_type in
75 CXX) transform_discard_with_warning ;;
76 *) echo "ERROR: [transform-sunpro-cc] unknown wrapper type: $wrapper_type"; exit 1 ;;
80 -W ) case $wrapper_type in
81 CC) transform_to "-v" ;;
82 CXX) transform_to_and_split "+w +w2" ;;
83 *) echo "ERROR: [transform-sunpro-cc] unknown wrapper type: $wrapper_type"; exit 1 ;;
86 # Ignore options that are probably meant for GCC.
88 -Xc ) transform_discard_with_warning ;;
90 -static ) transform_to "-Bstatic" ;;
93 -shared ) transform_to "-G" ;;
95 # SunPro on amd64 does not know the -xcode= option (see PR 35555).
98 -xcode=pic13 ) transform_to "-Kpic" ;;
101 -xcode=pic32 ) transform_to "-KPIC" ;;
103 # SunPro needs -mt -lpthread for POSIX threads.
104 -pthread ) transform_to_and_split "-mt -lpthread" ;;
106 # -fast implies -xlibmopt, which uses the optimized math
107 # routines in libsunmath. libsunmath is only available as part of
108 # SunPro, so disable the use of the optimized math library
109 # (at least until it can be statically linked).
110 -fast ) transform_to_and_split "-fast -xnolibmopt" ;;
112 # Pass through those options that SunPro understands.
142 -xtarget=* ) transform_pass ;;
144 #-std=gnu99 ) transform_to "-xc99" ;;
145 #-xc99 ) transform_to_and_split "-xc99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__" ;;
147 -ggdb* ) transform_to "-g" ;;
149 # Ignore some flags that are unnecessary for SunPro.
157 -traditional ) transform_discard ;;
159 # Ignore all other -f flags.
160 -f* ) transform_discard_with_warning ;;
163 -* ) transform_pass_with_warning ;;