~maddevelopers/mg5amcnlo/3.0.2-alpha0

« back to all changes in this revision

Viewing changes to Template/bin/compile

Added Template and HELAS into bzr

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
#
 
3
################################################################################
 
4
#                                                                             ##
 
5
#                    MadGraph/MadEvent                                        ##
 
6
#                                                                             ##
 
7
# FILE : compile                                                              ##
 
8
# VERSION : 1.0                                                               ##
 
9
# DATE : 23 Septembre 2007                                                    ##
 
10
# AUTHOR : MH - MadGraph team                                                 ##
 
11
#                                                                             ##
 
12
# DESCRIPTION : script to compile madevent                                    ##
 
13
# USAGE : ./make_package                                                      ##
 
14
################################################################################
 
15
 
 
16
# set nonomatch
 
17
 
 
18
if [[ ! -d ./bin ]]; then
 
19
    cd ../
 
20
    if [[ ! -d ./bin ]]; then
 
21
        echo "Error: it must be executed from the main, or bin directory"
 
22
        exit
 
23
    fi
 
24
fi
 
25
 
 
26
 
 
27
#
 
28
# If argument is equal to 'd' use dynamic libraries
 
29
#
 
30
echo $PWD
 
31
if [[  "$1" == ""  ]]; then
 
32
    echo "Using default makefiles"
 
33
elif [[ "$1" == "dynamic" && "$2" == "lhapdf" ]]; then
 
34
    echo "Changing makefiles for the generation of dynamic libraries including LHAPDF support (might not work under MacOsX)"
 
35
    if [[ -e ./Source/makefile_dlhapdf ]]; then
 
36
        mv ./Source/makefile ./Source/makefile_static
 
37
        cp ./Source/makefile_dlhapdf ./Source/makefile
 
38
    else
 
39
        echo "Error: Could not replace Source/makefile"
 
40
        exit
 
41
    fi
 
42
    if [[ -e SubProcesses/makefile_dlhapdf ]]; then
 
43
        mv SubProcesses/makefile SubProcesses/makefile_static
 
44
        cp SubProcesses/makefile_dlhapdf SubProcesses/makefile
 
45
    else
 
46
        echo "Error: Could not replace SubProcesses/makefile"
 
47
        exit
 
48
    fi
 
49
    if [[ -e SubProcesses/makefile_mo_dlhapdf ]]; then
 
50
        mv SubProcesses/makefile SubProcesses/makefile_static
 
51
        cp SubProcesses/makefile_mo_dlhapdf SubProcesses/makefile_mo
 
52
    else
 
53
        echo "Error: Could not replace SubProcesses/makefile_mo"
 
54
        exit
 
55
    fi
 
56
    if [[ -e Source/DHELAS/Makefile_dynamic ]]; then
 
57
        mv Source/DHELAS/Makefile Source/DHELAS/Makefile_static
 
58
        cp Source/DHELAS/Makefile_dynamic Source/DHELAS/Makefile
 
59
        sed -i.bak "s|f77|gfortran|g" Source/DHELAS/Makefile
 
60
    else
 
61
        echo "Error: Could not replace Source/DHELAS/Makefile"
 
62
        exit
 
63
    fi
 
64
    if [[ -e Source/MODEL/makefile_dynamic ]]; then
 
65
        mv Source/MODEL/makefile Source/MODEL/makefile_static
 
66
        cp Source/MODEL/makefile_dynamic Source/MODEL/makefile
 
67
        sed -i.bak "s|f77|gfortran|g" Source/MODEL/makefile
 
68
    else
 
69
        echo "Error: Could not replace Source/MODEL/makefile"
 
70
        exit
 
71
    fi
 
72
    if [[ -e Source/CERNLIB/makefile_dynamic ]]; then
 
73
        mv Source/CERNLIB/makefile Source/CERNLIB/makefile_static
 
74
        cp Source/CERNLIB/makefile_dynamic Source/CERNLIB/makefile
 
75
        sed -i.bak "s|f77|gfortran|g" Source/CERNLIB/makefile
 
76
    else
 
77
        echo "Error: Could not replace Source/CERNLIB/makefile"
 
78
        exit
 
79
    fi
 
80
    if [[ -e Source/PDF/makefile_dlhapdf ]]; then
 
81
        mv Source/PDF/makefile Source/PDF/makefile_static
 
82
        cp Source/PDF/makefile_dlhapdf Source/PDF/makefile
 
83
    else
 
84
        echo "Error: Could not replace Source/PDF/makefile"
 
85
        exit
 
86
    fi
 
87
elif [[ "$1" == "dynamic" ]]; then
 
88
    echo "Changing makefiles for the generation of dynamic libraries (might not work under MacOsX)"
 
89
    if [[ -e ./Source/makefile_dynamic ]]; then
 
90
        mv ./Source/makefile ./Source/makefile_static
 
91
        cp ./Source/makefile_dynamic ./Source/makefile
 
92
    else
 
93
        echo "Error: Could not replace Source/makefile"
 
94
        exit
 
95
    fi
 
96
    if [[ -e SubProcesses/makefile_dynamic ]]; then
 
97
        mv SubProcesses/makefile SubProcesses/makefile_static
 
98
        cp SubProcesses/makefile_dynamic SubProcesses/makefile
 
99
    else
 
100
        echo "Error: Could not replace SubProcesses/makefile"
 
101
        exit
 
102
    fi
 
103
    if [[ -e Source/DHELAS/Makefile_dynamic ]]; then
 
104
        mv Source/DHELAS/Makefile Source/DHELAS/Makefile_static
 
105
        cp Source/DHELAS/Makefile_dynamic Source/DHELAS/Makefile
 
106
    else
 
107
        echo "Error: Could not replace Source/DHELAS/Makefile"
 
108
        exit
 
109
    fi
 
110
    if [[ -e Source/MODEL/makefile_dynamic ]]; then
 
111
        mv Source/MODEL/makefile Source/MODEL/makefile_static
 
112
        cp Source/MODEL/makefile_dynamic Source/MODEL/makefile
 
113
    else
 
114
        echo "Error: Could not replace Source/MODEL/makefile"
 
115
        exit
 
116
    fi
 
117
    if [[ -e Source/CERNLIB/makefile_dynamic ]]; then
 
118
        mv Source/CERNLIB/makefile Source/CERNLIB/makefile_static
 
119
        cp Source/CERNLIB/makefile_dynamic Source/CERNLIB/makefile
 
120
    else
 
121
        echo "Error: Could not replace Source/CERNLIB/makefile"
 
122
        exit
 
123
    fi
 
124
    if [[ -e Source/PDF/makefile_dynamic ]]; then
 
125
        mv Source/PDF/makefile Source/PDF/makefile_static
 
126
        cp Source/PDF/makefile_dynamic Source/PDF/makefile
 
127
    else
 
128
        echo "Error: Could not replace Source/PDF/makefile"
 
129
        exit
 
130
    fi
 
131
else
 
132
    echo Error: invalid argument $1
 
133
    exit
 
134
fi
 
135
 
 
136
#
 
137
#  Now let shell know where to find important executables
 
138
#
 
139
 
 
140
if [[ -d Source ]]; then
 
141
    cd Source
 
142
    make ../bin/sum_html
 
143
    make ../bin/gen_ximprove
 
144
    make all
 
145
    make ../bin/combine_events
 
146
    cd ..
 
147
else
 
148
    echo 'Error Source directory not found'
 
149
    exit
 
150
fi
 
151
 
 
152
if [[ -d SubProcesses ]]; then
 
153
    cd SubProcesses
 
154
    for i in `cat subproc.mg` ; do
 
155
        cd $i
 
156
        echo $i
 
157
        rm -f ajob* >& /dev/null
 
158
        rm -f wait.ajob* >& /dev/null
 
159
        rm -f run.ajob* >& /dev/null
 
160
        rm -f done.ajob* >& /dev/null
 
161
#        if [[ -e ajob1 ]]; then
 
162
#          chmod +x ajob*
 
163
        make madevent > /dev/null
 
164
#        fi
 
165
        cd ..
 
166
     done
 
167
    cd ..
 
168
else
 
169
    echo "Error could not find SubProcesses"
 
170
    exit
 
171
fi
 
172
 
 
173
if [[ -d ../DECAY ]]; then
 
174
    echo "DECAY directory found, compiling..."
 
175
    cd ../DECAY
 
176
    if [[  "$1" == ""  ]]; then
 
177
        sed -i.bak "s|HELAS/lib/libdhelas3.a|madevent/lib/libdhelas3.a|g" makefile
 
178
    elif [[ "$1" == "dynamic" ]]; then
 
179
        sed -i.bak "s|HELAS/lib/libdhelas3.a|madevent/lib/libdhelas3.so|g" makefile
 
180
    else
 
181
        echo Error: invalid argument $1
 
182
        exit
 
183
    fi
 
184
    make
 
185
fi
 
186
 
 
187
echo ""
 
188