#BUILDING LAZY
#
#DEPENDENCIES
#Remember that some distributions split packages into development and binary
#versions.  You need the development versions.
#
#zlib and Boost >= 1.36.0 are required.  Don't have Boost?  You can compile the
#queries part with ./compile_query_only.sh .  
#--with-boost=/path/to/boost uses a Boost install from a custom path.
#
#The following optional packages are autodetected:
#libtcmalloc_minimal from google-perftools
#bzip2
#lzma aka xz
#
#INSTALLATION
#--prefix=/path/to/prefix sets the install prefix [default is source root].
#--bindir=/path/to/prefix/bin sets the bin directory [PREFIX/bin]
#--libdir=/path/to/prefix/lib sets the lib directory [PREFIX/lib]
#--includedir=/path/to/prefix/include installs headers.  
#  Does not install if missing.  No argument defaults to PREFIX/include .
#--install-scripts=/path/to/scripts copies scripts into a directory.
#  Does not install if missing.  No argument defaults to PREFIX/scripts .
#--git appends the git revision to the prefix directory.
#
#BUILD OPTIONS
# By default, the build is multi-threaded, optimized, and statically linked.  
# Pass these to change the build:
#
# threading=single|multi         controls threading (default multi)
#
# variant=release|debug|profile  builds optimized (default), for debug, or for
#                                profiling
#
# link=static|shared             controls preferred linking (default static)
# --static                       forces static linking (the default will fall
#                                back to shared)
#
# debug-symbols=on|off           include or exclude (default) debugging
#                                information also known as -g
# --without-libsegfault          does not link with libSegFault
#
# --max-kenlm-order              maximum ngram order that kenlm can process (default 6)
#
#CONTROLLING THE BUILD
#-a to build from scratch
#-j$NCPUS to compile in parallel
#--clean to clean

path-constant TOP : . ;
include $(TOP)/jam-files/sanity.jam ;

boost 104100 ;

external-lib z ;

if ! [ option.get "without-tcmalloc" : : "yes" ] && [ test_library "tcmalloc_minimal" ] {
  external-lib tcmalloc_minimal ;
  requirements += <threading>multi:<library>tcmalloc_minimal ;
}

project : requirements $(requirements) <threading>multi:<define>WITH_THREADS <library>boost_system <define>HAVE_BOOST ;
project : default-build <threading>multi <warnings>on <variant>release ;

build-projects search lm util decode ;

lib kenlm : lm//kenlm ;
install-bin-libs lm//programs kenlm decode//decode ;

install-headers headers : [ glob-tree *.hh : dist include ] : . ;
alias install : prefix-bin prefix-lib prefix-include ; 
explicit headers ;
explicit install ;
