#! /bin/sh DESTDIR=${1:-/srv/http/woozle.org} cd $(dirname $0) html () { target=$DESTDIR/${1%mdwn}html if older $target $1 template.m4; then echo "HTML $1" mkdir -p $(dirname $target) ./mdwntohtml template.m4 < $1 > $target fi } copy () { target=$DESTDIR/$1 if older $target $1; then echo "COPY $1" mkdir -p $(dirname $target) cp $1 $target fi } compile () { target=$DESTDIR/${1%.c} if older $target $1; then echo "COMP $1" gcc -o $target $1 fi } install () { fd=$(dirname $fn) echo "SUBINSTALL $fd" (cd $fd && ./install $DESTDIR/$fd) } git ls-files | while read fn; do case "$fn" in .*|*/.*|*~|install) ;; */install) install $fn ;; *.mdwn) html $fn ;; *.cgi.c) compile $fn ;; *) copy $fn ;; esac done if older $DESTDIR/people.html people.sh template.m4 /etc/passwd; then echo "PEOPLE" sh people.sh | ./mdwntohtml template.m4 > $DESTDIR/people.html fi