xref: /aoo4110/main/solenv/inc/tg_compv.mk (revision b1cdbd2c)
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
81.IF "$(CCNUMVER)">="000200910000"
82COMID=GCC
83COMNAME=gcc2
84.ENDIF
85
86.IF "$(CCNUMVER)">="000300000001"
87
88COMID=gcc3
89COMNAME=gcc3
90
91.ENDIF
92.ENDIF
93
94.IF "$(COM)"=="C55" || "$(COM)" == "C54" || "$(COM)"=="C52" || "$(COM)"=="C40" || "$(COM)"=="sunpro"
95.IF "$(CCNUMVER)">="00050002"
96COMID=C52
97COMNAME=sunpro5
98.ENDIF
99.ENDIF
100
101.IF "$(COM)"=="C730"
102COMID=C730
103COMNAME=MipsPro
104.ENDIF
105
106.IF "$(COM)"=="CLANG"
107.IF "$(OS)" == "FREEBSD"
108COMID=gcc3
109COMNAME=gcc3
110.ELSE
111COMID=s5abi
112COMNAME=s5abi
113.ENDIF
114.ENDIF
115
116.IF "$(COMNAME)"==""
117
118# "EXCEPTIONSFILES" get compiled before this, but shouldn't
119# appear in the first n modules.
120
121compiler_version_error:
122    @echo ++++++++++++++++++++++++++++++++++++
123    @echo  ERROR!
124    @echo  Could not detect compiler version!
125    @echo  Please extend tg_compv.mk in
126    @echo  "solenv/inc".
127    @echo ++++++++++++++++++++++++++++++++++++
128	@echo "$(CXX) $(CFLAGSVERSION)" returns
129	@$(CXX) $(CFLAGSVERSION)
130    @echo ++++++++++++++++++++++++++++++++++++
131	force_dmake_to_error
132
133.ENDIF          # "$(COMNAME)"==""
134
135CDEFS+=-DCPPU_ENV=$(COMNAME)
136
137.ENDIF			# "$(L10N_framework)"==""
138.ENDIF			# "$(COMNAME)"==""
139