I am attempting to generate a C file from another C file and then create a library from the generated sources (~2000 files). I tried this and it causes bjam to use massive amounts of memory and time:
type.register GEN_C : : C ;
generators.register-standard gen.generate : C : GEN_C(GEN_%) ;
rule generate ( targets * : sources * : properties * )
{
}
actions generate
{
“gen_c.py" -f $(>) -o $(<)
}
rule gen_lib ( main-target-name : sources + : requirements * : default-build * : usage-requirements * )
{
for local file in $(sources)
{
gen-c $(file:B) : $(file) ;
files += $( file:B) ;
}
lib $(main-target-name) : $(files) : $(requirements) <implicit-dependency>$(files:B) : $(default-build) : $(usage-requirements) ;
}
gen_lib lib : [ glob *.c ] ;
There is obviously a better solution. Can someone suggest what to do here? I looked at the custom generator example in the manual and I am not sure it will do what I want. Can someone confirm that custom generators are the right choice
here? Will this solve the memory and time problem?
Thanks,
Chris