forked from hxmhuang/OpenArray_Dev
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·84 lines (66 loc) · 2.16 KB
/
Copy pathtest.sh
File metadata and controls
executable file
·84 lines (66 loc) · 2.16 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
#!/bin/bash
#build_dir=./build
build_dir=`pwd`/build
current_dir=`pwd`
osname=`uname`
if [ ! -d "$build_dir" ]; then
mkdir ${build_dir}
fi
cp makefile* ${build_dir}/ 2>/dev/null
sed -i "s/##===##//g" ${build_dir}/makefile*
for d in `find . -maxdepth 2 -type d`
do
full=$current_dir/`echo $d | cut -c3-`
if [[ $full == *"build"* ]]
then
continue
fi
if [ ! -d "${build_dir}/${d}" ]; then
mkdir ${build_dir}/${d}
fi
for f in `find $full -maxdepth 1 -type f \
\( -iname \*.F90 \
-o -iname \*.h \
-o -iname \*.h90 \
-o -iname \*.hpp \
-o -iname \*.cpp \
-o -iname \*.c \) \
2>/dev/null`
do
filename="${f%.*}"
extension="${f##*.}"
filename=$(basename $filename)
#echo $filename.$extension
src_filename=$full/$filename.$extension
dst_filename=${build_dir}/`echo ${d} | cut -c3-`/$filename.$extension
# echo $src_filename
# echo $dst_filename
#m4 ${filename}.${extension} > \
# ${build_dir}/$filename.${extension}
#./fypp ${filename}.${extension} > \
# ${build_dir}/$filename.${extension} -m re
#echo ./${build_dir}/$f
#echo $f | cut -d '\.\/' -f 2
if [ ! -f "$dst_filename" ]; then
./fypp -p -m re -m string -m io -m os --create-parents \
$src_filename > $dst_filename &
echo " >>>processing file $src_filename"
else
if [ "$osname" = "Linux" ];then
src_time=$(date +'%y%m%d%H%M%S' -r $src_filename)
dst_time=$(date +'%y%m%d%H%M%S' -r $dst_filename)
else
src_time=$(stat -f "%Sm" -t "%y%m%d%H%M%S" $src_filename)
dst_time=$(stat -f "%Sm" -t "%y%m%d%H%M%S" $dst_filename)
fi
#src_time=$(stat -f "%Sm" -t "%y%m%d%H%M" $src_filename)
#dst_time=$(stat -f "%Sm" -t "%y%m%d%H%M" $dst_filename)
if [[ "$src_time" > "$dst_time" ]]; then
./fypp -p -m re -m string -m io -m os --create-parents \
$src_filename > $dst_filename
echo " >>>processing file $src_filename"
fi
fi
done
done
wait