|
Warning: this is an htmlized version!
The original is here, and the conversion rules are here. |
# This is the file `Makefile' of dednat4.
# Author: Eduardo Ochs <eduardoochs@gmail.com>
# Version: 2012mar14
# Public Domain.
# See:
# http://angg.twu.net/dednat4.html
# http://angg.twu.net/dednat4/Makefile
# http://angg.twu.net/dednat4/Makefile.html
#
# Tested on Debian GNU/Linux and on MacOSX.
# For W$ instructions, see: (find-dn4 "README.windows")
#
# To make the single-file scripts:
# (to "dednat41")
# (find-sh "cd ~/dednat4/; make S=$S scripts")
#
# (find-dn4 "Makefile")
# (find-dn4ex "eedemo1.tex")
# (find-es "dednat" "dednat4-test")
# (find-angg "vtutil/")
# (find-angg "vtutil/vtutil.lua" "e_scripts")
# (find-blogme3file "Makefile")
# «.help» (to "help")
# «.lua» (to "lua")
# «.lpeg» (to "lpeg")
# «.bitlib» (to "bitlib")
# «.dednat41» (to "dednat41")
# «.dednat4» (to "dednat4")
# «.texdownloads» (to "texdownloads")
# «.demos» (to "demos")
# «.demo1» (to "demo1")
# «.demo2» (to "demo2")
# «.tarball» (to "tarball")
# «.tmpdir» (to "tmpdir")
# -------------------
# External programs.
# Note that we always call wget with "$(wget) $(URL)"...
wget = wget
# unzipat is called as:
# "$(unzipat) outputdir/ pathto/diagxy.zip diaxgy.tex".
unzipat = unzip -o -d
# -------------------
# «help» (to ".help")
# (find-dn4sh "make")
default: help
help:
@echo "Usage:"
@echo " make demo1 - builds everything and LaTeXes a demo file"
@echo " make dednat4 - builds ./lua51 and the standalone-ish script"
@echo " make ./lua51 - downloads the lua source and builds it"
@echo "Notes:"
@echo " On some platforms lua51 needs libreadline-dev to build."
@echo " The makefile calls \"unzip\" to extract a file from diagxy.zip."
@echo " On MacOSX, add a \"LUAOS=macosx\" parameter:"
@echo " make LUAOS=macosx demo1"
@echo " I add the parameter \"S=$$HOME/snarf\" to make the downloads"
@echo " be put in my standard \"snarf directory\", but you probably"
@echo " don't have something like that - it's an eev-ism."
@echo " By default all downloads (the source for lua-5.1.4, and four"
@echo " TeX packages) are put in ./snarf/ftp/ and ./snarf/http/."
@echo " The demos need latex, xypic, and stmaryrd.sty."
# -------------------
# «lua» (to ".lua")
# Downloading and building Lua 5.1.
# (find-sh "cd ~/dednat4/; make luadownload")
# (find-sh "cd ~/dednat4/; make cleanbuild")
# (eev "cd ~/dednat4/; make luabuild")
# (eev "cd ~/dednat4/; make S=$S luabuild")
S = snarf
USRC = usrc
LUAURL = http://www.lua.org/ftp/lua-5.1.4.tar.gz
LUATGZ = $(S)/http/www.lua.org/ftp/lua-5.1.4.tar.gz
LUATGZDIR = $(S)/http/www.lua.org/ftp/
LUASRC = $(PWD)/usrc/lua-5.1.4
LUA51_ = $(LUASRC)/bin/lua
LUA51 = ./lua51
LUAOS = linux
luadownload: $(LUATGZ)
$(LUATGZ):
mkdir -p $(LUATGZDIR)
cd $(LUATGZDIR) && \
$(wget) $(LUAURL)
cleanbuild:
rm -Rfv $(LUASRC)/
luabuild: $(LUA51_)
$(LUA51_): $(LUATGZ)
rm -Rfv $(LUASRC)/
mkdir -p $(USRC)/
tar -C $(USRC)/ -xvzf $(LUATGZ)
cd $(LUASRC) && make $(LUAOS) local test
# -------------------
# Copying the lua51 binary to the main directory of dednat4.
# (find-node "(make)Conditional Example")
# (find-sh "cd ~/dednat4/; make cleanbinaries")
# (find-sh "cd ~/dednat4/; make LUA=link ./lua51")
# (find-sh "cd ~/dednat4/; make ./lua51")
cleanbinaries:
rm -fv $(LUA51)
ifeq ($(ANGG),1)
# A hacks that speed things up at angg, persephone and dekooning:
compilebinaries:
cp -v ~/bin/lua51 $(LUA51) ;# angg hack: reuse a precompiled lua51
else
# Normal behavior:
compilebinaries: $(LUA51_)
cp -v $(LUA51_) $(LUA51)
endif
$(LUA51): compilebinaries
# -------------------
# «lpeg» (to ".lpeg")
# (find-es "dednat" "lpeg")
# (find-es "lua5" "lpeg-0.9")
# Dednat4 does not use lpeg, but blogme3 does.
LPEGURL = http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-0.9.tar.gz
LPEGTGZ = $(S)/http/www.inf.puc-rio.br/~roberto/lpeg/lpeg-0.9.tar.gz
LPEGTGZDIR = $(S)/http/www.inf.puc-rio.br/~roberto/lpeg/
LPEGSRC = $(USRC)/lpeg-0.9
LPEGSO_ = $(LPEGSRC)/lpeg.so
LPEGSO = lpeg.so
lpegdownload: $(LPEGTGZ)
$(LPEGTGZ):
mkdir -p $(LPEGTGZDIR)
cd $(LPEGTGZDIR) && \
$(wget) $(LPEGURL)
cleanlpeg:
rm -Rfv $(LPEGSRC)/
$(LPEGSO_): $(LPEGTGZ) $(LUA51_)
rm -Rfv $(LPEGSRC)/
mkdir -p $(USRC)/
tar -C $(USRC)/ -xvzf $(LPEGTGZ)
cd $(LPEGSRC) && make LUADIR=$(LUASRC)/src
cd $(LPEGSRC) && $(LUA51_) test.lua
$(LPEGSO): $(LPEGSO_) $(LUA51)
cp -v $(LPEGSO_) $(LPEGSO)
lpegbuild: $(LPEGSO)
# -------------------
# «bitlib» (to ".bitlib")
# (find-es "dednat" "bitlib")
# (find-es "lua5" "bitlib-51")
# Dednat4 does not use bitlib, but vtutil does.
# To do: use luabitop instead. See: (find-es "lua5" "luabitop")
BITLIBURL = http://luaforge.net/frs/download.php/3065/bitlib-25.tar.gz
BITLIBTGZ = $(S)/http/luaforge.net/frs/download.php/3065/bitlib-25.tar.gz
BITLIBTGZDIR = $(S)/http/luaforge.net/frs/download.php/3065/
BITLIBSRC = $(USRC)/bitlib-25
BITLIBSO_ = $(BITLIBSRC)/lbitlib.so
BITLIBSO = lbitlib.so
LIBLUASO_ = $(LUASRC)/src/liblua.so
$(LIBLUASO_): $(LUA51_)
cd $(LUASRC)/src && ld -o liblua.so -shared $$(ar t liblua.a)
bitlibdownload: $(BITLIBTGZ)
$(BITLIBTGZ):
mkdir -p $(BITLIBTGZDIR)
cd $(BITLIBTGZDIR) && \
$(wget) $(BITLIBURL)
cleanbitlib:
rm -Rfv $(BITLIBSRC)/
$(BITLIBSO_): $(BITLIBTGZ) $(LUA51_) $(LIBLUASO_)
rm -Rfv $(BITLIBSRC)/
mkdir -p $(USRC)/
tar -C $(USRC)/ -xvzf $(BITLIBTGZ)
export LD_LIBRARY_PATH=$(LUASRC)/src; cd $(BITLIBSRC) && \
./configure --with-lua-prefix=$(LUASRC) && \
gcc -g -Wall -shared -I$(LUASRC)/src -o lbitlib.so lbitlib.c
$(BITLIBSO): $(BITLIBSO_) $(LUA51)
cp -v $(BITLIBSO_) $(BITLIBSO)
bitlibbuild: $(BITLIBSO)
# -------------------
# «dednat41» (to ".dednat41")
# «dednat4» (to ".dednat4")
# "dednat4" and "dednat41" are both copies of "dednat4.lua", but with
# a different "#!" line at the beginning (pointing to $PWD/lua51), and
# chmodded to 755.
#
# (find-dn4 "dednat4.lua")
# (find-dn4 "dednat4")
# (find-dn4 "dednames.lua")
# (find-sh0 "cd ~/dednat4/; make cleanscripts")
# (find-sh0 "cd ~/dednat4/; make scripts")
# (find-sh0 "cd ~/dednat4/; make S=$S scripts")
# (find-sh0 "cd ~/dednat4/; make cleanscripts; make S=$S scripts")
# (find-node "(make)Automatic Variables" "$@")
# (find-node "(make)Errors" "`.DELETE_ON_ERROR'")
#
# (find-es "lenny" "setting-up-dednat4")
# (find-angg ".emacs" "dn4-block")
cleanscripts:
rm -fv dednat4 dednat41 dednames
scripts: dednat4 dednat41 dednames
dednat4 dednat41: $(LUA51) dednat4.lua
cat dednat4.lua | { echo "#!$(PWD)/lua51"; awk 'NR>1'; } > $@
chmod 755 $@
dednames: $(LUA51) dednames.lua
cat dednames.lua | { echo "#!$(PWD)/lua51"; awk 'NR>1'; } > $@
chmod 755 $@
# -------------------
# «texdownloads» (to ".texdownloads")
# Extra TeX/LaTeX packages.
# Note: there are links to all these packages for proof trees at
# the "LaTeX for logicians" page, which is at:
# http://www.phil.cam.ac.uk/teaching_staff/Smith/LaTeX/
# http://www.phil.cam.ac.uk/teaching_staff/Smith/LaTeX/nd.html
# Weird: Mike Barr's "diagxy" is not listed there -
#
# A CTAN-ish link to diagxy:
# http://www.ctan.org/tex-archive/macros/generic/diagrams/barr/
# http://www.ctan.org/tex-archive/macros/generic/diagrams/barr/diagxy.tex
# http://www.ctan.org/tex-archive/macros/generic/diagrams/barr/diaxydoc.pdf
#
# (find-es "tex" "ptproof")
# (find-es "xypic" "eepitch-dednat4")
# (find-dn4 "dednat4.lua" "tex_tree_function")
#
BUSSPROOFSURL = http://www.math.ucla.edu/~asl/bussproofs.sty
BUSSPROOFSFILE = $(S)/http/www.math.ucla.edu/~asl/bussproofs.sty
BUSSPROOFSDIR = $(S)/http/www.math.ucla.edu/~asl/
#PTPROOFSURL = http://www.monad.me.uk/proofs/prooftree.sty
#PTPROOFSFILE = $(S)/http/www.monad.me.uk/proofs/prooftree.sty
#PTPROOFSDIR = $(S)/http/www.monad.me.uk/proofs/
PTPROOFSURL = http://www.paultaylor.eu/proofs/prooftree.sty
PTPROOFSFILE = $(S)/http/www.paultaylor.eu/proofs/prooftree.sty
PTPROOFSDIR = $(S)/http/www.paultaylor.eu/proofs/
TATPROOFSURL = http://www.ctan.org/tex-archive/macros/latex/contrib/lkproof/proof.sty
TATPROOFSFILE = $(S)/http/www.ctan.org/tex-archive/macros/latex/contrib/lkproof/proof.sty
TATPROOFSDIR = $(S)/http/www.ctan.org/tex-archive/macros/latex/contrib/lkproof/
# DIAGXYZIPURL = ftp://ftp.math.mcgill.ca/pub/barr/diagxy.zip
# DIAGXYZIPFILE = $(S)/ftp/ftp.math.mcgill.ca/pub/barr/diagxy.zip
# DIAGXYZIPDIR = $(S)/ftp/ftp.math.mcgill.ca/pub/barr/
DIAGXYZIPURL = ftp://ftp.math.mcgill.ca/barr/diagxy.zip
DIAGXYZIPFILE = $(S)/ftp/ftp.math.mcgill.ca/barr/diagxy.zip
DIAGXYZIPDIR = $(S)/ftp/ftp.math.mcgill.ca/barr/
DIAGXYTEXURL = http://www.ctan.org/tex-archive/macros/generic/diagrams/barr/diagxy.tex
DIAGXYTEXFILE = $(S)/http/www.ctan.org/tex-archive/macros/generic/diagrams/barr/diagxy.tex
DIAGXYTEXDIR = $(S)/http/www.ctan.org/tex-archive/macros/generic/diagrams/barr/
TEXDOWNLOADS = $(BUSSPROOFSFILE) $(PTPROOFSFILE) $(TATPROOFSFILE) $(DIAGXYZIPFILE)
TEXDIR = $(PWD)/examples
# (find-dn4sh "make S=$S texdownloads")
# (eev "cd ~/dednat4 && make S=/tmp/snarf texdownloads")
# (eev "cd ~/dednat4 && make S=/tmp/snarf TEXDIR=/tmp texfiles")
# (eev "cd ~/dednat4 && make S=/tmp/snarf TEXDIR=/tmp cleantexfiles")
$(BUSSPROOFSFILE):
mkdir -p $(BUSSPROOFSDIR)
cd $(BUSSPROOFSDIR) && \
$(wget) $(BUSSPROOFSURL)
$(PTPROOFSFILE):
mkdir -p $(PTPROOFSDIR)
cd $(PTPROOFSDIR) && \
$(wget) $(PTPROOFSURL)
$(TATPROOFSFILE):
mkdir -p $(TATPROOFSDIR)
cd $(TATPROOFSDIR) && \
$(wget) $(TATPROOFSURL)
$(DIAGXYZIPFILE):
mkdir -p $(DIAGXYZIPDIR)
cd $(DIAGXYZIPDIR) && \
$(wget) $(DIAGXYZIPURL)
$(DIAGXYTEXFILE):
mkdir -p $(DIAGXYTEXDIR)
cd $(DIAGXYTEXDIR) && \
$(wget) $(DIAGXYTEXURL)
texdownloads: $(TEXDOWNLOADS)
texfiles: $(TEXDOWNLOADS)
cp -v $(BUSSPROOFSFILE) $(TEXDIR)
cp -v $(TATPROOFSFILE) $(TEXDIR)
cp -v $(PTPROOFSFILE) $(TEXDIR)
$(unzipat) $(TEXDIR) $(DIAGXYZIPFILE) diagxy.tex
# Instead of the unzip line above we could use this:
# cp -v $(DIAGXYTEXFILE) $(TEXDIR)
# but I think that $(DIAGXYZIPURL) points to the upstream
# version, and I am going to report a (small) bug in diagxy
# to its author soon...
cleantexfiles:
rm -fv $(TEXDIR)/bussproofs.sty
rm -fv $(TEXDIR)/prooftree.sty
rm -fv $(TEXDIR)/proof.sty
rm -fv $(TEXDIR)/diagxy.tex
# To do: create stronger "clean" targets
# (find-node "(make)Complex Makefile" "distclean")
clean: cleanscripts cleantexfiles
# -------------------
# «demos» (to ".demos")
# Demos
# (find-dn4ex "edrxmain41a.tex")
# (find-dn4ex "edrx08.sty")
# (find-es "dednat" "dednat4-demo1")
# (find-dn4 "demos/")
DN4EXDIR = $(PWD)/examples
DEMODIR = $(PWD)/demos
# Running ".files.sh" with no arguments shows a help message, and
# running it with "-n" runs it in "just print" mode, as in:
# (find-node "(make)Echoing")
# (find-dn4 ".files.sh")
# (find-dn4sh "./.files.sh -n cpdemos")
# (find-dn4sh "./.files.sh -n rmdemos")
# (find-dn4sh "./.files.sh -n cptexinputs")
# (find-dn4sh "./.files.sh -n rmtexinputs")
demos-prepare: dednat4 texfiles
mkdir -p $(DEMODIR)
cd $(DEMODIR) && $(PWD)/.files.sh cpdemos
# «demo1» (to ".demo1")
demo1: demos-prepare
cd $(DEMODIR) && cp -v edrxmain41a.tex tmp.tex
cd $(DEMODIR) && cp -v eedemo1.tex ee.tex
cd $(DEMODIR) && $(PWD)/dednat4 tmp.tex
cd $(DEMODIR) && latex tmp.tex
cd $(DEMODIR) && cp -v tmp.dvi demo1.dvi
cd $(DEMODIR) && cp -v tmp.dnt demo1.dnt
ls -l $(DEMODIR)/tmp.dvi $(DEMODIR)/demo1.dvi
# «demo2» (to ".demo2")
demo2: demos-prepare
cd $(DEMODIR) && cp -v edrxmain41a.tex tmp.tex
cd $(DEMODIR) && cp -v eedemo2.tex ee.tex
cd $(DEMODIR) && $(PWD)/dednat4 tmp.tex
cd $(DEMODIR) && latex tmp.tex
cd $(DEMODIR) && cp -v tmp.dvi demo2.dvi
cd $(DEMODIR) && cp -v tmp.dnt demo2.dnt
ls -l $(DEMODIR)/tmp.dvi $(DEMODIR)/demo2.dvi
# I use this to upload the outputs to <http://angg.twu.net/dednat4/examples/>:
# (find-dn4sh "make tmpdir && cd /tmp/dn4/ && make ANGG=1 S=$S demos.pdf")
# (find-tmpdn4sh0 "cd demos/ && cp -v demo{1,2}.dnt ~/dednat4/examples/")
# (eev "cd /tmp/dn4/demos/ && Scp demo{1,2}.{dnt,dvi,pdf} edrx@angg.twu.net:slow_html/dednat4/examples/")
# (find-twusfile "dednat4/examples/")
demos.pdf: demo1 demo2
cd $(DEMODIR) && dvipdf demo1 && dvipdf demo2 && ls -l demo*
# -------------------
# «tarball» (to ".tarball")
# (find-dn4 ".files.sh")
# (find-eevfile "Makefile" "(TZ=GMT date; date) > VERSION")
# (find-dn4sh "make tarball")
tarball:
(TZ=GMT date; date) | tee VERSION
tar -cvzf dednat4.tgz $$(./.files.sh tarballfiles)
# -------------------
# «tmpdir» (to ".tmpdir")
# I use this for tests, but it may not work on other machines...
# Note that it rebuilds the tarball.
TMPDIR = /tmp/dn4
tmpdir: tarball
rm -Rfv $(TMPDIR)
mkdir $(TMPDIR) && tar -C $(TMPDIR) -xvzf dednat4.tgz
@echo "# unpacked at: $(TMPDIR)/"
# Quick tests:
# (find-dn4sh "make tmpdir && cd /tmp/dn4/ && make ANGG=1 S=$S demo1")
# (find-dn4sh "make tmpdir && cd /tmp/dn4/ && make ANGG=1 S=$S demo1 demo2")
# (find-dvipage "/tmp/dn4/demos/demo1.dvi")
# (find-dvipage "/tmp/dn4/demos/demo2.dvi")
# Full test (slower, because it including the downloads and building Lua):
# (eev "cd ~/dednat4/ && make tmpdir && cd /tmp/dn4/ && make demo1 demo2")
# Making the tarball and uploading it:
# (find-dn4sh "make")
# (find-dn4sh "make tarball")
# (ee-cp (ee-dn4file "dednat4.tgz") (ee-twusfile "dednat4/dednat4.tgz") 'over)
# (ee-cp (ee-dn4file "dednat4.tgz") (ee-twupfile "dednat4/dednat4.tgz") 'over)
# Local Variables:
# coding: raw-text
# ee-anchor-format: "\n%s:"
# ee-anchor-format: "«%s»"
# End: