3
################################################################################
9
# DATE : 23 Septembre 2007 ##
10
# AUTHOR : MH - MadGraph team ##
12
# DESCRIPTION : script to compile madevent ##
13
# USAGE : ./make_package ##
14
################################################################################
18
if [[ ! -d ./bin ]]; then
20
if [[ ! -d ./bin ]]; then
21
echo "Error: it must be executed from the main, or bin directory"
28
# If argument is equal to 'd' use dynamic libraries
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
39
echo "Error: Could not replace Source/makefile"
42
if [[ -e SubProcesses/makefile_dlhapdf ]]; then
43
mv SubProcesses/makefile SubProcesses/makefile_static
44
cp SubProcesses/makefile_dlhapdf SubProcesses/makefile
46
echo "Error: Could not replace SubProcesses/makefile"
49
if [[ -e SubProcesses/makefile_mo_dlhapdf ]]; then
50
mv SubProcesses/makefile SubProcesses/makefile_static
51
cp SubProcesses/makefile_mo_dlhapdf SubProcesses/makefile_mo
53
echo "Error: Could not replace SubProcesses/makefile_mo"
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
61
echo "Error: Could not replace Source/DHELAS/Makefile"
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
69
echo "Error: Could not replace Source/MODEL/makefile"
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
77
echo "Error: Could not replace Source/CERNLIB/makefile"
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
84
echo "Error: Could not replace Source/PDF/makefile"
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
93
echo "Error: Could not replace Source/makefile"
96
if [[ -e SubProcesses/makefile_dynamic ]]; then
97
mv SubProcesses/makefile SubProcesses/makefile_static
98
cp SubProcesses/makefile_dynamic SubProcesses/makefile
100
echo "Error: Could not replace SubProcesses/makefile"
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
107
echo "Error: Could not replace Source/DHELAS/Makefile"
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
114
echo "Error: Could not replace Source/MODEL/makefile"
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
121
echo "Error: Could not replace Source/CERNLIB/makefile"
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
128
echo "Error: Could not replace Source/PDF/makefile"
132
echo Error: invalid argument $1
137
# Now let shell know where to find important executables
140
if [[ -d Source ]]; then
143
make ../bin/gen_ximprove
145
make ../bin/combine_events
148
echo 'Error Source directory not found'
152
if [[ -d SubProcesses ]]; then
154
for i in `cat subproc.mg` ; do
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
163
make madevent > /dev/null
169
echo "Error could not find SubProcesses"
173
if [[ -d ../DECAY ]]; then
174
echo "DECAY directory found, compiling..."
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
181
echo Error: invalid argument $1