import type ;
import scanner ;
import generators ;
import feature ;
import toolset ;
import "class" : new ;
type.register COMPILSTABLE : scompil ;
feature.feature <compil-stable-binary> : : free ;
feature.feature <compil-stable-binary-dependencies> : : free dependency ;
feature.feature <compil-stable-type> : main partial test : free optional ;
class compil-stable-scanner : common-scanner
{
rule pattern ( )
{
return "[ \t]*import[ \t]*\"([^\"]*)\"[ \t]*;" ;
}
}
scanner.register compil-stable-scanner : include ;
type.set-scanner COMPILSTABLE : compil-stable-scanner ;
class compil-stable-generator : generator
{
import modules path targets jamcompilstable ;
rule __init__ ( * : * )
{
generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9) ;
}
rule tool-directory
{
...
}
rule run ( project name ? : property-set : sources * : multiple ? )
{
local directory = [ tool-directory ] ;
local compil-stable-binary-dependencies = [ path.join $(directory) generator ] ;
local compil-stable-binary = [ path.native $(compil-stable-binary-dependencies) ] ;
property-set = [ $(property-set).add-raw
<compil-stable-binary>$(compil-stable-binary)
<compil-stable-binary-dependencies>$(compil-stable-binary-dependencies)
] ;
return [ generator.run $(project) $(name) : $(property-set) : $(sources) : $(multiple) ] ;
}
}
generators.register [
new compil-stable-generator jamcompilstable.generate
: COMPILSTABLE
: CPP H
: <compil-stable-type>main ] ;
generators.register [
new compil-stable-generator jamcompilstable.generate
: COMPILSTABLE
: CPP(%-partial) H(%-partial)
: <compil-stable-type>partial ] ;
generators.register [
new compil-stable-generator jamcompilstable.generate
: COMPILSTABLE
: CPP(%-test)
: <compil-stable-type>test ] ;
toolset.flags jamcompilstable.generate COMPIL-STABLE-COMMAND <compil-stable-binary> ;
toolset.flags jamcompilstable.generate COMPIL-STABLE-DEPENDENCIES <compil-stable-binary-dependencies> ;
toolset.flags jamcompilstable.generate COMPIL-STABLE-TYPE <compil-stable-type> ;
toolset.flags jamcompilstable.generate IMPORTS <include> ;
rule generate ( targets * : source * : properties * )
{
DEPENDS $(targets) : [ on $(targets) return $(COMPIL-STABLE-DEPENDENCIES) ] ;
}
actions generate
{
$(COMPIL-STABLE-COMMAND) -I$(IMPORTS:W) -t $(COMPIL-STABLE-TYPE) --core-directory=core/c++ $(>) -o $(<[1]:D) || exit 1
}