1 # Copyright 2005 Dave Abrahams
2 # Copyright 2003 Rene Rivera
3 # Copyright 2003, 2004, 2005 Vladimir Prus
4 # Distributed under the Boost Software License, Version 1.0.
5 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
7 # Support for the Borland's command line compiler
12 import toolset : flags ;
13 import feature : get-values ;
17 feature.extend toolset : borland ;
19 rule init ( version ? : command * : options * )
21 local condition = [ common.check-init-parameters borland :
22 version $(version) ] ;
24 local command = [ common.get-invocation-command borland : bcc32.exe
27 common.handle-options borland : $(condition) : $(command) : $(options) ;
31 command = [ common.get-absolute-tool-path $(command[-1]) ] ;
35 flags borland.compile STDHDRS $(condition) : $(root)/include/ ;
36 flags borland.link STDLIBPATH $(condition) : $(root)/lib ;
37 flags borland.link RUN_PATH $(condition) : $(root)/bin ;
38 flags borland .root $(condition) : $(root)/bin/ ;
42 # A borland-specific target type
43 type.register BORLAND.TDS : tds ;
47 generators.register-linker borland.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : EXE : <toolset>borland ;
48 generators.register-linker borland.link.dll : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB : <toolset>borland ;
50 generators.register-archiver borland.archive : OBJ : STATIC_LIB : <toolset>borland ;
51 generators.register-c-compiler borland.compile.c++ : CPP : OBJ : <toolset>borland ;
52 generators.register-c-compiler borland.compile.c : C : OBJ : <toolset>borland ;
53 generators.register-standard borland.asm : ASM : OBJ : <toolset>borland ;
57 flags borland.compile OPTIONS <debug-symbols>on : -v ;
58 flags borland.link OPTIONS <debug-symbols>on : -v ;
60 flags borland.compile OPTIONS <optimization>off : -Od ;
61 flags borland.compile OPTIONS <optimization>speed : -O2 ;
62 flags borland.compile OPTIONS <optimization>space : -O1 ;
64 if $(.BORLAND_HAS_FIXED_INLINING_BUGS)
66 flags borland CFLAGS <inlining>off : -vi- ;
67 flags borland CFLAGS <inlining>on : -vi -w-inl ;
68 flags borland CFLAGS <inlining>full : -vi -w-inl ;
72 flags borland CFLAGS : -vi- ;
75 flags borland.compile OPTIONS <warnings>off : -w- ;
76 flags borland.compile OPTIONS <warnings>all : -w ;
77 flags borland.compile OPTIONS <warnings-as-errors>on : -w! ;
80 # Deal with various runtime configs...
82 # This should be not for DLL
83 flags borland OPTIONS <user-interface>console : -tWC ;
85 # -tWR sets -tW as well, so we turn it off here and then turn it
86 # on again later if we need it:
87 flags borland OPTIONS <runtime-link>shared : -tWR -tWC ;
88 flags borland OPTIONS <user-interface>gui : -tW ;
90 flags borland OPTIONS <main-target-type>LIB/<link>shared : -tWD ;
91 # Hmm.. not sure what's going on here.
92 flags borland OPTIONS : -WM- ;
93 flags borland OPTIONS <threading>multi : -tWM ;
97 flags borland.compile OPTIONS <cxxflags> ;
98 flags borland.compile DEFINES <define> ;
99 flags borland.compile INCLUDES <include> ;
101 flags borland NEED_IMPLIB <main-target-type>LIB/<link>shared : "" ;
104 # for C++ compiles the following options are turned on by default:
106 # -j5 stops after 5 errors
107 # -g255 allow an unlimited number of warnings
109 # -c compile to object
110 # -P C++ code regardless of file extention
111 # -a8 8 byte alignment, this option is on in the IDE by default
112 # and effects binary compatibility.
115 # -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o"$(<)" "$(>)"
120 "$(CONFIG_COMMAND)" -j5 -g255 -q -c -P -a8 -Vx- -Ve- -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)"
123 # For C, we don't pass -P flag
126 "$(CONFIG_COMMAND)" -j5 -g255 -q -c -a8 -Vx- -Ve- -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)"
130 # Declare flags and action for linking
131 toolset.flags borland.link OPTIONS <debug-symbols>on : -v ;
132 toolset.flags borland.link LIBRARY_PATH <library-path> ;
133 toolset.flags borland.link FINDLIBS_ST <find-static-library> ;
134 toolset.flags borland.link FINDLIBS_SA <find-shared-library> ;
135 toolset.flags borland.link LIBRARIES <library-file> ;
137 flags borland.link OPTIONS <linkflags> ;
138 flags borland.link OPTIONS <link>shared : -tWD ;
140 flags borland.link LIBRARY_PATH_OPTION <toolset>borland : -L : unchecked ;
141 flags borland.link LIBRARY_OPTION <toolset>borland : "" : unchecked ;
145 # bcc32 needs to have ilink32 in the path in order to invoke it, so explicitly
146 # specifying $(BCC_TOOL_PATH)bcc32 doesn't help. You need to add
147 # $(BCC_TOOL_PATH) to the path
148 # The NEED_IMPLIB variable controls whether we need to invoke implib.
150 flags borland.archive AROPTIONS <archiveflags> ;
152 # Declare action for archives. We don't use response file
153 # since it's hard to get "+-" there.
154 # The /P256 increases 'page' size -- with too low
155 # values tlib fails when building large applications.
156 # CONSIDER: don't know what 'together' is for...
157 actions updated together piecemeal archive
159 $(.set-path)$(.root:W)$(.old-path)
160 tlib $(AROPTIONS) /P256 /u /a /C "$(<:W)" +-"$(>:W)"
164 if [ os.name ] = CYGWIN
166 .set-path = "cmd /S /C set \"PATH=" ;
167 .old-path = ";%PATH%\" \"&&\"" ;
170 # Couldn't get TLIB to stop being confused about pathnames
171 # containing dashes (it seemed to treat them as option separators
172 # when passed through from bash), so we explicitly write the
173 # command into a .bat file and execute that. TLIB is also finicky
174 # about pathname style! Forward slashes, too, are treated as
176 actions updated together piecemeal archive
179 echo +-$(>:BS) > $(<:BS).rsp
180 $(.set-path)$(.root)$(.old-path) "tlib.exe" $(AROPTIONS) /P256 /C $(<:BS) @$(<:BS).rsp && $(RM) $(<:BS).rsp
183 else if [ os.name ] = NT
185 .set-path = "set \"PATH=" ;
186 .old-path = ";%PATH%\"
191 .set-path = "PATH=\"" ;
192 .old-path = "\":$PATH
197 RM = [ common.rm-command ] ;
204 $(.set-path)$(.root:W)$(.old-path) "$(CONFIG_COMMAND)" -v -q $(OPTIONS) -L"$(LIBRARY_PATH:W)" -L"$(STDLIBPATH:W)" -e"$(<[1]:W)" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")"
208 actions link.dll bind LIBRARIES RSP
210 $(.set-path)$(.root:W)$(.old-path) "$(CONFIG_COMMAND)" -v -q $(OPTIONS) -L"$(LIBRARY_PATH:W)" -L"$(STDLIBPATH:W)" -e"$(<[1]:W)" @"@($(<[1]:W).rsp:E=$(nl)"$(>)" $(nl)$(LIBRARIES) $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_ST:S=.lib)" $(nl)"$(LIBRARY_OPTION)$(FINDLIBS_SA:S=.lib)")" && "$(.root)implib" "$(<[2]:W)" "$(<[1]:W)"
213 # It seems impossible to specify output file with directory when compiling
214 # asm files using bcc32, so use tasm32 directly.
215 # /ml makes all symbol names case-sensitive
218 $(.set-path)$(.root:W)$(.old-path) tasm32.exe /ml "$(>)" "$(<)"