| 1 | 
<?xml version="1.0" encoding="UTF-8"?> | 
| 2 | 
<project default="compileYoda" name="yoda"> | 
| 3 | 
         | 
| 4 | 
    <property environment="env"/> | 
| 5 | 
    <!-- DEFAULT CONFIGURATION PARAMETERS --> | 
| 6 | 
        <!-- PAMELA Software(s) root directory -->  | 
| 7 | 
        <property name="pamSoftware" | 
| 8 | 
                  value="${env.HOME}/pamela"/> | 
| 9 | 
         | 
| 10 | 
        <!-- CERN's ROOT base directory --> | 
| 11 | 
        <property name="root" | 
| 12 | 
                  value="/opt/root"/> | 
| 13 | 
         | 
| 14 | 
        <!-- LOG4CXX base directory --> | 
| 15 | 
        <property name="log4cxx"  | 
| 16 | 
                  value="/opt/log4cxx"/> | 
| 17 | 
         | 
| 18 | 
        <!-- ant-contrib base directory --> | 
| 19 | 
        <property name="ant-contrib.lib" | 
| 20 | 
                  value="/opt/ant-contrib/lib"/> | 
| 21 | 
         | 
| 22 | 
     <!-- DEFAULT CONFIGURATION PARAMETERS --> | 
| 23 | 
         | 
| 24 | 
         | 
| 25 | 
     <!-- CONFIGURATION FILE. The properties in this file overwrite the previous properties --> | 
| 26 | 
        <!--<property file="../KYoda.properties"/>--> | 
| 27 | 
     <!-- CONFIGURATION FILE. The properties in this file overwrite the previous properties --> | 
| 28 | 
         | 
| 29 | 
     | 
| 30 | 
     <!--  | 
| 31 | 
             PARAMETRIZED PARAMETERS  | 
| 32 | 
             From here to the end there is NO NEED to modify anything | 
| 33 | 
    --> | 
| 34 | 
 | 
| 35 | 
     <!-- yoda source base directory --> | 
| 36 | 
     <property name="yoda.src" value="${basedir}"/>      | 
| 37 | 
      | 
| 38 | 
    <tstamp> | 
| 39 | 
            <format property="compilationFolder" pattern="hmsS" unit="millisecond"/> | 
| 40 | 
    </tstamp> | 
| 41 | 
 | 
| 42 | 
    <!-- Linux --> | 
| 43 | 
    <property name="local" value="/usr"/> | 
| 44 | 
    <property name="local.include" value="${local}/include"/> | 
| 45 | 
    <property name="local.lib" value="${local}/lib"/> | 
| 46 | 
     | 
| 47 | 
    <!-- CERN's ROOT --> | 
| 48 | 
    <property name="root.include" value="${root}/include"/> | 
| 49 | 
    <property name="root.lib" value="${root}/lib"/> | 
| 50 | 
     | 
| 51 | 
    <!-- log4cxx -->     | 
| 52 | 
    <property name="log4cxx.include" value="${log4cxx}/include"/> | 
| 53 | 
    <property name="log4cxx.lib" value="${log4cxx}/lib"/> | 
| 54 | 
     | 
| 55 | 
    <!-- ant-contrib library --> | 
| 56 | 
    <path id="classpath"> | 
| 57 | 
        <pathelement location="${ant-contrib.lib}/cpptasks.jar"/> | 
| 58 | 
    </path> | 
| 59 | 
     | 
| 60 | 
    <!-- | 
| 61 | 
          Load definition of C/C++ Tasks and Types | 
| 62 | 
          To allow the compilation and linking of C/C++ code   | 
| 63 | 
    --> | 
| 64 | 
    <taskdef classpathref="classpath" loaderref="classpath.loaderRef" resource="cpptasks.tasks"/> | 
| 65 | 
    <typedef classpathref="classpath" loaderref="classpath.loaderRef" resource="cpptasks.types"/> | 
| 66 | 
      | 
| 67 | 
    <!-- | 
| 68 | 
          Load definition of Additional Tasks and Types | 
| 69 | 
    -->  | 
| 70 | 
    <taskdef resource="net/sf/antcontrib/antcontrib.properties"> | 
| 71 | 
        <classpath> | 
| 72 | 
                <pathelement location="${ant-contrib.lib}/ant-contrib.jar"/> | 
| 73 | 
        </classpath> | 
| 74 | 
    </taskdef> | 
| 75 | 
     | 
| 76 | 
 | 
| 77 | 
    <target name="initYoda"> | 
| 78 | 
        <!-- Compiler parameters --> | 
| 79 | 
        <property name="compilationFolder.lib"          value="${compilationFolder}/lib"/> | 
| 80 | 
        <property name="compilationFolder.include"      value="${compilationFolder}/include"/> | 
| 81 | 
         | 
| 82 | 
        <!-- Yoda parameters --> | 
| 83 | 
        <property name="yoda.compilationFolder" value="${env.HOME}/tmp/${compilationFolder}"/> | 
| 84 | 
        <property name="yoda.obj"               value="${yoda.compilationFolder}/obj"/> | 
| 85 | 
        <property name="yoda.lib"               value="${yoda.compilationFolder}/lib"/> | 
| 86 | 
        <property name="yoda.bin"               value="${yoda.compilationFolder}/bin"/> | 
| 87 | 
         | 
| 88 | 
        <!-- Deploy parameters --> | 
| 89 | 
        <property name="deploy"         value="${pamSoftware}"/> | 
| 90 | 
        <property name="deploy.lib"     value="${pamSoftware}/lib"/> | 
| 91 | 
        <property name="deploy.include" value="${pamSoftware}/include"/> | 
| 92 | 
        <property name="deploy.bin"     value="${deploy}/bin"/> | 
| 93 | 
    </target> | 
| 94 | 
 | 
| 95 | 
    <compiler id="yoda-gcc" name="gcc"> | 
| 96 | 
            <includepath location="${local.include}"/> | 
| 97 | 
            <includepath location="${log4cxx.include}"/> | 
| 98 | 
            <includepath location="${root.include}"/> | 
| 99 | 
            <compilerarg value="-O4"/> | 
| 100 | 
            <compilerarg value="-g"/> | 
| 101 | 
    </compiler> | 
| 102 | 
     | 
| 103 | 
    <compiler id="yoda-fort" name="g77"> | 
| 104 | 
            <compilerarg value="-c"/> | 
| 105 | 
            <compilerarg value="-O0"/> | 
| 106 | 
    </compiler> | 
| 107 | 
     | 
| 108 | 
    <linker id="yoda-link"> | 
| 109 | 
            <libset dir="${root.lib}"    libs="Cint, Core, Tree"/> | 
| 110 | 
            <libset dir="${log4cxx.lib}" libs="log4cxx"/> | 
| 111 | 
            <libset libs="stdc++"/> | 
| 112 | 
            <libset libs="dl"/> | 
| 113 | 
            <libset              libs="g2c" unless="g2c"/> | 
| 114 | 
            <libset dir="${g2c}" libs="g2c" if="g2c"/> | 
| 115 | 
    </linker> | 
| 116 | 
     | 
| 117 | 
    <linker id="yoda-static"> | 
| 118 | 
            <libset dir="${root.lib}"    libs="Root"    type="static"/> | 
| 119 | 
            <libset dir="${log4cxx.lib}" libs="log4cxx" type="static"/> | 
| 120 | 
            <libset dir="${local.lib}" libs="gcc_s"/> | 
| 121 | 
            <!--<libset dir="/usr/lib/gcc/i586-mandriva-linux-gnu/4.0.1" libs="gcc, gcc_eh" type="static"/>--> | 
| 122 | 
            <!--<libset libs="dl"/>--> | 
| 123 | 
            <libset              libs="g2c" unless="g2c" type="static"/> | 
| 124 | 
            <libset dir="${g2c}" libs="g2c" if="g2c" type="static"/> | 
| 125 | 
    </linker> | 
| 126 | 
 | 
| 127 | 
     | 
| 128 | 
    <!--  | 
| 129 | 
         Clean the compilation folder | 
| 130 | 
    --> | 
| 131 | 
    <target description="Clean all build products." name="cleanYoda"> | 
| 132 | 
            <delete dir="${yoda.compilationFolder}"/> | 
| 133 | 
            <delete file="${yoda.src}/event/EventDict.cpp"/> | 
| 134 | 
            <delete file="${yoda.src}/event/EventDict.h"/> | 
| 135 | 
            <delete file="${yoda.src}/techmodel/TechmodelDict.cpp"/> | 
| 136 | 
            <delete file="${yoda.src}/techmodel/TechmodelDict.h"/> | 
| 137 | 
    </target> | 
| 138 | 
     | 
| 139 | 
    <target depends="cleanYoda, initYoda" description="Create Yoda library" name="compileYodaLib"> | 
| 140 | 
            <mkdir dir="${yoda.compilationFolder}"/> | 
| 141 | 
            <mkdir dir="${yoda.obj}"/> | 
| 142 | 
            <mkdir dir="${yoda.lib}"/> | 
| 143 | 
            <delete file="${yoda.src}/event/EventDict.cpp"/> | 
| 144 | 
            <delete file="${yoda.src}/event/EventDict.h"/> | 
| 145 | 
            <exec dir="${yoda.src}/event" executable="rootcint"> | 
| 146 | 
                    <arg line="-f EventDict.cpp -c -I.. -I../event -I${root.include} -I${log4cxx.include} | 
| 147 | 
                        arrDump/ArrDumpEvent.h arrDump/ArrDumpRecord.h | 
| 148 | 
                        endrun/CaloEndRun.h    endrun/PhysEndRunEvent.h endrun/TBEndRun.h | 
| 149 | 
                        mcmd/McmdEvent.h       mcmd/McmdRecord.h | 
| 150 | 
                        log/LogEvent.h         log/LogRecord.h | 
| 151 | 
                        tabDump/TabDumpEvent.h tabDump/TabDumpRecord.h | 
| 152 | 
                        tmtc/TmtcEvent.h       tmtc/TmtcRecord.h | 
| 153 | 
                        tsbb/TsbBEvent.h       tsbb/TsbBRecord.h | 
| 154 | 
                        tsbt/TsbTEvent.h       tsbt/TsbTRecord.h | 
| 155 | 
                        varDump/VarDumpEvent.h varDump/VarDumpRecord.h | 
| 156 | 
                        physics/anticounter/AnticounterEvent.h  | 
| 157 | 
                        physics/calorimeter/CalorimeterEvent.h  | 
| 158 | 
                        physics/neutronDetector/NeutronEvent.h     physics/neutronDetector/NeutronRecord.h  | 
| 159 | 
                        physics/S4/S4Event.h | 
| 160 | 
                        physics/tof/TofEvent.h | 
| 161 | 
                        physics/tracker/TrackerEvent.h | 
| 162 | 
                        physics/trigger/TriggerEvent.h | 
| 163 | 
                        PamelaRun.h            RunInfo.h | 
| 164 | 
                        SubPacket.h            PacketType.h        SubDetector.h            | 
| 165 | 
                        DirectoryStructure.h   Algorithm.h         AlgorithmInfo.h          | 
| 166 | 
                        EventHeader.h          PscuHeader.h        EventCounter.h           | 
| 167 | 
                        PscuEvent.h            CalibCalPulse1Event.h                        | 
| 168 | 
                        CalibCalPulse2Event.h  CalibTrk1Event.h    CalibTrk2Event.h         | 
| 169 | 
                        CalibTofEvent.h        CalibS4Event.h      CalibCalPedEvent.h       | 
| 170 | 
                        Calib1_Ac1Event.h      Calib1_Ac2Event.h   Calib2_Ac1Event.h   Calib2_Ac2Event.h    | 
| 171 | 
                        RunHeaderEvent.h       RunTrailerEvent.h                            | 
| 172 | 
                        CalibHeaderEvent.h     CalibTrailerEvent.h InitHeaderEvent.h        | 
| 173 | 
                        InitTrailerEvent.h     EventTrkEvent.h | 
| 174 | 
                        ForcedFECmdEvent.h     Ac1InitEvent.h           | 
| 175 | 
                        CalInitEvent.h         TrkInitEvent.h      TofInitEvent.h           | 
| 176 | 
                        TrgInitEvent.h         NdInitEvent.h       S4InitEvent.h            | 
| 177 | 
                        Ac2InitEvent.h         CalAlarmEvent.h     AcAlarmEvent.h           | 
| 178 | 
                        TrkAlarmEvent.h        TrgAlarmEvent.h     TofAlarmEvent.h          | 
| 179 | 
                        S4AlarmEvent.h         RegistryEvent.h     Exception.h LinkDef.h"/> | 
| 180 | 
            </exec> | 
| 181 | 
            <cc objdir="${yoda.obj}" outfile="${yoda.lib}/yoda" outtype="shared"> | 
| 182 | 
                    <compiler extends="yoda-gcc"> | 
| 183 | 
                            <fileset dir="${yoda.src}/event" includes="**/*.cpp, **/*.c"/> | 
| 184 | 
                            <includepath location="${yoda.src}/event"/> | 
| 185 | 
                    </compiler> | 
| 186 | 
                    <linker extends="yoda-link"/> | 
| 187 | 
            </cc> | 
| 188 | 
    </target> | 
| 189 | 
     | 
| 190 | 
    <target depends="compileYodaLib" description="Create Yoda flight library" name="compileYoda"> | 
| 191 | 
            <delete file="${yoda.src}/event/TechmodelDict.cpp"/> | 
| 192 | 
            <delete file="${yoda.src}/event/TechmodelDict.h"/> | 
| 193 | 
            <mkdir dir="${yoda.bin}"/> | 
| 194 | 
            <exec dir="${yoda.src}/techmodel" executable="rootcint"> | 
| 195 | 
                    <arg line="-f TechmodelDict.cpp -c -I.. -I../event -I${root.include} -I${log4cxx.include} TechmodelAlgorithm.h EventReader.h LinkDef.h"/> | 
| 196 | 
            </exec> | 
| 197 | 
            <cc objdir="${yoda.obj}" outfile="${yoda.bin}/yoda" outtype="executable"> | 
| 198 | 
                    <compiler extends="yoda-gcc"> | 
| 199 | 
                            <fileset dir="${yoda.src}/techmodel" includes="**/*.cpp, **/*.c"/> | 
| 200 | 
                            <includepath location="${yoda.src}/techmodel"/> | 
| 201 | 
                            <includepath location="${yoda.src}/event"/> | 
| 202 | 
                            <includepath location="${yoda.src}"/> | 
| 203 | 
                    </compiler> | 
| 204 | 
                    <compiler extends="yoda-fort"> | 
| 205 | 
                            <fileset dir="${yoda.src}/techmodel/forroutines/calorimeter" includes="**/*.for"/> | 
| 206 | 
                            <fileset dir="${yoda.src}/techmodel/forroutines/tof" includes="**/*.for"/> | 
| 207 | 
                            <fileset dir="${yoda.src}/techmodel/forroutines/tracker/readraw" includes="**/*.f"/> | 
| 208 | 
                            <fileset dir="${yoda.src}/techmodel/forroutines/trigger" includes="**/*.for"/> | 
| 209 | 
                    </compiler> | 
| 210 | 
                    <linker extends="yoda-link"> | 
| 211 | 
                            <libset dir="${yoda.lib}" libs="yoda" type="shared"/> | 
| 212 | 
                    </linker> | 
| 213 | 
            </cc> | 
| 214 | 
    </target> | 
| 215 | 
     | 
| 216 | 
    <target depends="compileYoda" description="Deploy the Yoda" name="deployYoda"> | 
| 217 | 
        <mkdir dir="${deploy}"/> | 
| 218 | 
        <mkdir dir="${deploy.lib}"/> | 
| 219 | 
        <mkdir dir="${deploy.include}"/> | 
| 220 | 
        <mkdir dir="${deploy.include}/yoda"/> | 
| 221 | 
        <mkdir dir="${deploy.bin}"/> | 
| 222 | 
        <copy todir="${deploy.include}/yoda"> | 
| 223 | 
                    <fileset dir="${yoda.src}/event" includes="**/*.h" excludes="**/*Dict*"/> | 
| 224 | 
            </copy> | 
| 225 | 
            <copy todir="${deploy.lib}"> | 
| 226 | 
                    <fileset dir="${yoda.lib}" includes="*.so"/> | 
| 227 | 
            </copy> | 
| 228 | 
            <copy todir="${deploy.bin}"> | 
| 229 | 
                    <fileset dir="${yoda.bin}" includes="*" excludes="*.*"/> | 
| 230 | 
            </copy> | 
| 231 | 
            <chmod dir="${deploy.bin}" perm="775" includes="**/*"/> | 
| 232 | 
    </target> | 
| 233 | 
</project> |