-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·137 lines (136 loc) · 5.11 KB
/
Copy pathbuild
File metadata and controls
executable file
·137 lines (136 loc) · 5.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
#!/bin/bash
#
# Si cmake merde, on peut utiliser ce script pour construire un
# makefile generique qui incluera ensuite une makefile.MACHINE dependant de
# la machine cible
#
echo -e "\033[1;30m================================================================="
echo " .d8888b. .d888888 d8888 888 888888888 .d8888b. "
echo " d88P Y88b d88 d88888 888 888 d88P Y88b "
echo " Y88b. 888 d88P888 888 888 Y88b. "
echo ' "Y888b. 888 d88P 888 888 888888 "Y888b. '
echo ' "Y88b. 888 d88P 888 888 888 "Y88b.'
echo ' "888 888 d888888888 888 888 "888'
echo " Y88b d88P Y88 d88P 888 888 888 Y88b d88P "
echo ' "Y8888P" "8888888 d88P 888 88888888 888888888 "Y8888P"'
echo -e "=================================================================\033[0m"
ICI=`pwd`
SRC=`basename $ICI`
if [ $SRC != 'src' ]
then
echo "Vous n'etes pas dans le dossier src du code!"
exit
fi
DIRMKDEPF90=`which makedepf90`
RESCMD=`$DIRMKDEPF90 | wc -l `
#RESCMD=0
if [ $RESCMD -ne 0 ]
then
echo "makedepf90 detected at path : $DIRMKDEPF90"
MKDEPF90=$DIRMKDEPF90
elif [ $RESCMD -eq 0 ]
then
cd ../tools/.
if [ -d ./makedepf90-2.8.8 ] && [ -d ./makedepf90-2.8.8/bin ]
then
cd ./makedepf90-2.8.8/bin
MKDEPF90=`pwd`/makedepf90
echo "makedepf90 detected at path : $MKDEPF90"
else
if [ ! -d ./makedepf90-2.8.8 ]
then
echo "makedepf90 not found"
echo "uncompressing archive of makedepthf90..."
tar -xzf makedepf90-2.8.8.tar.gz
fi
if [ -d ./makedepf90-2.8.8 ] && [ ! -d ./makedepf90-2.8.8/bin ]
then
echo "installation in progress..."
cd ./makedepf90-2.8.8/.
./configure --prefix=`pwd` -q && make > /dev/null && make install > /dev/null
cd ..
fi
if [ -d ./makedepf90-2.8.8/bin ]
then
MKDEPF90=`pwd`/makedepf90-2.8.8/bin/makedepf90
export PATH=`pwd`/makedepf90-2.8.8/bin:$PATH
echo "installation of makedepthf90 : OK"
else
echo "makedepf90 not found and installation failed..."
exit
fi
fi
fi
cd $ICI
BUILDDIR=./builddir
MACHINEDIR=machine
EXE=codescalar.exe
#
if [ -d $BUILDDIR ]
then
rm -rf $BUILDDIR
fi
mkdir $BUILDDIR
echo "creation of builddir : OK"
#
for fich in `find . \( -name \*.f90 -o -name \*.F90 -o -name \*.c -o -name \*.h \) -print | grep -vE "(real|cmplx)"`
do
local=`basename $fich`
(cd $BUILDDIR; ln -s .$fich $local)
done
echo "creation of symbolic link of all fortran files in builddir : OK"
#
for fich in `find . -name \*implement\*.Fortran -print`
do
local=`basename $fich`
sed -e "s/TAG_/REAL/g" -e "s/tag_/real/g" < $fich > $BUILDDIR/`echo $local|sed -e "s/implement/real/" -e "s/Fortran/F90/"`
sed -e "s/TAG_/COMPLEX/g" -e "s/tag_/cmplx/g" < $fich > $BUILDDIR/`echo $local|sed -e "s/implement/complex/" -e "s/Fortran/F90/"`
done
echo "generation of *.Fortran in builddir : OK"
#
SCALE_HOSTTYPE=`hostname -s | tr -d "[0-9]"`
echo "hostname is : $SCALE_HOSTTYPE"
#
(
echo "include ../machine/$SCALE_HOSTTYPE.makefile"
echo '.SUFFIXES:'
echo '.SUFFIXES: .f90 .o'
echo '.f90.o:'
echo ' $(FC) -c $(FFLAGS) $<'
echo '.SUFFIXES: .F90 .o'
echo '.F90.o:'
echo ' $(FC) -c $(FFLAGS) $<'
echo ''
echo 'wrapper: compil_verbose'
echo ''
echo 'compil_verbose: codescalar.exe'
echo ' @echo -e "\033[1;31m===== Compilation successfull =====\033[0m"'
echo ' @cd ../.. ;ln -fs src/builddir/codescalar.exe scaleExe ; cd ./src/builddir/.'
echo ' @echo -e "\033[1;30mProgram is in `(cd ../..;pwd)`/scaleExe\033[0m"'
)>$BUILDDIR/Makefile
(cd $BUILDDIR; $MKDEPF90 -o $EXE *.f90 *.F90) >>$BUILDDIR/Makefile
(echo 'fann_run.o : fann_run.c'
echo ' $(CC) -c $(CFLAGS) fann_run.c'
echo ''
echo 'clean:'
echo ' @rm -rf *.o *.mod core ../../doc/doxygen/codescalar_doc'
echo 'doc:'
echo ' @cd ../../doc/doxygen && doxygen Doxyfile && echo "Doc start in `pwd`codescalar_doc/html/index.html"'
echo 'fortran_file:'
)>>$BUILDDIR/Makefile
line=`grep -E "^FOBJ=" $BUILDDIR/Makefile`
sed -e "s/${line}/${line}fann_run.o/g" $BUILDDIR/Makefile > temp ; mv temp $BUILDDIR/Makefile
for fich in `find . -name \*implement\*.Fortran -print`
do
local=`basename $fich`
(
echo " @sed -e \"s/TAG_/REAL/g\" -e \"s/tag_/real/g\" < .${fich} > \`echo ${local}|sed -e \"s/implement/real/\" -e \"s/Fortran/F90/\"\`"
echo " @sed -e \"s/TAG_/COMPLEX/g\" -e \"s/tag_/cmplx/g\" < .${fich} > \`echo ${local}|sed -e \"s/implement/complex/\" -e \"s/Fortran/F90/\"\`"
) >> $BUILDDIR/Makefile
done
echo "generation of Makfefile in builddir : OK"
echo -e "\033[1;31m===== Generation of installation files successfull =====\033[0m"
echo -e '\033[1;32mNow run: "make -C builddir" to build the application'
echo -e ' "make -C builddir doc" to generate the documentation'
echo -e ' "make -C builddir clean" to clean sources files'
echo -e ' "make -C builddir fortran_file" to generate *implement*.Fortran files\033[0m'