Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
DLR-AMR
GitHub Repository: DLR-AMR/t8code
Path: blob/main/scripts/find_all_source_files.sh
900 views
1
#!/bin/bash
2
3
# This file is part of t8code.
4
# t8code is a C library to manage a collection (a forest) of multiple
5
# connected adaptive space-trees of general element classes in parallel.
6
#
7
# Copyright (C) 2023 the developers
8
#
9
# t8code is free software; you can redistribute it and/or modify
10
# it under the terms of the GNU General Public License as published by
11
# the Free Software Foundation; either version 2 of the License, or
12
# (at your option) any later version.
13
#
14
# t8code is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
# GNU General Public License for more details.
18
#
19
# You should have received a copy of the GNU General Public License
20
# along with t8code; if not, write to the Free Software Foundation, Inc.,
21
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
23
# This script lists all .c .h .cxx and .hxx
24
# files in t8code's src/ example/ and test/ subfolders.
25
#
26
27
#
28
# This script must be executed from the scripts/ folder.
29
#
30
if [ `basename $PWD` != scripts ]
31
then
32
if [ -d scripts ]
33
then
34
# The directory stack is automatically reset on script exit.
35
pushd scripts/ > /dev/null
36
else
37
echo ERROR: scripts/ directory not found.
38
exit 1
39
fi
40
fi
41
42
# All valid file suffixes.
43
# Separated by '|' in order to be directly used
44
# as a regex in the find command.
45
46
suffixes="c|cxx|h|hxx"
47
48
# Find a suitable find program. Either 'find' or 'gfind'.
49
if find --version >/dev/null 2>&1; then
50
FIND=find
51
else
52
echo "GNU find not found, trying gfind..."
53
if gfind --version >/dev/null 2>&1; then
54
FIND=gfind
55
else
56
echo "Error: GNU find not found."
57
exit 1
58
fi
59
fi
60
61
# Find all files with the appropriate suffix in the
62
# src/, example/, test/, tutorials/, benchmark/, /api and /mesh_handle subfolders.
63
files=`$FIND ../src ../example ../test ../tutorials ../benchmarks ../api ../mesh_handle -regextype egrep -iregex ".*\.($suffixes)"`
64
65
echo $files
66
67