diff --git a/src/tools/borland.jam b/src/tools/borland.jam index 6ad52e0de..484c91a4c 100644 --- a/src/tools/borland.jam +++ b/src/tools/borland.jam @@ -1,25 +1,19 @@ -# Copyright 2005 Dave Abrahams -# Copyright 2003 Rene Rivera -# Copyright 2003, 2004, 2005 Vladimir Prus -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) +# Copyright 2005 Dave Abrahams +# Copyright 2003 Rene Rivera +# Copyright 2003, 2004, 2005 Vladimir Prus +# Copyright (c) 2020 Edward Diener +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) #| tag::doc[] [[bbv2.reference.tools.compiler.borland]] = Borland C++ Compiler -The `borland` module supports the command line C++ compiler included in -http://www.borland.com/us/products/cbuilder/index.html[C++ Builder 2006] -product and earlier version of it, running on Microsoft Windows. - -The supported products are listed below. The version reported by the -command lines tools is also listed for reference.: - -* C++ Builder 2006 -- 5.8.2 -* CBuilderX -- 5.6.5, 5.6.4 (depending on release) -* CBuilder6 -- 5.6.4 -* Free command line tools -- 5.5.1 +The `borland` module supports the 32-bit command line C++ compilers +running on Microsoft Windows. This is the bcc32 executable for all +versions of Borland C++ and C++ Builder, as well as the command line +compatible compiler bcc32c on later versions of C++ Builder. The module is initialized using the following syntax: @@ -30,7 +24,7 @@ using borland : [version] : [c++-compile-command] : [compiler options] ; This statement may be repeated several times, if you want to configure several versions of the compiler. -If the command is not specified, B2 will search for a binary +If the command is not specified, Boost.Build will search for a binary named `bcc32` in PATH. The following options can be provided, using @@ -51,6 +45,10 @@ and C++ sources. `linkflags`:: Specifies additional command line options that will be passed to the linker. +`user-interface`:: +Specifies the user interface for applications. Valid choices are `console` +for a console applicatiuon and `gui` for a Windows application. + |# # end::doc[] # Support for the Borland's command line compiler @@ -62,31 +60,100 @@ import toolset : flags ; import feature : get-values ; import type ; import common ; +import version ; feature.extend toolset : borland ; rule init ( version ? : command * : options * ) { + local condition = [ common.check-init-parameters borland : version $(version) ] ; - - local command = [ common.get-invocation-command borland : bcc32.exe + + local command = [ common.get-invocation-command borland : bcc32.exe : $(command) ] ; - + common.handle-options borland : $(condition) : $(command) : $(options) ; - + + local just_bcc32 = [ MATCH ".*(bcc32)([^a-z0-9]|$)" : $(command:L) ] ; + if $(command) { command = [ common.get-absolute-tool-path $(command[-1]) ] ; - } - root = $(command:D) ; - + } + root = $(command:D) ; + flags borland.compile STDHDRS $(condition) : $(root)/include/ ; flags borland.link STDLIBPATH $(condition) : $(root)/lib ; flags borland.link RUN_PATH $(condition) : $(root)/bin ; - flags borland .root $(condition) : $(root)/bin/ ; + flags borland .root $(condition) : $(root)/bin/ ; + + local jv ; + + if $(version) + { + jv = [ MATCH "^([0-9.]+)" : $(version) ] ; + } + if ! $(jv) || [ version.version-less [ version-split $(jv) ] : 6 30 ] + { + init-earlier-releases $(condition) ; + } + else + { + init-later-releases $(condition) ; + } + + if $(just_bcc32) && ( $(just_bcc32[1]) = bcc32 ) + { + flags borland.compile OPTIONS $(condition) : -g255 -Vx- -Ve- -b- ; + } } +# Splits a version in its form of n[.n][.n] into n n n etc. +# +local rule version-split ( v ) +{ +return [ SPLIT_BY_CHARACTERS $(v) : . ] ; +} + +local rule init-earlier-releases ( condition ) +{ + +# Deal with various runtime configs... + +# This should be not for DLL +flags borland OPTIONS $(condition)/console : -tWC ; + +# -tWR sets -tW as well, so we turn it off here and then turn it +# on again later if we need it: +flags borland OPTIONS $(condition)/shared : -tWR -tWC ; + +flags borland OPTIONS $(condition)/LIB/shared : -tWD ; +# Hmm.. not sure what's going on here. +flags borland OPTIONS $(condition) : -WM- ; +flags borland OPTIONS $(condition)/multi : -tWM ; + +flags borland.link OPTIONS $(condition)/shared : -tWD ; + +} + +local rule init-later-releases ( condition ) +{ + +# Deal with various runtime configs... + +# This should be not for DLL +flags borland OPTIONS $(condition)/console : -tC ; + +flags borland OPTIONS $(condition)/shared : -tR ; + +flags borland OPTIONS $(condition)/LIB/shared : -tD ; +flags borland OPTIONS $(condition)/EXE : -tC ; +flags borland OPTIONS $(condition)/multi : -tM ; + +flags borland.link.dll OPTIONS $(condition)/shared : -tD ; + +} # A borland-specific target type type.register BORLAND.TDS : tds ; @@ -101,7 +168,7 @@ generators.register-c-compiler borland.compile.c++ : CPP : OBJ : borlan generators.register-c-compiler borland.compile.c : C : OBJ : borland ; generators.register-standard borland.asm : ASM : OBJ : borland ; -# Declare flags +# Declare flags flags borland.compile OPTIONS on : -v ; flags borland.link OPTIONS on : -v ; @@ -125,24 +192,8 @@ flags borland.compile OPTIONS off : -w- ; flags borland.compile OPTIONS all : -w ; flags borland.compile OPTIONS on : -w! ; - -# Deal with various runtime configs... - -# This should be not for DLL -flags borland OPTIONS console : -tWC ; - -# -tWR sets -tW as well, so we turn it off here and then turn it -# on again later if we need it: -flags borland OPTIONS shared : -tWR -tWC ; flags borland OPTIONS gui : -tW ; -flags borland OPTIONS LIB/shared : -tWD ; -# Hmm.. not sure what's going on here. -flags borland OPTIONS : -WM- ; -flags borland OPTIONS multi : -tWM ; - - - flags borland.compile OPTIONS ; flags borland.compile.c++ OPTIONS ; flags borland.compile DEFINES ; @@ -158,7 +209,7 @@ flags borland NEED_IMPLIB LIB/shared : "" ; # -q no banner # -c compile to object # -P C++ code regardless of file extension -# -a8 8 byte alignment, this option is on in the IDE by default +# -a8 8 byte alignment, this option is on in the IDE by default # and effects binary compatibility. # @@ -167,25 +218,24 @@ flags borland NEED_IMPLIB LIB/shared : "" ; actions compile.c++ { - "$(CONFIG_COMMAND)" -j5 -g255 -q -c -P -a8 -Vx- -Ve- -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)" + "$(CONFIG_COMMAND)" -j5 -q -c -P -a8 $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)" } # For C, we don't pass -P flag actions compile.c { - "$(CONFIG_COMMAND)" -j5 -g255 -q -c -a8 -Vx- -Ve- -b- $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)" + "$(CONFIG_COMMAND)" -j5 -q -c -a8 $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -I"$(STDHDRS)" -o"$(<)" "$(>)" } # Declare flags and action for linking -toolset.flags borland.link OPTIONS on : -v ; -toolset.flags borland.link LIBRARY_PATH ; -toolset.flags borland.link FINDLIBS_ST ; -toolset.flags borland.link FINDLIBS_SA ; -toolset.flags borland.link LIBRARIES ; +flags borland.link OPTIONS on : -v ; +flags borland.link LIBRARY_PATH ; +flags borland.link FINDLIBS_ST ; +flags borland.link FINDLIBS_SA ; +flags borland.link LIBRARIES ; flags borland.link OPTIONS ; -flags borland.link OPTIONS shared : -tWD ; flags borland.link LIBRARY_PATH_OPTION borland : -L : unchecked ; flags borland.link LIBRARY_OPTION borland : "" : unchecked ; @@ -205,7 +255,7 @@ flags borland.archive AROPTIONS ; # values tlib fails when building large applications. # CONSIDER: don't know what 'together' is for... actions updated together piecemeal archive -{ +{ $(.set-path)$(.root:W)$(.old-path) tlib $(AROPTIONS) /P256 /u /a /C "$(<:W)" +-"$(>:W)" } @@ -215,7 +265,7 @@ if [ os.name ] = CYGWIN { .set-path = "cmd /S /C set \"PATH=" ; .old-path = ";%PATH%\" \"&&\"" ; - + # Couldn't get TLIB to stop being confused about pathnames # containing dashes (it seemed to treat them as option separators @@ -224,11 +274,11 @@ if [ os.name ] = CYGWIN # about pathname style! Forward slashes, too, are treated as # options. actions updated together piecemeal archive - { + { chdir $(<:D) echo +-$(>:BS) > $(<:BS).rsp $(.set-path)$(.root)$(.old-path) "tlib.exe" $(AROPTIONS) /P256 /C $(<:BS) @$(<:BS).rsp && $(RM) $(<:BS).rsp - } + } } else if [ os.name ] = NT { diff --git a/src/tools/embarcadero.jam b/src/tools/embarcadero.jam new file mode 100644 index 000000000..8236acae3 --- /dev/null +++ b/src/tools/embarcadero.jam @@ -0,0 +1,591 @@ +# Copyright (c) 2020 Edward Diener +# +# Use, modification and distribution is subject to the Boost Software +# License Version 1.0. (See accompanying file LICENSE_1_0.txt or +# http://www.boost.org/LICENSE_1_0.txt) + +#| tag::doc[] + +[[bbv2.reference.tools.compiler.borland]] += Embarcadero C++ Compiler + +The `embarcadero` module supports the 32-bit command line C++ compiler +bcc32x and the 64-bit command line C++ compiler bcc64, both clang-based, +running on Microsoft Windows. These are the clang-based Windows compilers +for all versions of Embarcadero C++. + +The module is initialized using the following syntax: + +---- +using embarcadero : [version] : [c++-compile-command] : [compiler options] ; +---- + +This statement may be repeated several times, if you want to configure +several versions of the compiler. + +`version`: + +The version should be the compiler version if specified. if the +version is not specified Boost Build will find the latest installed +version of Embarcadero C++ and use that for the version. If the version +is specified Boost Build does not check if this matches any particular +version of Embarcadero C++, so you may use the version as a mnemonic to +configure separate 'versions'. + +`c++-compile-command`: + +If the c++-compile-command is not specified, Boost.Build will default to the +bcc64 compiler. If you specify a compiler option of 32 the +default compiler will be bcc32x. In either case when the command is not given +Boost Build will assume the compiler is in the PATH. So it is not necessary +to specify a command if you accept the default compiler and the Embarcadero +C++ binary directory is in the PATH. + +If the command is specified it will be used as is to invoke the compiler. +If the command has either 'bcc32x(.exe)' or 'bcc64(.exe)' in it Boost Build +will use the appropriate compiler to configure the toolset. If the command +does not have either 'bcc32x(.exe)' or 'bcc64(.exe)' in it, Boost Build +will use the default compiler to configure the toolset. If you have your +own command, which does not have 'bcc32x(.exe)' in it but invokes the +'bcc32x(.exe)' compiler, specify the 32 compiler option. + +`compiler options`: + +The following options can be provided, using +_`option-value syntax`_: + +`cflags`:: +Specifies additional compiler flags that will be used when compiling C +and C++ sources. + +`cxxflags`:: +Specifies additional compiler flags that will be used when compiling C++ +sources. + +`linkflags`:: +Specifies additional command line options that will be passed to the linker. + +`asmflags`:: +Specifies additional command line options that will be passed to the assembler. + +`archiveflags`:: +Specifies additional command line options that will be passed to the archiver, +which creates a static library. + +`address-model`:: +This option can be used to specify the default compiler as specified in the +dicsussion above of the c++-compile-command. Otherwise the address model +is not used to initialize the toolset. + +`user-interface`:: +Specifies the user interface for applications. Valid choices are `console` +for a console applicatiuon and `gui` for a Windows application. + +`root`:: +Normallly Boost Build will automatically be able to determine the root of +the Embarcadero C++ installation. It does this in various ways, but primarily +by checking a registry entry. If you specify the root it will use that +path, and the root you specify should be the full path to the Embarcadero +C++ installation on your machine ( without a trailing \ or / ). You should +not need to specify this option unless Boost Build can not find the +Embarcadero C++ root directory. + +Examples:: + +using embarcadero ; + +Configures the toolset to use the latest version, with bcc64 as the compiler. +The bcc64 compiler must be in the PATH. + +using embarcadero : 7.40 ; + +Configures the toolset to use the 7.40 version, with bcc64 as the compiler. +The bcc64 compiler must be in the PATH. + +using embarcadero : 7.40 : bcc32x ; +using embarcadero : 7.40 : : 32 ; + +Configures the toolset to use the 7.40 version, with bcc32x as the compiler. +The bcc32x compiler must be in the PATH. + +using embarcadero : : c:/some_path/bcc64 ; + +Configures the toolset to use the latest version, with full command specified. + +using embarcadero : : full_command : 32 ; + +Configures the toolset to use the latest version, with full command specified +and bcc32x as the compiler. + +using embarcadero : : : c:/root_path ; + +Configures the toolset to use the latest version, with bcc64 as the compiler +and the root directory of the installation specified. The bcc64 compiler must +be in the PATH. + +|# # end::doc[] + +import clang-linux ; +import path ; +import os ; +import type ; +import common ; +import toolset ; +import feature ; +import toolset : flags ; +import clang ; +import gcc ; +import generators ; +import errors ; + +feature.extend toolset : embarcadero ; + +toolset.inherit-generators embarcadero : clang-linux ; +generators.override embarcadero.prebuilt : builtin.lib-generator ; +generators.override embarcadero.prebuilt : builtin.prebuilt ; +generators.override embarcadero.searched-lib-generator : searched-lib-generator ; + +toolset.inherit-rules embarcadero : clang-linux ; +toolset.inherit-flags embarcadero + : clang-linux + : shared + shared + multi + multi/windows + gnu + gnu11 + libc++ + windows/static + windows/shared + ; + +if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ] { + .debug-configuration = true ; +} + +rule init ( version ? : command * : options * ) +{ + + local compiler = bcc64 ; + local preprocessor = cpp64 ; + local amodel = 64 ; + + local optam = [ feature.get-values : $(options) ] ; + + if $(optam) + { + if $(optam) = 32 + { + compiler = bcc32x ; + preprocessor = cpp32x ; + amodel = 32 ; + } + else if ! ( $(optam) = 64 ) + { + $(optam) = "" ; + } + } + + command = [ common.get-invocation-command embarcadero : $(compiler) : $(command) ] ; + + switch $(command[1]:BL) + { + case bcc32x : + compiler = bcc32x ; + preprocessor = cpp32x ; + amodel = 32 ; + case bcc64 : + compiler = bcc64 ; + preprocessor = cpp64 ; + amodel = 64 ; + case "bcc32x.exe" : + compiler = bcc32x ; + preprocessor = cpp32x ; + amodel = 32 ; + case "bcc64.exe" : + compiler = bcc64 ; + preprocessor = cpp64 ; + amodel = 64 ; + } + + if $(optam) && $(optam) != $(amodel) + { + errors.user-error "embarcadero initialization: compiler and address model" : + "the compiler '$(compiler)' does not match the address-model of '$(optam)'" ; + } + else + { + # Determine the version + if $(command) { + local command-string = "$(command)" ; + command-string = $(command-string:J=" ") ; + local soutput = [ SHELL "$(command-string) --version" ] ; + version ?= [ MATCH "Embarcadero C[+][+] ([0-9.]+)" : $(soutput) ] ; + cl_version = [ MATCH ".+version[ ]+([0-9.]+)" : $(soutput) ] ; + if ! $(cl_version) + { + cl_version = 5.0 ; + } + } + + local condition = [ common.check-init-parameters embarcadero : version $(version) ] ; + handle-options $(condition) : $(command) : $(options) ; + clang.init-cxxstd-flags embarcadero : $(condition) : $(cl_version) ; + + # Support for the Embarcadero root directory. If the Embarcadero binary + # directory is not in the PATH we need to tell the underlying clang + # implementation where to find the Embarcadero header/library files + # and set the correct runtime path so that we can execute Embarcadero + # programs and find Embarcadero DLLs. + + local root = [ feature.get-values : $(options) ] ; + + # 1) Look in registry + + if ! $(root) + { + + local sdkdir = [ get_sdk_dir ] ; + + if $(sdkdir) + { + + local bdsv = [ get_bds_version $(sdkdir) ] ; + + if $(bdsv) + { + + local has_dec = [ MATCH "(.+[.])" : $(bdsv) ] ; + local bdsv_full ; + + if ! $(has_dec) + { + bdsv_full = $(bdsv).0 ; + } + + local troot = [ W32_GETREG "HKEY_LOCAL_MACHINE\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv)" : RootDir ] ; + + if $(troot) + { + troot = $(troot:T) ; + troot = [ concatenate $(troot) : name ] ; + root = $(troot:D) ; + } + else + { + troot = [ W32_GETREG "HKEY_CURRENT_USER\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv)" : RootDir ] ; + if $(troot) + { + troot = $(troot:T) ; + troot = [ concatenate $(troot) : name ] ; + root = $(troot:D) ; + } + else if $(bdsv_full) + { + troot = [ W32_GETREG "HKEY_LOCAL_MACHINE\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv_full)" : RootDir ] ; + if $(troot) + { + troot = $(troot:T) ; + troot = [ concatenate $(troot) : name ] ; + root = $(troot:D) ; + } + else + { + troot = [ W32_GETREG "HKEY_CURRENT_USER\\SOFTWARE\\Embarcadero\\BDS\\$(bdsv_full)" : RootDir ] ; + if $(troot) + { + troot = $(troot:T) ; + troot = [ concatenate $(troot) : name ] ; + root = $(troot:D) ; + } + } + } + } + } + } + } + + + # 2) Look for path in the command + + if ! $(root) + { + + local cpath = $(command[1]:D) ; + + if $(cpath) + { + root = $(cpath:P) ; + } + } + + # 3) Search for the directory of the command + + if ! $(root) + { + + local pdirs = [ path.programs-path ] ; + + for local dir in $(pdirs) + { + + local match = [ MATCH "/(.:.+)" : $(dir) ] ; + + if $(match) + { + dir = "$(match)" ; + } + + if [ CHECK_IF_FILE $(dir)/$(command) ] + { + root = $(dir:P) ; + break ; + } + if [ CHECK_IF_FILE $(dir)/$(command).exe ] + { + root = $(dir:P) ; + break ; + } + } + } + + if ! $(root) + { + errors.user-error "Embarcadero toolset initialization: the root directory for the Embarcadero installation can not be found" ; + } + else + { + + local lib_path = $(root)/bin $(root)/bin64 $(root)/Bpl C:/Users/Public/Documents/Embarcadero ; + if $(.debug-configuration) + { + ECHO "notice:" using Embarcadero libraries with clang compilation"::" $(condition) "::" $(lib_path) ; + } + flags embarcadero.link RUN_PATH $(condition) : $(lib_path) ; + + local system_include_option = "-isystem " ; + local system_include_directories = $(root)/include/windows/crtl $(root)/include/windows/sdk $(root)/include/windows/rtl $(root)/include/dinkumware64 ; + + local lib_dir_release ; + local lib_dir_debug ; + local archiver ; + local arflags ; + local implib ; + + if $(compiler) = bcc32x + { + lib_dir_release = $(root)/lib/win32c/release $(root)/lib/win32/release $(root)/lib/win32/release/psdk ; + lib_dir_debug = $(root)/lib/win32c/debug $(root)/lib/win32/debug $(root)/lib/win32/debug/psdk ; + archiver = tlib ; + arflags = /P512 ; + implib = implib ; + } + else if $(compiler) = bcc64 + { + lib_dir_release = $(root)/lib/win64/release $(root)/lib/win64/release/psdk ; + lib_dir_debug = $(root)/lib/win64/debug $(root)/lib/win64/debug/psdk ; + archiver = tlib64 ; + arflags = /P2048 ; + implib = mkexp ; + } + + flags embarcadero.compile OPTIONS $(condition) : $(system_include_option)$(system_include_directories) ; + flags embarcadero.link LINKPATH $(condition)/release : $(lib_dir_release) ; + flags embarcadero.link LINKPATH $(condition)/debug : $(lib_dir_debug) $(lib_dir_release) ; + flags embarcadero.archive .AR $(condition) : $(root)/bin/$(archiver) ; + flags embarcadero.archive .ARFLAGS $(condition) : $(arflags) ; + flags embarcadero.asm .TASM $(condition) : $(root)/bin/tasm32 ; + flags embarcadero.asm USER_OPTIONS $(condition) : [ feature.get-values : $(options) ] ; + flags embarcadero.archive AROPTIONS $(condition) : [ feature.get-values : $(options) ] ; + flags embarcadero.link.dll .IMPLIB_COMMAND $(condition) : $(root)/bin/$(implib) ; + + local mte = [ feature.get-values : $(options) ] ; + + if $(mte) + { + flags embarcadero OPTIONS EXE/$(condition) : $(mte) ; + } + else + { + flags embarcadero OPTIONS EXE/$(condition) : console ; + } + } + } +} + +local rule concatenate ( path : name ) + { + + local result ; + local has_ending_slash = [ MATCH ".*[/\\]$" : $(path) ] ; + local has_backward_slash = [ MATCH ".*[\\]" : $(path) ] ; + + if $(has_ending_slash) + { + result = $(path)$(name) ; + } + else if $(has_backward_slash) + { + result = $(path)"\\"$(name) ; + } + else + { + result = $(path)"/"$(name) ; + } + return $(result) ; + } + +local rule get_sdk_dir ( ) + { + + local ret ; + local appdata = [ os.environ APPDATA ] ; + + if $(appdata) + { + ret = $(appdata:T)/Embarcadero/BDS ; + } + return $(ret) ; + } + +local rule get_bds_version ( sdir ) + { + + local ret ; + local flist = [ GLOB $(sdir) : * ] ; + + if $(flist) + { + + local dirs ; + + for local file in $(flist) + { + if ! [ CHECK_IF_FILE $(file) ] + { + dirs += $(file) ; + } + } + if $(dirs) + { + + local ldir = $(dirs[-1]) ; + + ret = $(ldir:B) ; + } + } + return $(ret) ; + } + +local rule handle-options ( condition * : command * : options * ) +{ + if $(.debug-configuration) + { + ECHO "notice:" will use '$(command)' for embarcadero, condition + $(condition:E=(empty)) ; + } + + toolset.flags embarcadero CONFIG_COMMAND $(condition) : $(command) ; + + toolset.flags embarcadero.compile OPTIONS $(condition) : + [ feature.get-values : $(options) ] ; + + toolset.flags embarcadero.compile.c++ OPTIONS $(condition) : + [ feature.get-values : $(options) ] ; + + toolset.flags embarcadero.link OPTIONS $(condition) : + [ feature.get-values : $(options) ] ; +} + +############################################################################### +# Declare generators + +type.set-generated-target-suffix OBJ : embarcadero windows 64 : o ; +type.set-generated-target-suffix OBJ : embarcadero windows 32 : obj ; +type.set-generated-target-suffix STATIC_LIB : embarcadero windows 64 : a ; +type.set-generated-target-suffix STATIC_LIB : embarcadero windows 32 : lib ; +type.set-generated-target-suffix IMPORT_LIB : embarcadero windows 64 : a ; +type.set-generated-target-suffix IMPORT_LIB : embarcadero windows 32 : lib ; + +generators.register-linker embarcadero.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : EXE : embarcadero ; +generators.register-linker embarcadero.link.dll : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB : SHARED_LIB IMPORT_LIB : embarcadero ; + +generators.register-archiver embarcadero.archive : OBJ : STATIC_LIB : embarcadero ; +generators.register-c-compiler embarcadero.compile.c++ : CPP : OBJ : embarcadero ; +generators.register-c-compiler embarcadero.compile.c : C : OBJ : embarcadero ; +generators.register-standard embarcadero.asm : ASM : OBJ : embarcadero ; + +# Flags + +local opt_console = -tC ; +local opt_shared = -tD ; +local opt_mt = -tM ; +local opt_drtl = -tR ; +local opt_dapp = -tW ; +local opt_compile_flags = -DNDEBUG ; +local opt_lflags = "-lS:1048576 -lSc:4098 -lH:1048576 -lHc:8192" ; + +flags embarcadero OPTIONS console : $(opt_console) ; +flags embarcadero OPTIONS gui : $(opt_dapp) ; +flags embarcadero OPTIONS shared : $(opt_drtl) ; +flags embarcadero OPTIONS LIB/shared : $(opt_shared) ; +flags embarcadero OPTIONS multi : $(opt_mt) ; +flags embarcadero.compile OPTIONS release : $(opt_compile_flags) ; +flags embarcadero.link OPTIONS : $(opt_lflags) ; +flags embarcadero.archive AROPTIONS ; +flags embarcadero.asm USER_OPTIONS ; +flags embarcadero.compile OPTIONS 32 : -m32 ; +flags embarcadero.compile OPTIONS 64 : -m64 ; +flags embarcadero.link OPTIONS 32 : -m32 ; +flags embarcadero.link OPTIONS 64 : -m64 ; + +rule compile.c++ ( targets * : sources * : properties * ) { +} + +actions compile.c++ { + "$(CONFIG_COMMAND)" -c -x c++ $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)" +} + +rule compile.c ( targets * : sources * : properties * ) +{ +} + +actions compile.c +{ + "$(CONFIG_COMMAND)" -c -x c $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)" +} + +rule archive ( targets * : sources * : properties * ) +{ +} + +actions updated together piecemeal archive +{ + "$(.AR)" $(AROPTIONS) $(.ARFLAGS) /u /a /C "$(<)" +-"$(>)" +} + +rule link ( targets * : sources * : properties * ) { + JAM_SEMAPHORE on $(targets) = clang-linux-link-semaphore ; +} + +rule link.dll ( targets * : sources * : properties * ) { + JAM_SEMAPHORE on $(targets) = clang-linux-link-semaphore ; +} + +actions link bind LIBRARIES { + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) $(USER_OPTIONS) +} + +actions link.dll bind LIBRARIES { + "$(CONFIG_COMMAND)" -L"$(LINKPATH)" -o "$(<[1])" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) $(USER_OPTIONS) && "$(.IMPLIB_COMMAND)" "$(<[2])" "$(<[1])" +} + +rule asm ( targets * : sources * : properties * ) +{ +} + +# /ml makes all symbol names case-sensitive +actions asm +{ + $(.TASM) /ml $(USER_OPTIONS) "$(>)" "$(<)" +}