rename constructors of Arrange to start with A instead of R
[coq-hetmet.git] / Makefile
1 coqc     := coqc -noglob -opt
2 coqfiles := $(shell find src -name \*.v  | grep -v \\\#)
3 allfiles := $(coqfiles) $(shell find src -name \*.hs | grep -v \\\#)
4 coq_version := 8.3pl2-tracer
5
6 default: all
7
8 all: $(allfiles)
9         $(MAKE) build/Makefile.coq
10         cd build; $(MAKE) -f Makefile.coq OPT="-opt -dont-load-proofs" All.vo
11
12 build/CoqPass.hs: $(allfiles)
13         $(coqc) -v | grep 'version $(coq_version)' || (echo;echo "You need Coq version $(coq_version) to proceed";echo; false)
14         make build/Makefile.coq
15         cd build; $(MAKE) -f Makefile.coq OPT="-opt -dont-load-proofs" ExtractionMain.vo
16         cd build; $(MAKE) -f Makefile.coq Extraction.vo
17         cat src/Extraction-prefix.hs                                     > build/CoqPass.hs
18         cat build/Extraction.hs | grep -v '^module' | grep -v '^import' >> build/CoqPass.hs
19
20 build/Makefile.coq: $(coqfiles) src/categories/src
21         mkdir -p build
22         rm -f build/*.v
23         rm -f build/*.d
24         cd build; ln -fs `find ../src -name \*.v` .
25         cd build; coq_makefile *.v > Makefile.coq
26
27 src/categories/src:
28         git submodule update --init src/categories
29         cd src/categories; git checkout master
30
31 clean:
32         rm -rf build
33
34 examples/test.pdf:
35         ../../../inplace/bin/ghc-stage2 GArrowTikZ.hs
36         ./GArrowTikZ > test.tex
37         pdflatex test.tex
38         open test.pdf
39
40 examples/doc/index.html:
41         mkdir -p examples/doc
42         haddock --html Unify.hs
43         open Unify.html
44
45
46 merged:
47         mkdir -p .temp
48         cd src; for A in *.v; do cat $$A  | grep -v '^Require Import' > ../.temp/`echo $$A | sed s_\\\\.v_._`; done
49         cd src/categories/src; for A in *.v; do cat $$A | \
50            grep -v '^Require Import' > ../../../.temp/`echo $$A | sed s_\\\\.v_._`; done
51         cp src/Banner.v .temp/GArrows.v
52         cd .temp; grep '^Require Import ' ../src/All.v | sed 's_Require Import _echo;echo;echo;echo;echo;cat _' | bash >> GArrows.v
53         cd .temp; time $(coqc) -dont-load-proofs -verbose GArrows.v
54         echo
55         echo COMPILATION OK
56         echo
57
58 pushcheck:
59         ssh megacz.com -- 'rm -rf /tmp/pushcheck; mkdir /tmp/pushcheck; cd /tmp/pushcheck; git clone http://git.megacz.com/ghc-hetmet.git && git clone http://git.megacz.com/coq-hetmet.git ghc-hetmet/compiler/hetmet'
60         rsync -are ssh --progress --verbose --exclude .git --exclude src/categories/build/ --exclude build/ ./ megacz.com:/tmp/pushcheck/ghc-hetmet/compiler/hetmet/
61         ssh megacz.com -- '/vol/megacz/pushcheck2.sh'
62
63
64 # this is for Adam's use only!
65 push: build/CoqPass.hs
66         git push http://git.megacz.com/coq-hetmet.git master
67         git add -f build/CoqPass.hs; \
68           git commit -m 'update baked-in CoqPass.hs' && \
69           (git push -f http://git.megacz.com/coq-hetmet.git master:coq-extraction-baked-in; \
70            git reset HEAD^)
71         rm -rf .temp
72         mkdir .temp
73         cd .temp; ln -s ../src/*.v .
74         cd .temp; for A in *.v; do \
75           echo Latexing $$A ... ;\
76           echo '\\documentclass[9pt,landscape]{article}' > $$A.tex; \
77           echo '\\usepackage[landscape]{geometry}'       >> $$A.tex; \
78           echo '\\usepackage[cm]{fullpage}'       >> $$A.tex; \
79           echo '\\usepackage{amsmath}'        >> $$A.tex; \
80           echo '\\usepackage{amssymb}'        >> $$A.tex; \
81           echo '\\usepackage{stmaryrd}'       >> $$A.tex; \
82           echo '\\usepackage{upgreek}'        >> $$A.tex; \
83           echo '\\usepackage{parskip}'        >> $$A.tex; \
84           echo '\\begin{document}'            >> $$A.tex; \
85           echo '{{\\tt{'           >> $$A.tex; \
86           echo ''           >> $$A.tex; \
87           java -jar ~/bin/unicode2tex.jar < ../src/$$A >> $$A.tex;\
88           echo '}}}'                           >> $$A.tex; \
89           echo '\\end{document}'              >> $$A.tex; \
90           pdflatex $$A.tex < /dev/null; done
91         ssh login.eecs.berkeley.edu -- 'rm public_html/coq-in-ghc/pdfs/*.pdf' ; true
92         scp .temp/*.pdf login.eecs.berkeley.edu:public_html/coq-in-ghc/pdfs/
93         rm -rf .temp