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