aboutsummaryrefslogtreecommitdiff
path: root/default.do
blob: e72e62c4a1fa31bec861b7b5c3f4f1fffac35c81 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
exec >&2
. ./config.rc

fn=${1%.*}

date=$(date +%Y%m%d)
export date

case "$1" in
    *.txt|*.texi)
        [ -f "$fn.org" ] || {
            printf '%s\n' "Don't know how to build $1"
            exit 1
        }
        redo-ifchange "$fn.org" fdl.org
        trap 'rm -f $3.org' EXIT INT
        cp "$fn.org" "$3.org"
esac

case "$1" in
    all) redo-ifchange carbslinux.info install.txt carbslinux.txt ;;
    allclean)
        rm -f carbslinux.texi install.txt carbslinux.txt
        redo clean
        PHONY
        ;;
    htmldocs)
        redo-ifchange carbslinux.org carbslinux.texi install.txt install.html
        mkdir -p "${HTMLDIR:?}"
        rm -rf "$HTMLDIR/carbslinux" \
               "$HTMLDIR/carbslinux.html" \
               "$HTMLDIR/install.html.in" \
               "$HTMLDIR/install.txt"
        makeinfo --html -o "$HTMLDIR/carbslinux" "$TEXI"
        makeinfo --html --no-split -o "$HTMLDIR/carbslinux.html" "$TEXI"
        cp install.txt "$HTMLDIR/install.txt"
        cp install.html "$HTMLDIR/install.html.in"
        PHONY
        ;;
    *.txt)
        ${EMACS} "$3.org" -f org-ascii-export-to-ascii
        mv "$3.txt" "$3"
        ;;
    *.texi)
        ${EMACS} "$3.org" -f org-texinfo-export-to-texinfo
        mv "$3.texi" "$3"
        ;;
    *.info)
        redo-ifchange "$fn.texi"
        ${MAKEINFO} "$fn.texi" -o "$3"
        ;;
    "carbs-docs-$date.tar.xz")
        target=$1 dest=$3
        set -- README.md ./*.do ./*.org config.rc lib.rc carbslinux.info \
               install.txt carbslinux.txt
        redo-ifchange "$@"
        trap 'rm -rf carbs-docs-$date carbs-docs-$date.tar' EXIT INT
        mkdir -p "carbs-docs-$date"
        cp README.md ./*.do ./*.org config.rc lib.rc \
            carbslinux.info install.txt carbslinux.txt "carbs-docs-$date"
        tar cf "carbs-docs-$date.tar" "carbs-docs-$date"
        xz -cz "carbs-docs-$date.tar" > "$dest"
        ;;
    install)
        redo-ifchange carbslinux.info carbslinux.txt
        "$INSTALLSH" -Dm644 carbslinux.info "${DESTDIR}${INFODIR}/carbslinux.info"
        "$INSTALLSH" -Dm644 carbslinux.txt  "${DESTDIR}${DOCDIR}/carbslinux.txt"
        ;;
    dist)
        redo-ifchange "carbs-docs-$date.tar.xz"
        ;;
    *) printf '%s\n' "Unknown operation $1"; exit 1
esac