-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrepeatall
executable file
·119 lines (99 loc) · 2.57 KB
/
repeatall
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
#!/bin/bash
#
# bash script to compile shspe with cmake
# ---------------------------------------------
#
# Typical calls are 2 and are like this:
#
# -I/home/ojr/root/include -o CMakeFiles/shspe.dir/shspe.C.o -c /home/ojr/02_GIT/ALLMYGITS/ALL/shspe/shspe.C
#
# CMakeFiles/shspe.dir/shspe.C.o -o shspe -rdynamic
##############################
# $MACROC - contains compilation function
read -r -d '' MACROC << EOF
void tmp(){
gROOT->ProcessLine(".L shspe.C++g");
}
EOF
##################################
# I COMPILE BY LOADING to root. quiet. batch.
function COMPILE {
echo "$ROOTSYS/bin/root -n -b -q $1"
$ROOTSYS/bin/root -n -b -q $1 >/dev/null
}
#####################################
# parameter parsing:
# #1 target (compile)
# #5 C filename
#
#
TARGET="" # compile/link
compfile=""
echo ======================= arguments obtained =============
echo $@
echo "----------------------- arguments obtained -------------"
sleep 2
echo "$1" | grep "\-I" > /dev/null
if [ "$?" = "0" ]; then ### 1st CALL
TARGET=compile
compfile=`basename "$5"`
echo $compfile is C file to compile
fi
echo "$1" | grep "CMakeFiles/" | grep ".C.o" >/dev/null
if [ "$?" = "0" ]; then ### 2nd CALL
TARGET=link
fi
#####################################
# print parameters - for fun....
i=0
while [ "$1" != "" ]; do
echo "parameter $i: $1"
i=$(( $i + 1 ))
shift
done
####################################
#### # 1st call of cmake --build . .... load to root.exe
if [ "$TARGET" = "compile" ]; then
echo ... INCLUDE ... compiling
File=`mktemp`
echo "$MACROC" > $File
#echo $File is to compile
#cat $File
echo $compfile
COMPILE $File
exit
fi
### # 2nd call of cmake --build . ... copy to somewhere
if [ "$TARGET" = "link" ]; then
echo ... CMake ... linking_________________________________
ls -l *.so
echo ______________________________________________________
echo " "
paths=`cat ~/.rootrc | grep -v -e "^\#" | grep Unix | grep DynamicPath | awk '{print $2}'`
echo POSSIBLE DESTINATION: $paths
CPIED=0
IFS=':' read -ra ADDR <<< "$paths"
for i in "${ADDR[@]}"; do
ii=` sed "s#~#$HOME#" <<< $i`
i="$ii"
printf "PATH: %-30s" $i
if [ "$i" != "." ]; then
if [ -d "$i" ]; then
if [ "$CPIED" = "0" ]; then
echo " .. YES, I copy here"
cp *.so $i/
CPIED=1
else
echo " .. already copied"
fi
#break
else
echo " .. not DIR"
fi
else
echo " .. no"
fi
done
notify-send "compilation finished"
exit
fi