Skip to content

Commit

Permalink
Add command database extraction regex to all other c & c++ compile ac…
Browse files Browse the repository at this point in the history
…tions in toolsets.
  • Loading branch information
grafikrobot committed Jun 1, 2024
1 parent c10679b commit 034979a
Show file tree
Hide file tree
Showing 13 changed files with 191 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/tools/como-linux.jam
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,27 @@ actions link.dll bind LIBRARIES
$(CONFIG_COMMAND) $(LINKFLAGS) -shared -o "$(<[1])" "$(>)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" "$(LIBRARIES)" "$(LIBRARIES)" -l$(FINDLIBS-SA) -l$(FINDLIBS-ST) 2>&1
}

rule compile.c ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "($(config_command).*) 2\\>\\&1" ;
}

actions compile.c
{
$(CONFIG_COMMAND) -c --c99 --long_long -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" 2>&1
}

rule compile.c++ ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "($(config_command).*) 2\\>\\&1" ;
}

actions compile.c++
{
$(CONFIG_COMMAND) -tused -c --long_long -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)" 2>&1
Expand Down
16 changes: 16 additions & 0 deletions src/tools/como-win.jam
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,27 @@ actions link bind LIBRARIES
$(CONFIG_COMMAND) --no_version --no_prelink_verbose $(LINKFLAGS) -o "$(<[1]:S=)" @"@($(<[1]:W).rsp:E=$(nl)"$(>)")" "$(LIBRARIES)" "$(FINDLIBS:S=.lib)"
}

rule compile.c ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "($(config_command)[^\n]*)" ;
}

actions compile.c
{
$(CONFIG_COMMAND) -c --c99 -e5 --no_version --display_error_number --diag_suppress=9,21,161,748,940,962 -U$(UNDEFS) -D$(DEFINES) $(WARN) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -I"$(SYSHDRS)" -o "$(<:D=)" "$(>)"
}

rule compile.c++ ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "($(config_command)[^\n]*)" ;
}

actions compile.c++
{
$(CONFIG_COMMAND) -c -e5 --no_version --no_prelink_verbose --display_error_number --long_long --diag_suppress=9,21,161,748,940,962 --diag_error=461 -D__STL_LONG_LONG -U$(UNDEFS) -D$(DEFINES) $(WARN) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -I"$(SYSHDRS)" -o "$(<)" "$(>)"
Expand Down
12 changes: 11 additions & 1 deletion src/tools/hp_cxx.jam
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,12 @@ actions link.dll bind LIBRARIES
# Note: Relaxed ANSI mode (-std) is used for compilation because in strict ANSI
# C89 mode (-std1) the compiler doesn't accept C++ comments in C files. As -std
# is the default, no special flag is needed.

rule compile.c ( targets * : sources * : properties * )
{
COMMAND_DATABASE on $(targets) = "(cc [^\n]*)" ;
}

actions compile.c
{
$(.root:E=)cc -c $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -o "$(<)" "$(>)"
Expand All @@ -193,7 +199,7 @@ actions compile.c
# Note: We deliberately don't suppress any warnings on the compiler command
# line, the user can always do this in a customized toolset later on.

rule compile.c++
rule compile.c++ ( targets * : sources * : properties * )
{
# We preprocess the TEMPLATE_DEPTH command line option here because we found
# no way to do it correctly in the actual action code. There we either get
Expand All @@ -202,6 +208,10 @@ rule compile.c++
# "-pending_instantiations ".
local template-depth = [ on $(1) return $(TEMPLATE_DEPTH) ] ;
TEMPLATE_DEPTH on $(1) = "-pending_instantiations "$(template-depth) ;
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "($(config_command)[^\n]*)" ;
}

actions compile.c++
Expand Down
16 changes: 16 additions & 0 deletions src/tools/intel-darwin.jam
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,27 @@ flags intel-darwin.compile.c++ OPTIONS <warnings>extra : -w3 ;
flags intel-darwin.compile.c++ OPTIONS <warnings>pedantic : -w3 -Wcheck ;
flags intel-darwin.compile.c++ OPTIONS <warnings-as-errors>on : -Werror-all ;

rule compile.c ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

actions compile.c
{
"$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

rule compile.c++ ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

actions compile.c++
{
"$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
Expand Down
20 changes: 20 additions & 0 deletions src/tools/intel-linux.jam
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,17 @@ rule init ( version ? : command * : options * )

_ = " " ;

rule set_command_db ( targets + )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

rule compile.c++ ( targets * : sources * : properties * )
{
set_command_db $(targets) ;
DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
}

Expand All @@ -255,6 +264,7 @@ actions compile.c++ bind PCH_FILE

rule compile.c ( targets * : sources * : properties * )
{
set_command_db $(targets) ;
DEPENDS $(<) : [ on $(<) return $(PCH_FILE) ] ;
}

Expand All @@ -263,6 +273,16 @@ actions compile.c bind PCH_FILE
LD_LIBRARY_PATH="$(RUN_PATH)" "$(CONFIG_COMMAND)" -c -xc $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -use-pch"$(PCH_FILE)" -c -o "$(<)" "$(>)"
}

rule compile.c++.pch ( targets * : sources * : properties * )
{
set_command_db $(targets) ;
}

rule compile.c.pch ( targets * : sources * : properties * )
{
set_command_db $(targets) ;
}

#
# Compiling a pch first deletes any existing *.pchi file, as Intel's compiler
# won't over-write an existing pch: instead it creates filename$1.pchi, filename$2.pchi
Expand Down
18 changes: 18 additions & 0 deletions src/tools/intel-vxworks.jam
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,29 @@ flags intel-vxworks.compile.c++ OPTIONS <warnings>extra : -w3 ;
flags intel-vxworks.compile.c++ OPTIONS <warnings>pedantic : -w3 -Wcheck ;
flags intel-vxworks.compile.c++ OPTIONS <warnings-as-errors>on : -Werror-all ;

rule set_command_db ( targets + )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

rule compile.c ( targets * : sources * : properties * )
{
set_command_db $(targets) ;
}

actions compile.c
{
"$(CONFIG_COMMAND)" -xc $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

rule compile.c++ ( targets * : sources * : properties * )
{
set_command_db $(targets) ;
}

actions compile.c++
{
"$(CONFIG_COMMAND)" -xc++ $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
Expand Down
16 changes: 16 additions & 0 deletions src/tools/mipspro.jam
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,27 @@ flags mipspro.compile INCLUDES <include> ;

flags mipspro.compile.fortran OPTIONS <fflags> ;

rule compile.c ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_C_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

actions compile.c
{
"$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

rule compile.c++ ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

actions compile.c++
{
"$(CONFIG_COMMAND)" -FE:template_in_elf_section -ptused $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
Expand Down
12 changes: 12 additions & 0 deletions src/tools/msvc.jam
Original file line number Diff line number Diff line change
Expand Up @@ -683,6 +683,12 @@ rule compile.c ( targets + : sources * : properties * )
set-setup-command $(targets) : $(properties) ;
get-rspline $(targets) : -TC CFLAGS ;
compile-c-c++ $(<) : $(>) ;

local config_command = [ regex.escape [ on $(targets[1]) return $(.CC) ]
: "|()[]\\+.*^$\" " : "\\" ] ;
local cc_filter = [ regex.escape [ on $(targets[1]) return $(.CC.FILTER) ]
: "|()[]\\+.*^$\" " : "\\" ] ;
COMMAND_DATABASE on $(targets) = "($(config_command).*)$(cc_filter)" ;
}


Expand Down Expand Up @@ -751,6 +757,12 @@ rule compile-c-c++ ( targets + : sources * )
LOCATE on $(<[1]:S=.pdb) = [ on $(<[1]) return $(LOCATE) ] ;
local pch-header = [ on $(<[1]) return $(PCH_HEADER) ] ;
PCH_HEADER_AS_SPELLED on $(<[1]) = $(pch-header:G=) ;

local config_command = [ regex.escape [ on $(targets[1]) return $(.CC) ]
: "|()[]\\+.*^$\" " : "\\" ] ;
local cc_filter = [ regex.escape [ on $(targets[1]) return $(.CC.FILTER) ]
: "|()[]\\+.*^$\" " : "\\" ] ;
COMMAND_DATABASE on $(targets) = "($(config_command).*)$(cc_filter)" ;
}

rule preprocess-c-c++ ( targets + : sources * )
Expand Down
16 changes: 16 additions & 0 deletions src/tools/pathscale.jam
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,22 @@ flags pathscale.compile INCLUDES <include> ;
flags pathscale.compile.fortran USER_OPTIONS <fflags> ;
flags pathscale.compile.fortran90 USER_OPTIONS <fflags> ;

rule compile.c ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_C_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

rule compile.c++ ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

actions compile.c
{
"$(CONFIG_C_COMMAND)" $(OPTIONS) $(USER_OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
Expand Down
16 changes: 16 additions & 0 deletions src/tools/pgi.jam
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,22 @@ flags pgi.compile INCLUDES <include> ;

flags pgi.compile.fortran OPTIONS <fflags> ;

rule compile.c ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_C_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

rule compile.c++ ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

actions compile.c
{
"$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
Expand Down
10 changes: 10 additions & 0 deletions src/tools/qcc.jam
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,11 @@ rule compile.c++
}

check-target-platform $(1) ;

local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

actions compile.c++
Expand All @@ -150,6 +155,11 @@ actions compile.c++
rule compile.c
{
check-target-platform $(1) ;

local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

actions compile.c
Expand Down
16 changes: 16 additions & 0 deletions src/tools/sun.jam
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,22 @@ flags sun.compile.c++ OPTIONS <cxxflags> ;
flags sun.compile DEFINES <define> ;
flags sun.compile INCLUDES <include> ;

rule compile.c ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_C_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

rule compile.c++ ( targets * : sources * : properties * )
{
local config_command = [ regex.escape
[ on $(targets[1]) return $(CONFIG_COMMAND) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "(\"$(config_command)\"[^\n]*)" ;
}

actions compile.c
{
"$(CONFIG_C_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
Expand Down
8 changes: 8 additions & 0 deletions src/tools/vmsdecc.jam
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,10 @@ rule compile.c++ ( targets * : sources * : properties * )

TARGET-CXX-REPO on $(targets) = [ on $(targets[1]) get-target-cxx-repo $(LOCATE) ] ;
CXX-REPOS on $(targets) = [ on $(targets) return $(TARGET-CXX-REPO) $(CXX-REPOS) ] ;

local config_command = [ regex.escape [ on $(targets[1]) return $(.CXX) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "($(config_command)[^\n]*)" ;
}


Expand All @@ -178,6 +182,10 @@ rule compile.c ( targets * : sources * : properties * )
DEPENDS $(targets) : [ on $(targets) return $(SOURCE-INCLUDES) ] ;

INCLUDES on $(targets) = [ on $(targets) get-includes $(sources) : $(INCLUDES) ] ;

local config_command = [ regex.escape [ on $(targets[1]) return $(.CC) ]
: "()[]\\+.*^$\"" : "\\" ] ;
COMMAND_DATABASE on $(targets) = "($(config_command)[^\n]*)" ;
}

actions compile.c
Expand Down

0 comments on commit 034979a

Please sign in to comment.