Skip to content

Commit 8dab95b

Browse files
committed
support direct access to the file as well
1 parent f5f67ec commit 8dab95b

File tree

1 file changed

+41
-13
lines changed

1 file changed

+41
-13
lines changed

grab_xyce.sh

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,24 @@
11
#!/bin/sh
2+
#-------------------------------------------------------------------------
3+
#
4+
# Copyright (c) 2020 Rajit Manohar
5+
#
6+
# This program is free software; you can redistribute it and/or
7+
# modify it under the terms of the GNU General Public License
8+
# as published by the Free Software Foundation; either version 2
9+
# of the License, or (at your option) any later version.
10+
#
11+
# This program is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with this program; if not, write to the Free Software
18+
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
19+
# Boston, MA 02110-1301, USA.
20+
#
21+
#-------------------------------------------------------------------------
222

323
if [ $# -ne 1 ]
424
then
@@ -10,38 +30,46 @@ xyce_build=$1
1030

1131
echo "Xyce build dir: $xyce_build"
1232

13-
if [ ! -d $xyce_build ]
33+
if [ -f $xyce_build/link.txt ]
1434
then
35+
$file=$xyce_build/link.txt
36+
else
37+
if [ ! -d $xyce_build ]
38+
then
1539
echo "Could not find directory $xyce_build"
1640
exit 1
17-
fi
41+
fi
1842

19-
if [ ! -d $xyce_build/src/CMakeFiles/Xyce.dir ]
20-
then
43+
if [ ! -d $xyce_build/src/CMakeFiles/Xyce.dir ]
44+
then
2145
echo "Could not find Xyce sub-directory (src/CMakeFiles/Xyce.dir) in $xyce_build"
2246
exit 1
23-
fi
47+
fi
2448

25-
file=$xyce_build/src/CMakeFiles/Xyce.dir/link.txt
49+
file=$xyce_build/src/CMakeFiles/Xyce.dir/link.txt
50+
fi
2651

2752
if [ ! -f $file ]
2853
then
29-
echo "Could not find Xyce link.txt file in build directory"
30-
exit 1
54+
echo "Could not find Xyce link.txt file in build directory"
55+
exit 1
3156
fi
3257

58+
#
59+
# Now find the linker options!
60+
#
61+
3362
linker_stuff=
3463
compiler_stuff=
35-
3664
found=0
3765

3866
for i in `cat $file`
3967
do
40-
case $found in
68+
case $found in
4169
0) compiler_stuff=$i; found=1;;
4270
1) if [ $i = "Xyce" ]
4371
then
44-
found=2
72+
found=2
4573
fi;;
4674
2) if [ $i = "libxyce.a" ]
4775
then
@@ -50,10 +78,10 @@ do
5078
val=$i
5179
fi;
5280
linker_stuff="${linker_stuff} $val";;
53-
esac
81+
esac
5482
done
5583

56-
echo
84+
echo
5785
echo "Creating xyce.in..."
5886
echo
5987
echo "Xyce was linked with the following compiler:"

0 commit comments

Comments
 (0)