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