TENDER becomes Tender, removing .so
[u/mrichter/AliRoot.git] / EVE / test-macros / compileEveMacros.C
CommitLineData
36e97d8a 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 **************************************************************************/
6
7//************************************************************************
8// Author: Mihai Niculescu (mihai.niculescu@cern.ch)
9// Jan 31 2012
10//************************************************************************
11
12#if !defined(__CINT__) || defined(__MAKECINT__)
13#include <TList.h>
14#include <TObjString.h>
15#include <TString.h>
16#include <TSystem.h>
17#include <TSystemDirectory.h>
18#include <TSystemFile.h>
19#include <TEveUtil.h>
20#endif
21
22/* Compiles all AliEve macros
23 *
24 * Usage:
6c49a8e1 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
36e97d8a 28 * 3. Wait for compilation to finish
29 *
30 * NOTE:
31 * At the end of compilation,you might get a list
32 * with all macros that failed compilation
33 *
34 * Parameters:
35 * macDir - absolute directory path where to find the macros
36 * opt - compilation options (See: TSystem::CompileMacro)
37 *
38 * Default:
39 * - compiles all macros from AliRoot installation dir ($ALICE_ROOT/EVE/alice-macros)
97587798 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)
36e97d8a 48 */
49
50void compileEveMacros( const char * macDir="", Option_t *opt="")
51{
97587798 52
53 // solves current issue in ROOT when pre-compiling with ACLiC
54 gSystem->Load("libCint");
230b7aff 55 gSystem->Load("libTender");
97587798 56 gSystem->Load("libPWGPP");
57
36e97d8a 58 if(macDir == "")
59 macDir = Form("%s/EVE/alice-macros", gSystem->Getenv("ALICE_ROOT") );
60
61 if(opt == "")
97587798 62 opt = "-kc"; // compilation options
36e97d8a 63
64 TObjString *mac;
65 TList * listOfFailedMacros = new TList; // list of macros that failed compilation
66
67 TSystemDirectory *curDir = new TSystemDirectory(macDir, macDir);
68 TSystemFile *curFile = 0;
69
70 TList* listOfMacros = curDir->GetListOfFiles();
71 TListIter next(listOfMacros);
72
73 TPMERegexp regex("\\.C$");
74
97587798 75 printf("Directory: %s \tfiles:%d\n", curDir->GetName(), listOfMacros->GetSize() );
76 gSystem->cd(curDir->GetName());
77
78 const char* incPath = gSystem->GetIncludePath();
79
80 gSystem->SetIncludePath(Form("%s -I%s", incPath, "$ROOTSYS/include"));
81
36e97d8a 82
83 Int_t nMacros = 0;
84
85 while( (curFile = static_cast<TSystemFile*>(next())) )
86 {
87 mac = new TObjString(curFile->GetName());
88
89 if( regex.Match(mac->String().Data() ) > 0 )
90 {
91 nMacros++;
92
93 printf("Macro %s\n", mac->String().Data() );
94 TEveUtil::CheckMacro(mac->String().Data() );
97587798 95 if(!gSystem->CompileMacro(mac->String().Data(), opt ) )
36e97d8a 96 listOfFailedMacros->Add(mac);
97 }
98
99 }
100
101 printf("\n\nTotal Macros:%d \tFailed:%d \n", nMacros, listOfFailedMacros->GetSize() );
102
103 printf("\nFollowing macros failed compilation: \n");
104 TListIter failed(listOfFailedMacros);
105 while( (mac = static_cast<TObjString*>(failed())) )
106 {
107 printf( "%s\n", mac->String().Data() );
108 }
109
110 delete listOfFailedMacros;
111 delete listOfMacros;
112 delete curDir;
6c49a8e1 113}