1 /**************************************************************************
2 * Copyright(c) 1998-2008, ALICE Experiment at CERN, all rights reserved. *
3 * See http://aliceinfo.cern.ch/Offline/AliRoot/License.html for *
4 * full copyright notice. *
5 **************************************************************************/
7 //************************************************************************
8 // Author: Mihai Niculescu (mihai.niculescu@cern.ch)
10 //************************************************************************
12 #if !defined(__CINT__) || defined(__MAKECINT__)
14 #include <TObjString.h>
17 #include <TSystemDirectory.h>
18 #include <TSystemFile.h>
22 /* Compiles all AliEve macros
25 * 1. cd $ALICE_ROOT/EVE/test-macros/
26 * 2. Launch alieve from terminal: alieve
27 * 3. from terminal execute this script: .x compileEveMacros.C
28 * 3. Wait for compilation to finish
31 * At the end of compilation,you might get a list
32 * with all macros that failed compilation
35 * macDir - absolute directory path where to find the macros
36 * opt - compilation options (See: TSystem::CompileMacro)
39 * - compiles all macros from AliRoot installation dir ($ALICE_ROOT/EVE/alice-macros)
40 * - options for compilation (- k f c):
41 * The possible options are:
42 k : keep the shared library after the session end.
43 f : force recompilation.
44 g : compile with debug symbol
45 O : optimized the code (ignore if 'g' is specified)
46 c : compile only, do not attempt to load the library.
47 - : if buildir is set, use a flat structure (see buildir below)
50 void compileEveMacros( const char * macDir="", Option_t *opt="")
53 // solves current issue in ROOT when pre-compiling with ACLiC
54 gSystem->Load("libCint");
55 gSystem->Load("libTender");
56 gSystem->Load("libPWGPP");
59 macDir = Form("%s/EVE/alice-macros", gSystem->Getenv("ALICE_ROOT") );
62 opt = "-kc"; // compilation options
65 TList * listOfFailedMacros = new TList; // list of macros that failed compilation
67 TSystemDirectory *curDir = new TSystemDirectory(macDir, macDir);
68 TSystemFile *curFile = 0;
70 TList* listOfMacros = curDir->GetListOfFiles();
71 TListIter next(listOfMacros);
73 TPMERegexp regex("\\.C$");
75 printf("Directory: %s \tfiles:%d\n", curDir->GetName(), listOfMacros->GetSize() );
76 gSystem->cd(curDir->GetName());
78 const char* incPath = gSystem->GetIncludePath();
80 gSystem->SetIncludePath(Form("%s -I%s", incPath, "$ROOTSYS/include"));
85 while( (curFile = static_cast<TSystemFile*>(next())) )
87 mac = new TObjString(curFile->GetName());
89 if( regex.Match(mac->String().Data() ) > 0 )
93 printf("Macro %s\n", mac->String().Data() );
94 TEveUtil::CheckMacro(mac->String().Data() );
95 if(!gSystem->CompileMacro(mac->String().Data(), opt ) )
96 listOfFailedMacros->Add(mac);
101 printf("\n\nTotal Macros:%d \tFailed:%d \n", nMacros, listOfFailedMacros->GetSize() );
103 printf("\nFollowing macros failed compilation: \n");
104 TListIter failed(listOfFailedMacros);
105 while( (mac = static_cast<TObjString*>(failed())) )
107 printf( "%s\n", mac->String().Data() );
110 delete listOfFailedMacros;