Blob


1 #!/bin/sh
2 #
3 # stuff we should do in the makefile
4 # but can't for portability reasons.
5 # public domain
7 pair()
8 {
9 files="$files $2"
10 dotfiles="$HOME/$1 $dotfiles"
11 xxxfiles="${2%.lp} $xxxfiles"
13 dname=$(dirname "$HOME/$1")
14 cat <<EOF >> Makefile.local
15 $HOME/$1: $2
16 [ ! -d "$dname" ] && mkdir -p "$dname" || true
17 ./lpp \$? > \$@
18 EOF
20 if [ -n "$3" ]; then
21 printf '\tchmod %s $@\n' "$3" >> Makefile.local
22 fi
23 echo >> Makefile.local
24 }
26 conv()
27 {
28 gemfiles="gem/$1.gmi $gemfiles"
29 wwwfiles="www/$1.html $wwwfiles"
30 cat <<EOF >> Makefile.local
31 gem/$1.gmi: $2
32 sed 's/EXT/gmi'/ $2 | ./unpar | ./gc > \$@
34 www/$1.html: gem/$1.gmi header.html footer.html
35 sed 's!TITLE!$1!' header.html > \$@
36 sed 's/EXT/html/' $2 | ./unpar | ./gc | ./gem2html >> \$@
37 cat footer.html >> \$@
39 EOF
40 }
42 rm -f Makefile.local
44 pair .profile profile.lp
45 pair .kshrc kshrc.lp
46 pair lib/profile rc.lp
47 pair .sqliterc sqliterc.lp
48 pair .psqlrc psqlrc.lp
49 pair bin/acmerc bin/acmerc.lp +x
50 pair bin/browser bin/browser.lp +x
52 conv index index.lp
53 for file in $files; do
54 conv "${file%.lp}" "$file"
55 done
57 cat <<EOF >> Makefile.local
58 DOTFILES = $dotfiles
59 GEMFILES = $gemfiles
60 WWWFILES = $wwwfiles
61 XXXFILES = $(printf "%s\n" $xxxfiles | sort | xargs echo)
62 EOF