SubDir PLASMA Aver test ;

if ! $(PLASMA_READY) {
  SubInclude PLASMA Aver test converter ;

  SubDirC++Flags -DTIXML_USE_STL ;

  local modtest = modtest ;
  local modxml = $(modtest:S=.xml) ;

  AverToXml $(modxml) : $(modtest) ;
  LocalClean clean : $(modxml) ;
  LocalDepends aver-module-tests : $(modxml) ;
  LocalDepends run-aver-module-tests : $(modxml) ;

  ModuleMain aver-module-tests : module-tests.cc aver-test-module.cc : Aver ;
  RunModuleMain run-aver-module-tests : aver-module-tests ;
  LocalDepends tests : run-aver-module-tests ;

  ModuleObjects AverTestAssembly.cc : Aver ;

  if $(LIBRARIES) = SHARED {
    EXTRA_DEFS = -DSTANDALONE ;
    ModuleNamedObjects runTransactions_standalone : runTransactions.cc : Aver ;
    ModuleMain runTransactions : runTransactions_standalone.o AverTestAssembly.o : Aver ;
  }
  EXTRA_DEFS = ;
  ModuleNamedObjects runTransactions_link : runTransactions.cc : Aver ;

  local model = aver-test-model.nddl ;
  local exe = $(model:S=) ;
  local hh = $(model:S=.hh) ;
  local cc = [ FGristFiles $(model:S=.cc) ] ;
  local xml = $(model:S=.xml) ;
  local o = $(cc:S=.o) ;
  local lib = $(model:S=) ;

  Includes $(cc) : $(hh) ;
  NddlCompiler $(hh) $(cc) : $(model) ;
  ModuleObjects $(cc) : NDDL ;

  if $(LIBRARIES) = SHARED {
    ModuleSharedLibrary $(lib) : $(o) : NDDL ;

    local variant ;
    for variant in $(VARIANTS) {
      local libname = [ FModuleSharedLibraryName $(lib) : $(variant) ] ;
      local run_variant_name = [ FVariantName runTransactions : $(variant) ] ;
      run_variant_name = $(run_variant_name)_rt ;
      local arguments = $(PWD)$(SLASH)$(SUBDIR)$(SLASH)$(libname) ;
      Depends run-problem-$(exe) : $(libname) ;
      RunModuleMain run-problem-$(exe) : runTransactions : $(arguments) ;
      LocalDepends run-aver-module-tests : run-problem-$(exe) ;
    }
  }
  else {
    ModuleMain $(exe) : $(o) runTransactions_link.o AverTestAssembly.o : Aver System ;
    RunModuleMain run-$(exe) : $(exe) : ;
    LocalDepends run-aver-module-tests : run-$(exe) ;
  }
}
