summaryrefslogtreecommitdiff
path: root/tools/myacprep
blob: 9198dee678c9dac9511df7c6f03923d0689b6905 (plain)
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
#!/bin/sh

OUT=$HOME/Products
SWITCHES=""

saw_opt=false
while [ -n "$1" ]; do
  case "$1" in
    --local)
      OUT=""
      SWITCHES="$SWITCHES --local"
      shift 1 ;;
    --output)
      OUT=""
      shift 1
      SWITCHES="$SWITCHES --output $1"
      shift 1 ;;
    --gprof)
      OUT="$OUT/ledger-gprof"
      SWITCHES="$SWITCHES $1 --release"
      saw_opt=true
      shift 1 ;;
    --gcov)
      OUT="$OUT/ledger-gcov"
      SWITCHES="$SWITCHES $1 --debug --devel"
      saw_opt=true
      shift 1 ;;
    --opt)
      OUT="$OUT/ledger-opt"
      SWITCHES="$SWITCHES $1 --release"
      saw_opt=true
      shift 1 ;;
  esac
done

if [ $saw_opt = false ]; then
    SWITCHES="$SWITCHES --pch"	 # build using pre-compiled headers
    SWITCHES="$SWITCHES --warn"	 # show full compiler warnings
    SWITCHES="$SWITCHES --debug" # enable debug code generation
    SWITCHES="$SWITCHES --devel" # use GLIBCXX_DEBUG if possible
    if [ -n "$OUT" ]; then
	OUT="$OUT/ledger"
    fi
fi

if [ -n "$OUT" ]; then
    [ -d "$OUT" ] || mkdir -p "$OUT"
    SWITCHES="$SWITCHES --output $OUT"
fi

./acprep $SWITCHES

if [ -n "$OUT" ]; then
    ln -sf $OUT/TAGS .
    ln -sf $OUT/ledger .
fi