a6912578e02ae41b3d4da2d1a9cf9142163890bb
[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: build/CoqPass.hs
6
7 build/CoqPass.hs: $(allfiles)
8         make build/Makefile.coq
9         cd build; make -f Makefile.coq OPT="-opt -dont-load-proofs" \
10           ExtractionMain.vo \
11           ProgrammingLanguageGeneralizedArrow.vo \
12           ProgrammingLanguageArrow.vo \
13           ProgrammingLanguageFlattening.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 compiler/categories; git checkout master
28
29 clean:
30         rm -rf build
31
32 merged:
33         mkdir -p .temp
34         cd src; for A in *.v; do cat $$A  | grep -v '^Require Import' > ../.temp/`echo $$A | sed s_\\\\.v_._`; done
35         cd src/categories/src; for A in *.v; do cat $$A  | grep -v '^Require Import' > ../../../.temp/`echo $$A | sed s_\\\\.v_._`; done
36         cp src/Banner.v .temp/GArrows.v
37         cd .temp; grep '^Require Import ' ../src/All.v | sed 's_Require Import _echo;echo;echo;echo;echo;cat _' | bash >> GArrows.v
38         cd .temp; time $(coqc) -dont-load-proofs -verbose GArrows.v
39         echo
40         echo COMPILATION OK
41         echo
42
43 pushcheck:
44         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'
45         rsync -are ssh --progress --verbose --exclude .git --exclude src/categories/build/ --exclude build/ ./ megacz.com:/tmp/pushcheck/ghc-hetmet/compiler/hetmet/
46         ssh megacz.com -- '/vol/megacz/pushcheck2.sh'
47
48
49 # this is for Adam's use only!
50 push: build/CoqPass.hs
51         git push http://git.megacz.com/coq-hetmet.git master
52         git add -f build/CoqPass.hs; \
53           git commit -m 'update baked-in CoqPass.hs' && \
54           (git push -f http://git.megacz.com/coq-hetmet.git master:coq-extraction-baked-in; \
55            git reset HEAD^)
56         rm -rf .temp
57         mkdir .temp
58         cd .temp; ln -s ../src/*.v .
59         cd .temp; for A in *.v; do \
60           echo Latexing $$A ... ;\
61           echo '\\documentclass[9pt,landscape]{article}' > $$A.tex; \
62           echo '\\usepackage[landscape]{geometry}'       >> $$A.tex; \
63           echo '\\usepackage[cm]{fullpage}'       >> $$A.tex; \
64           echo '\\usepackage{amsmath}'        >> $$A.tex; \
65           echo '\\usepackage{amssymb}'        >> $$A.tex; \
66           echo '\\usepackage{stmaryrd}'       >> $$A.tex; \
67           echo '\\usepackage{upgreek}'        >> $$A.tex; \
68           echo '\\usepackage{parskip}'        >> $$A.tex; \
69           echo '\\begin{document}'            >> $$A.tex; \
70           echo '{{\\tt{'           >> $$A.tex; \
71           echo ''           >> $$A.tex; \
72           java -jar ~/bin/unicode2tex.jar < ../src/$$A >> $$A.tex;\
73           echo '}}}'                           >> $$A.tex; \
74           echo '\\end{document}'              >> $$A.tex; \
75           pdflatex $$A.tex < /dev/null; done
76         ssh login.eecs.berkeley.edu -- 'rm public_html/coq-in-ghc/pdfs/*.pdf' ; true
77         scp .temp/*.pdf login.eecs.berkeley.edu:public_html/coq-in-ghc/pdfs/
78         rm -rf .temp