]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/tools/cw.jam
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / tools / build / src / tools / cw.jam
CommitLineData
7c673cae
FG
1# Copyright (C) Reece H Dunn 2004
2# Distributed under the Boost Software License, Version 1.0.
3# (See accompanying file LICENSE_1_0.txt or copy at
4# http://www.boost.org/LICENSE_1_0.txt)
5
6# based on the msvc.jam toolset
7
8import property ;
9import generators ;
10import os ;
11import type ;
12import toolset : flags ;
13import errors : error ;
14import feature : feature get-values ;
15import path ;
16import sequence : unique ;
17import common ;
18
19if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
20{
21 .debug-configuration = true ;
22}
23
24feature.extend toolset : cw ;
25
26toolset.add-requirements <toolset>cw,<runtime-link>shared:<threading>multi ;
27
28nl = "
29" ;
30
31rule init ( version ? : command * : options * )
32{
33 # TODO: fix the $(command[1]) = $(compiler) issue
34
35 setup = [ get-values <setup> : $(options) ] ;
36 setup ?= cwenv.bat ;
37 compiler = [ get-values <compiler> : $(options) ] ;
38 compiler ?= mwcc ;
39 linker = [ get-values <linker> : $(options) ] ;
40 linker ?= mwld ;
41
42 local condition = [ common.check-init-parameters cw :
43 version $(version) ] ;
44
45 command = [ common.get-invocation-command cw : mwcc.exe : $(command) :
46 [ default-paths $(version) ] ] ;
47
48 common.handle-options cw : $(condition) : $(command) : $(options) ;
49
50 local root = [ feature.get-values <root> : $(options) ] ;
51 if $(command)
52 {
53 command = [ common.get-absolute-tool-path $(command[-1]) ] ;
54 }
55 local tool-root = $(command) ;
56
57 setup = $(tool-root)\\$(setup) ;
58
59 # map the batch file in setup so it can be executed
60
61 other-tools = $(tool-root:D) ;
62 root ?= $(other-tools:D) ;
63
64 flags cw.link RUN_PATH $(condition) :
65 "$(root)\\Win32-x86 Support\\Libraries\\Runtime"
66 "$(root)\\Win32-x86 Support\\Libraries\\Runtime\\Libs\\MSL_All-DLLs" ;
67
68 setup = "set \"CWFOLDER="$(root)"\" && call \""$(setup)"\" > nul " ;
69
70 if [ os.name ] = NT
71 {
72 setup = $(setup)"
73" ;
74 }
75 else
76 {
77 setup = "cmd /S /C "$(setup)" \"&&\" " ;
78 }
79
80 # bind the setup command to the tool so it can be executed before the
81 # command
82
83 local prefix = $(setup) ;
84
85 flags cw.compile .CC $(condition) : $(prefix)$(compiler) ;
86 flags cw.link .LD $(condition) : $(prefix)$(linker) ;
87 flags cw.archive .LD $(condition) : $(prefix)$(linker) ;
88
11fdf7f2 89 if [ MATCH "^([89]\\.)" : $(version) ]
7c673cae
FG
90 {
91 if [ os.name ] = NT
92 {
93 # The runtime libraries
94 flags cw.compile CFLAGS <runtime-link>static/<threading>single/<runtime-debugging>off : -runtime ss ;
95 flags cw.compile CFLAGS <runtime-link>static/<threading>single/<runtime-debugging>on : -runtime ssd ;
96
97 flags cw.compile CFLAGS <runtime-link>static/<threading>multi/<runtime-debugging>off : -runtime sm ;
98 flags cw.compile CFLAGS <runtime-link>static/<threading>multi/<runtime-debugging>on : -runtime smd ;
99
100 flags cw.compile CFLAGS <runtime-link>shared/<runtime-debugging>off : -runtime dm ;
101 flags cw.compile CFLAGS <runtime-link>shared/<runtime-debugging>on : -runtime dmd ;
102 }
103 }
104}
105
106
107local rule default-paths ( version ? ) # FIXME
108{
109 local possible-paths ;
110 local ProgramFiles = [ common.get-program-files-dir ] ;
111
112 # TODO: add support for cw8 and cw9 detection
113
114 local version-6-path = $(ProgramFiles)"\\Metrowerks\\CodeWarrior" ;
115 possible-paths += $(version-6-path) ;
116
117 # perform post-processing
118
119 possible-paths
120 = $(possible-paths)"\\Other Metrowerks Tools\\Command Line Tools" ;
121
122 possible-paths += [ modules.peek : PATH Path path ] ;
123
124 return $(possible-paths) ;
125}
126
127
128
129
130## declare generators
131
132generators.register-c-compiler cw.compile.c++ : CPP : OBJ : <toolset>cw ;
133generators.register-c-compiler cw.compile.c : C : OBJ : <toolset>cw ;
134
135generators.register-linker cw.link
136 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
137 : EXE
138 : <toolset>cw
139 ;
140generators.register-linker cw.link.dll
141 : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
142 : SHARED_LIB IMPORT_LIB
143 : <toolset>cw
144 ;
145
146generators.register-archiver cw.archive
147 : OBJ
148 : STATIC_LIB
149 : <toolset>cw
150 ;
151
152## compilation phase
153
154flags cw WHATEVER <toolset-cw:version> ;
155
156flags cw.compile CFLAGS <debug-symbols>on : -g ;
157flags cw.compile CFLAGS <optimization>off : -O0 ;
158flags cw.compile CFLAGS <optimization>speed : -O4,p ;
159flags cw.compile CFLAGS <optimization>space : -O4,s ;
160flags cw.compile CFLAGS <inlining>off : -inline off ;
161flags cw.compile CFLAGS <inlining>on : -inline on ;
162flags cw.compile CFLAGS <inlining>full : -inline all ;
163flags cw.compile CFLAGS <exception-handling>off : -Cpp_exceptions off ;
164
165
166flags cw.compile CFLAGS <rtti>on : -RTTI on ;
167flags cw.compile CFLAGS <rtti>off : -RTTI off ;
168
169flags cw.compile CFLAGS <warnings>on : -w on ;
170flags cw.compile CFLAGS <warnings>off : -w off ;
171flags cw.compile CFLAGS <warnings>all : -w all ;
172flags cw.compile CFLAGS <warnings-as-errors>on : -w error ;
173
174flags cw.compile USER_CFLAGS <cflags> : ;
175flags cw.compile.c++ USER_CFLAGS <cxxflags> : ;
176
177flags cw.compile DEFINES <define> ;
178flags cw.compile UNDEFS <undef> ;
179flags cw.compile INCLUDES <include> ;
180
181actions compile.c
182{
183 $(.CC) -c -cwd include -lang c -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) -I- -o "$(<)" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")"
184}
185actions compile.c++
186{
187 $(.CC) -c -cwd include -lang c++ -U$(UNDEFS) $(CFLAGS) $(USER_CFLAGS) -I- -o "$(<)" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)-D$(DEFINES) $(nl)"-I$(INCLUDES)")"
188}
189
190## linking phase
191
192flags cw.link DEF_FILE <def-file> ;
193
194flags cw LINKFLAGS : -search ;
195flags cw LINKFLAGS <debug-symbols>on : -g ;
196flags cw LINKFLAGS <user-interface>console : -subsystem console ;
197flags cw LINKFLAGS <user-interface>gui : -subsystem windows ;
198flags cw LINKFLAGS <user-interface>wince : -subsystem wince ;
199flags cw LINKFLAGS <user-interface>native : -subsystem native ;
200flags cw LINKFLAGS <user-interface>auto : -subsystem auto ;
201
202flags cw LINKFLAGS <main-target-type>LIB/<link>static : -library ;
203
204flags cw.link USER_LINKFLAGS <linkflags> ;
205flags cw.link LINKPATH <library-path> ;
206
207flags cw.link FINDLIBS_ST <find-static-library> ;
208flags cw.link FINDLIBS_SA <find-shared-library> ;
209flags cw.link LIBRARY_OPTION <toolset>cw : "" : unchecked ;
210flags cw.link LIBRARIES_MENTIONED_BY_FILE : <library-file> ;
211
212rule link.dll ( targets + : sources * : properties * )
213{
214 DEPENDS $(<) : [ on $(<) return $(DEF_FILE) ] ;
215}
216
217if [ os.name ] in NT
218{
219 actions archive
220 {
221 if exist "$(<[1])" DEL "$(<[1])"
222 $(.LD) -library -o "$(<[1])" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
223 }
224}
225else # cygwin
226{
227 actions archive
228 {
229 _bbv2_out_="$(<)"
230 if test -f "$_bbv2_out_" ; then
231 _bbv2_existing_="$(<:W)"
232 fi
233 $(.LD) -library -o "$(<:W)" $_bbv2_existing_ @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
234 }
235}
236
237actions link bind DEF_FILE
238{
239 $(.LD) -o "$(<[1]:W)" -L"$(LINKPATH)" $(LINKFLAGS) $(USER_LINKFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
240}
241
242actions link.dll bind DEF_FILE
243{
244 $(.LD) -shared -o "$(<[1]:W)" -implib "$(<[2]:W)" -L"$(LINKPATH)" $(LINKFLAGS) -f"$(DEF_FILE)" $(USER_LINKFLAGS) @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES_MENTIONED_BY_FILE) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
245}
246