summaryrefslogtreecommitdiffstats
path: root/bin/p
blob: a52ba1e23ff1ff99585459a1f2e9a180da9d3d5c (plain) (blame)
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
#!/bin/bash

_clean () {
    git clean -dfx
    ctags *.c *.h
}

_configure () {
    # XXX breaks when building Compress::Raw::Zlib, nobody else can reproduce?
    # ./Configure -des -Dusedevel -DDEBUGGING -Dusethreads -Uversiononly -Accflags="-Wall -Wextra" -Doptimize="-g -O0 -ggdb3"
    # can't do this with -Werror, not everything (external modules, say) is
    # -Werror clean
    # ./Configure -des -Dusedevel -Accflags="-Wall -Wextra"
    ./Configure -des -Dusedevel -DDEBUGGING
}

_make () {
    if [[ ! -e Makefile ]]; then
        _configure
    fi
    # -Werror at configure time seems to confuse Configure, so do it here
    make -j9 OPTIMIZE="-g -Werror"
}

_test () {
    if [[ ! -e perl ]]; then
        _make
    fi
    export TEST_JOBS=9
    if [ -n "$*" ]; then
        make test_harness TEST_FILES="$*"
    else
        make test_harness
    fi
}

_test_porting () {
    if [[ ! -e perl ]]; then
        _make
    fi
    export TEST_JOBS=9
    if [ -n "$*" ]; then
        make test_porting TEST_FILES="$*"
    else
        make test_porting
    fi
}

cmd=$1
shift

case $cmd in
    cl|clean)
        _clean $@
        ;;
    c|conf|configure)
        _configure $@
        ;;
    m|make)
        _make $@
        ;;
    t|test)
        _test $@
        ;;
    tp|test_porting)
        _test_porting $@
        ;;
    a|all)
        _clean
        _test
        ;;
    *)
        echo "Usage: p <command> [args...]" 1>&2
        exit 1
        ;;
esac