Kludge to rebuild parts if language model options change

This commit is contained in:
Kenneth Heafield 2011-12-02 10:02:21 +00:00
parent d3dd1ae7c5
commit eb72ad8960

View File

@ -1,24 +1,21 @@
import option ;
import option path ;
with-irstlm = [ option.get "with-irstlm" ] ;
if $(with-irstlm) != ""
{
local dependencies = ;
local with-irstlm = [ option.get "with-irstlm" ] ;
if $(with-irstlm) {
lib irstlm : : <search>$(with-irstlm)/lib ;
obj IRST.o : IRST.cpp ..//headers : <include>$(with-irstlm)/include ;
alias irst : IRST.o irstlm : : : <define>LM_IRST ;
dependencies += irst ;
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
echo "!!! You are linking the IRSTLM library; be sure the release is >= 5.70.02 !!!" ;
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" ;
echo "" ;
} else {
alias irst ;
}
with-srilm = [ option.get "with-srilm" ] ;
if $(with-srilm) != ""
{
if [ option.get "with-srilm-dynamic" : no : yes ] = yes
{
local with-srilm = [ option.get "with-srilm" ] ;
if $(with-srilm) {
if [ option.get "with-srilm-dynamic" : no : yes ] = yes {
alias sri-libs : srilm ;
} else {
sri-arch = [ option.get "with-srilm-arch" ] ;
@ -36,19 +33,38 @@ if $(with-srilm) != ""
obj SRI.o : SRI.cpp ..//headers : <include>$(with-srilm)/include <warnings>off ;
obj ParallelBackoff.o : ParallelBackoff.cpp ..//headers : <include>$(with-srilm)/include <warnings>off ;
alias sri : SRI.o ParallelBackoff.o sri-libs : : : <define>LM_SRI ;
} else {
alias sri ;
dependencies += sri ;
}
with-randlm = [ option.get "with-randlm" ] ;
if $(with-randlm) != ""
{
local with-randlm = [ option.get "with-randlm" ] ;
if $(with-randlm) {
lib randlm : : <search>$(with-randlm)/lib ;
obj Rand.o : Rand.cpp randlm ..//headers : <include>$(with-randlm)/include ;
alias rand : Rand.o : : : <define>LM_RAND ;
} else {
alias rand ;
dependencies += rand ;
}
lib LM : Base.cpp Factory.cpp Implementation.cpp Joint.cpp Ken.cpp MultiFactor.cpp Remote.cpp SingleFactor.cpp
../../../lm//kenlm irst sri rand ..//headers ;
obj Factory.o : Factory.cpp ..//headers $(dependencies) ;
lib LM : Base.cpp Factory.o Implementation.cpp Joint.cpp Ken.cpp MultiFactor.cpp Remote.cpp SingleFactor.cpp
../../../lm//kenlm ..//headers $(dependencies) ;
path-constant LM-LOG : bin/lm.log ;
#Is there no other way to read a file with bjam?
local previous = none ;
if [ path.exists $(LM-LOG) ] {
previous = [ _shell "cat $(LM-LOG)" ] ;
}
local current = "" ;
for local i in srilm irstlm randlm {
local optval = [ option.get "with-$(i)" ] ;
if $(optval) {
current = "$(current) --with-$(i)=$(optval)" ;
}
}
#Write $(current) to $(LM-LOG).
local ignored = @($(LM-LOG):E=$(current)) ;
if $(current) != $(previous) {
always Factory.o ;
always LM ;
}