import os ;
import testing ;

path-constant TOP : . ;
local extern = [ os.environ extern ] ;

# local ROOTSYS = [ os.environ ROOTSYS ] ;
# local rlibs = [ SHELL "$(ROOTSYS)/bin/root-config --libs" ] ;
# ROOTLIBS = [ MATCH "(.*)[\n]" : $(rlibs) ] ;

ROOTLIBS = -L/usr/lib64/root -lCore -lImt -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lROOTVecOps -lTree -lTreePlayer -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lROOTDataFrame -pthread -lm -ldl -rdynamic ;

BOOSTLIBS =
  -lboost_chrono
  -lboost_date_time
  -lboost_filesystem
  -lboost_program_options
  -lboost_regex
  -lboost_serialization
  -lboost_system
  -lboost_timer
  -lboost_unit_test_framework
  -lrt
  ;

lib boost_test : : <name>boost_unit_test_framework ;

project :
  requirements <include>./
  <include>$(TOP)
  <include>$(BOOSTINCLUDE)
  <include>$(extern)/include
  <include>/usr/include/root
  <cxxflags>--std=c++17
  <cxxflags>-ftemplate-depth=256
  <cxxflags>-DBOOST_BIND_GLOBAL_PLACEHOLDERS
  <link>shared
  <linkflags>-L$(TOP)/lib
  <linkflags>$(ROOTLIBS)
  <linkflags>-L$(BOOSTLIBPATH)
  <linkflags>$(BOOSTLIBS)
  <linkflags>-lgsl
  <linkflags>-lgslcblas
  <cxxflags>-fPIC
  <cxxflags>-Wall
  ;

actions rootlibs
{
  $(ROOTSYS)/bin/root-config --libs
}

lib Minuit2 : : <file>$(extern)/libgcc920/libMinuit2.so : : ;

build-project ErrLogger ;
build-project qft++ ;
build-project qft++Extension ;
build-project ConfigParser ;
build-project Particle ;
build-project Utils ;
build-project Event ;
build-project FitParams ;
build-project PwaDynamics ;
build-project PwaUtils ;
build-project MinFunctions ;
build-project AppUtils ;
build-project pbarpUtils ;
build-project epemUtils ;
build-project resUtils ;
build-project ggUtils ;
# build-project gammapUtils ;
build-project pipiScatteringUtils ;
build-project gslUtils ;
build-project qaErrorExtract ;
build-project PspGen ;
build-project Examples ;
build-project KMatrixExtract ;
build-project PwaApps ;
