File: Allwmake

package info (click to toggle)
openfoam 1812%2Bdfsg1-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 220,284 kB
  • sloc: cpp: 1,038,902; sh: 14,536; ansic: 8,240; lex: 657; xml: 387; python: 300; awk: 212; makefile: 94; sed: 88; csh: 3
file content (139 lines) | stat: -rwxr-xr-x 3,135 bytes parent folder | download
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
138
139
#!/bin/sh
cd ${0%/*} || exit 1    # Run from this directory
[ -d "$WM_PROJECT_DIR" ] || {
    echo "Error (${0##*/}) : no \$WM_PROJECT_DIR found"
    echo "    Check your OpenFOAM environment and installation"
    echo "    WM_PROJECT_DIR=$WM_PROJECT_DIR"
    exit 1
}

usage() {
    exec 1>&2
    while [ "$#" -ge 1 ]; do echo "$1"; shift; done
    cat<<USAGE

usage: ${0##*/} [OPTION] [dir1 .. dirN]
options:
  -config name      use alternative doxygen config
  -dir    name      process given directory name directly
  -online           use links to the Github repositories instead of the
                    local source code
  -help

Run doxygen on OpenFOAM sources, or on specified directories only.

USAGE
    exit 1
}


# -----------------------------------------------------------------------------

defineURL() {
    WEB_PATH="https://develop.openfoam.com"
    FOAM_REPO_VERSION="$WM_PROJECT-plus"

    case "$WM_PROJECT_VERSION" in
    v[1-9][.0-9]*)
        FOAM_REPO_TAG="$WM_PROJECT-$WM_PROJECT_VERSION"
        ;;
    *)
        FOAM_REPO_TAG="master"
        ;;
    esac

    export FOAM_BASE_REPO="$WEB_PATH/Development/$FOAM_REPO_VERSION"
    export FOAM_ONLINE_REPO="$FOAM_BASE_REPO/blob/${FOAM_REPO_TAG}"
}


unset configName dirNames

# Parse options
while [ "$#" -gt 0 ]
do
    case "$1" in
    -h | -help*)
        usage
        ;;
    -config)
        configName="$2"
        [ -f "$configName" ] || {
            # No such file. Try some common alternatives
            for ending in $configName ".$configName" "-$configName"
            do
                if [ -f "Doxyfile$ending" ]
                then
                    configName="Doxyfile$ending"
                    break
                fi
            done
        }
        [ -f "$configName" ] || {
            echo "Could not resolve Doxyfile config: $configName" 1>&2
            exit 1
        }
        shift
        ;;
    -dir)
        shift
        if [ -d "$1" ]
        then
            dirNames="$dirNames $1"
        else
            echo "Could not resolve input directory: $1" 1>&2
            exit 1
        fi
        ;;
    -online)
        defineURL
        ;;
    -*)
        usage "unknown option: '$1'"
        ;;

    *)  # dirName
        if [ -d "$1" ]
        then
            dirNames="$dirNames $1"
        else
            echo "Could not resolve input directory: $1" 1>&2
        fi
        ;;
    *)
        usage "unknown option/argument: '$1'"
        ;;
    esac
    shift
done


#------------------------------------------------------------------------------

rm -rf latex man

# Remove html directory in background
mv html html-stagedRemove$$ 2> /dev/null
rm -rf html-stagedRemove$$ >/dev/null 2>&1 &

# Ensure that created files are readable by everyone
umask 22

if [ -n "$dirNames" ]
then
    (
        cat ${configName:-Doxyfile}
        echo "INPUT = $dirNames"
    ) | doxygen -
else
    doxygen $configName
fi

# Fix permissions (NB: '+X' and not '+x'!)
chmod -R a+rX html latex man 2>/dev/null

echo
echo "Done doxygen"
echo

#------------------------------------------------------------------------------