xref: /aoo41x/main/solenv/inc/tg_compv.mk (revision c91626b3)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24COMPVERMK:=$(SOLARINCDIR)/comp_ver.mk
25
26.INCLUDE .IGNORE : $(COMPVERMK)
27
28.IF "$(COMNAME)"=="" || "$(COMPATH:s!\!/!)"!="$(COMPATH_STORED)"
29.IF "$(L10N_framework)"==""
30
31COMNAME:=
32
33.IF "$(COM)"=="GCC"
34CFLAGSVERSION=-dumpfullversion -dumpversion
35CFLAGSVERSION_CMD=-dumpfullversion -dumpversion
36CFLAGSNUMVERSION_CMD=-dumpfullversion -dumpversion $(PIPEERROR) $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
37#CFLAGSNUMVERSION_CMD=-dumpfullversion -dumpversion | 2>&1  $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
38.ELIF "$(COM)"=="CLANG"
39CFLAGSVERSION=--version
40CFLAGSVERSION_CMD=--version | head -n1 | sed -e"s/.*version //" -e"s/ .*//"
41.IF "$(OS)"="FREEBSD"
42CFLAGSNUMVERSION_CMD=${CFLAGSVERSION_CMD} | $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
43.ELSE
44CFLAGSNUMVERSION_CMD=${CFLAGSVERSION_CMD} | sed -e"s/\.//"
45.ENDIF
46.ELIF "$(COM)"=="MSC"
47CFLAGSVERSION=
48CFLAGSVERSION_CMD=  $(PIPEERROR) $(AWK) -f $(SOLARENV)/bin/getcompver.awk
49CFLAGSNUMVERSION_CMD=  $(PIPEERROR) $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
50.ENDIF
51
52.IF "$(COM)"=="C55" || "$(COM)"=="C54" || "$(COM)"=="C52" || "$(COM)"=="C40" || "$(COM)"=="sunpro"
53CFLAGSVERSION= -V
54CFLAGSVERSION_CMD= -V  $(PIPEERROR) $(AWK) -f $(SOLARENV)/bin/getcompver.awk
55CFLAGSNUMVERSION_CMD= -V  $(PIPEERROR) $(AWK) -v num=true -f $(SOLARENV)/bin/getcompver.awk
56.ENDIF
57
58.IF "$(COM)"=="C730"
59CFLAGSVERSION= -version
60CFLAGSVERSION_CMD= -version |& cut -d" " -f4-
61CFLAGSNUMVERSION_CMD= -version |& cut -d" " -f4-
62.ENDIF
63
64# that's the version known by the specific
65# compiler
66CCVER:=$(shell @-$(CXX) $(CFLAGSVERSION_CMD))
67
68# and a computed integer for comparing
69# each point seperated token blown up to 4 digits
70CCNUMVER:=$(shell @-$(CXX) $(CFLAGSNUMVERSION_CMD))
71
72.IF "$(COM)"=="MSC"
73.IF "$(CCNUMVER)">="001200000000"
74COMID=MSC
75COMNAME=msci
76.ENDIF
77.ENDIF
78
79.IF "$(COM)"=="GCC"
80
81SHORTSTDCPP3:=
82SHORTSTDC3:="1"
83
84.IF "$(CCNUMVER)">="000200910000"
85COMID=GCC
86COMNAME=gcc2
87.ENDIF
88
89.IF "$(CCNUMVER)">="000300000001"
90
91COMID=gcc3
92COMNAME=gcc3
93
94.IF "$(CCNUMVER)">="000300000001"
95SHORTSTDCPP3="3"
96.ENDIF
97
98.IF "$(CCNUMVER)">="000300010000"
99SHORTSTDCPP3="4"
100.ENDIF
101
102.IF "$(CCNUMVER)">="000300020000"
103SHORTSTDCPP3="5"
104.ENDIF
105
106.IF "$(CCNUMVER)">="000300040000"
107.IF "$(OS)$(CPU)" == "LINUX6" || "$(OS)$(CPU)" == "LINUXH"
108#for gcc >= 3.4.0 on m68k-linux this is libgcc_s.so.2.
109#for gcc >= 3.4.0 < 4.2.0 on hppa-linux this is libgcc_s.so.2.
110SHORTSTDC3:="2"
111.ENDIF
112SHORTSTDCPP3="6"
113.ENDIF
114
115.IF "$(CCNUMVER)">="000400020000"
116.IF "$(OS)$(CPU)" == "LINUXH"
117#for gcc >= 4.2.0 on hppa-linux this is libgcc_s.so.4.
118SHORTSTDC3:="4"
119.ENDIF
120SHORTSTDCPP3="6"
121.ENDIF
122
123.ENDIF
124.ENDIF
125
126.IF "$(COM)"=="C55" || "$(COM)" == "C54" || "$(COM)"=="C52" || "$(COM)"=="C40" || "$(COM)"=="sunpro"
127.IF "$(CCNUMVER)">="00050002"
128COMID=C52
129COMNAME=sunpro5
130.ENDIF
131.ENDIF
132
133.IF "$(COM)"=="C730"
134COMID=C730
135COMNAME=MipsPro
136.ENDIF
137
138.IF "$(COM)"=="CLANG"
139.IF "$(OS)" == "FREEBSD"
140COMID=gcc3
141COMNAME=gcc3
142.ELSE
143COMID=s5abi
144COMNAME=s5abi
145.ENDIF
146.ENDIF
147
148.IF "$(COMNAME)"==""
149
150# "EXCEPTIONSFILES" get compiled before this, but shouldn't
151# appear in the first n modules.
152
153compiler_version_error:
154    @echo ++++++++++++++++++++++++++++++++++++
155    @echo  ERROR!
156    @echo  Could not detect compiler version!
157    @echo  Please extend tg_compv.mk in
158    @echo  "solenv/inc".
159    @echo ++++++++++++++++++++++++++++++++++++
160	@echo "$(CXX) $(CFLAGSVERSION)" returns
161	@$(CXX) $(CFLAGSVERSION)
162    @echo ++++++++++++++++++++++++++++++++++++
163	force_dmake_to_error
164
165.ENDIF          # "$(COMNAME)"==""
166
167CDEFS+=-DCPPU_ENV=$(COMNAME)
168
169.ENDIF			# "$(L10N_framework)"==""
170.ENDIF			# "$(COMNAME)"==""
171