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. Launch alieve from terminal
26 * 2. ROOT command prompt from terminal execute this script: .x compileEveMacros.C
27 * 3. Wait for compilation to finish
30 * At the end of compilation,you might get a list
31 * with all macros that failed compilation
34 * macDir - absolute directory path where to find the macros
35 * opt - compilation options (See: TSystem::CompileMacro)
38 * - compiles all macros from AliRoot installation dir ($ALICE_ROOT/EVE/alice-macros)
39 * - options for compilation (- k f c)
42 void compileEveMacros( const char * macDir="", Option_t *opt="")
45 macDir = Form("%s/EVE/alice-macros", gSystem->Getenv("ALICE_ROOT") );
48 opt = "-kfc"; // compilation options
51 TList * listOfFailedMacros = new TList; // list of macros that failed compilation
53 TSystemDirectory *curDir = new TSystemDirectory(macDir, macDir);
54 TSystemFile *curFile = 0;
56 TList* listOfMacros = curDir->GetListOfFiles();
57 TListIter next(listOfMacros);
59 TPMERegexp regex("\\.C$");
61 printf("Files found in macro directory: %d\n", listOfMacros->GetSize() );
65 while( (curFile = static_cast<TSystemFile*>(next())) )
67 mac = new TObjString(curFile->GetName());
69 if( regex.Match(mac->String().Data() ) > 0 )
73 printf("Macro %s\n", mac->String().Data() );
74 TEveUtil::CheckMacro(mac->String().Data() );
75 if(!gSystem->CompileMacro(mac->String().Data(), opt, mac->String().Data(), macDir) )
76 listOfFailedMacros->Add(mac);
81 printf("\n\nTotal Macros:%d \tFailed:%d \n", nMacros, listOfFailedMacros->GetSize() );
83 printf("\nFollowing macros failed compilation: \n");
84 TListIter failed(listOfFailedMacros);
85 while( (mac = static_cast<TObjString*>(failed())) )
87 printf( "%s\n", mac->String().Data() );
90 delete listOfFailedMacros;