Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / mk / wrapper / transform-sunpro-cc
blob39fa7bd54385b2f8e562e1a39989bd0d3ec1a8f9
1 # $NetBSD: transform-sunpro-cc,v 1.30 2008/06/17 12:58:28 sketch Exp $
3 # Copyright (c) 2004 The NetBSD Foundation, Inc.
4 # All rights reserved.
6 # This code is derived from software contributed to The NetBSD Foundation
7 # by Johnny C. Lam.
9 # Redistribution and use in source and binary forms, with or without
10 # modification, are permitted provided that the following conditions
11 # are met:
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"
39 case $arg in
41 # libstdc++ is specific to the GNU C++ compiler.
42 -lstdc++        ) transform_discard_with_warning ;;
44 # Standard options, except -O0 and -O1.
45 -[cEgOos]       |\
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.
69 -export-dynamic |\
70 -Wl,--export-dynamic |\
71 -Wl,-E          ) transform_discard ;;
73 -W[02aclmop],*  ) case $wrapper_type in
74                   CC) transform_pass ;;
75                   CXX) transform_discard_with_warning ;;
76                   *) echo "ERROR: [transform-sunpro-cc] unknown wrapper type: $wrapper_type"; exit 1 ;;
77                   esac ;;
79 -Wall           |\
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 ;;
84                   esac ;;
86 # Ignore options that are probably meant for GCC.
87 -W*             |\
88 -Xc             ) transform_discard_with_warning ;;
90 -static         ) transform_to "-Bstatic" ;;
92 --export-dynamic |\
93 -shared         ) transform_to "-G" ;;
95 # SunPro on amd64 does not know the -xcode= option (see PR 35555).
96 -fpic           |\
97 -Kpic           |\
98 -xcode=pic13    ) transform_to "-Kpic" ;;
99 -fPIC           |\
100 -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.
113 -#*             |\
114 -Bdynamic       |\
115 -Bstatic        |\
116 -fd             |\
117 -features*      |\
118 -flags          |\
119 -flteval*       |\
120 -fnonstd*       |\
121 -fns*           |\
122 -fprecision*    |\
123 -fround*        |\
124 -fsimple*       |\
125 -fsingle        |\
126 -fstore         |\
127 -ftrap*         |\
128 -G              |\
129 -h*.so.*        |\
130 -m32            |\
131 -m64            |\
132 -mcpu=*         |\
133 -mt             |\
134 -S              |\
135 -template=*     |\
136 -V              |\
137 -v              |\
138 -xarch=*        |\
139 -xcode=*        |\
140 -xdepend        |\
141 -xstrconst      |\
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.
150 -ansi           |\
151 -fPIE           |\
152 -fpie           |\
153 -pedantic       |\
154 -pie            |\
155 -pipe           |\
156 -rdynamic       |\
157 -traditional    ) transform_discard ;;
159 # Ignore all other -f flags.
160 -f*             ) transform_discard_with_warning ;;
162 # Unknown options.
163 -*              ) transform_pass_with_warning ;;
165 esac