]> matita.cs.unibo.it Git - helm.git/blob - helm/www/lambdadelta/Makefile
5366cc649adbe3d12ac82860f9c2cfe0597ea28f
[helm.git] / helm / www / lambdadelta / Makefile
1 H=@
2
3 TAGS = www up \
4        lint-xml index lddl install-xml \
5        test-html html install-html \
6        install-jed install-bib install-2 install-1 install-coq \
7        install-automath install-v install-matita \
8
9 LDURL   = http://lambdadelta.info/
10
11 HOMEDIR = .
12 ETCDIR     = etc
13 DOWNDIR    = download
14 XSLTDIR    = xslt
15 XMLDIR     = xml
16 SRCDIR     = web/home
17 LDDLDIR    = web/lddl
18 XHTBLDIR   = bin/xhtbl
19 HTMLDIR    = static/lddl
20 JEDDIR     = $(HOME)/mps/jed
21 BIBDIR     = $(HOME)/texmf/bibtex/bib
22 CONTRIBDIR = $(ETCDIR)/lambdadelta
23 HELENADIR  = ../../software/helena
24
25 WEBDIRS  = $(SRCDIR) $(ETCDIR)
26
27 REMOTE   = helm.cs.unibo.it
28 RDIR     = /projects/helm/public_html/lambdadelta
29 RHOMEDIR = $(REMOTE):$(RDIR)
30 RXMLDIR  = $(RHOMEDIR)/xml
31 RDOWNDIR = $(RHOMEDIR)/download
32 RSTATICDIR = /projects/helm/public_html/lambda-delta/static
33
34 SLS     = helena.sl automath.sl
35 BIB     = lambdadelta.bib
36 CONTRIB = lambdadelta_2.tar.gz
37
38 XMLS = Environment/grundlagen_2/l/not.ld.xml \
39        Environment/grundlagen_2/l/et.ld.xml \
40        Environment/grundlagen_2/l/e/st/eq/landau/n/rt/rp/r/c/8283/t234.ld.xml \
41        Environment/grundlagen_2/l/e/pairis1.ld.xml \
42        Environment/grundlagen_2/l/e/st/eq/landau/n/327/t25.ld.xml \
43
44 LDWEB = ld_web.xsl ld_web_root.xsl ld_web_library.xsl ld_web_ebnf.xsl
45
46 AUTOMATH = examples/automath/grundlagen_2.aut
47 COQ      = coq/grundlagen_2.v
48
49 MATITA = matita/root matita/grundlagen_2.ma
50
51 XMLLINT = xmllint --noout
52 XSLT    = xalan
53 XHTBL   = $(XHTBLDIR)/xhtbl.native
54
55 ifeq ($(XSLT), xsltproc)
56    XSLT_PARAM := --param
57    XSLT_OUT   := -o
58    XSLT_XSL   :=
59    XSLT_IN    :=
60 endif
61
62 ifeq ($(XSLT), xalan)
63    XSLT_PARAM := -param
64    XSLT_OUT   := -out
65    XSLT_XSL   := -xsl
66    XSLT_IN    := -in
67    XSLT       += -indent 2
68 endif
69
70 XSLT += $(XSLT_PARAM) baseurl '"$(LDURL)"' $(XSLT_PARAM) date '"$(shell date -R)"'
71
72 define HTML_TEMPLATE
73    HTML_$(2)  = $$(HOMEDIR)/$(2).html
74    HTMLS     += $$(HTML_$(2))
75
76    $$(HTML_$(2)): $(1) $$(XSLS) $$(LDWEB:%=$$(XSLTDIR)/%)
77         @echo "  XSLT $$(notdir $$<)"
78         $$(H)$$(XSLT) $$(XSLT_OUT) $$@ $$(XSLT_XSL) $$(XSLTDIR)/ld_web.xsl $$(XSLT_IN) $$<
79 endef
80
81 ifeq ($(MAKECMDGOALS), www)
82    LDWS  = $(shell find -L $(WEBDIRS) -name "*.ldw.xml")
83    TBLS  = $(shell find -L $(WEBDIRS) -name "*.tbl")
84    XSLS  = $(addprefix $(XSLTDIR)/,xhtbl.xsl $(notdir $(TBLS:%.tbl=%.xsl)))
85
86    $(XSLS): $(TBLS) $(XHTBL)
87         @echo "  XHTBL *.tbl"
88         $(H)$(XHTBL) -b $(LDURL) -O $(XSLTDIR) $(TBLS)
89
90    $(foreach LDW,$(LDWS),$(eval $(call HTML_TEMPLATE,$(LDW),$(notdir $(LDW:%.ldw.xml=%)))))
91 endif
92
93 all: www
94
95 www: $(HTMLS) $(TBLS) $(XHTBL)
96
97 lint-xml: $(XMLS:%=$(XMLDIR)/%)
98         @echo XMLLINT --valid
99         $(H)$(XMLLINT) --valid $^ 
100
101 $(ETCDIR)/make-html.sh $(XMLDIR)/index.txt index:
102         @echo "  GENERATE INDEXES"
103         $(H)find $(XMLDIR) -name "*.ld.xml" | sed s/.xml//g | sed s/xml/ld:/g > $(XMLDIR)/index.txt
104         $(H)sed "s/^/make --no-print-directory /" $(XMLDIR)/index.txt | sed s.ld:/.. > $(ETCDIR)/make_html.sh
105
106 $(DOWNDIR)/lddl.tar.bz2 lddl: $(ETCDIR)/exclude.txt $(XMLDIR)/index.txt
107         @echo "  GENERATE lddl.tar.bz2"
108         $(H)tar -cjf $(DOWNDIR)/lddl.tar.bz2 -X $< $(XMLDIR) 
109
110 install-xml: $(DOWNDIR)/lddl.tar.bz2 
111         @echo "  INSTALL xml"
112         $(H)scp $^ $(RDOWNDIR)
113         $(H)ssh $(REMOTE) "cd $(RDIR) && tar -xjf download/lddl.tar.bz2"
114
115 test-html:
116         @$(MAKE) --no-print-directory $(XMLS:%.xml=%)
117
118 html: $(ETCDIR)/make_html.sh
119         @echo "  MAKE */*.ld"
120         $(H). $<
121
122 install-html $(DOWNDIR)/static_lddl.tar.bz2: $(ETCDIR)/exclude.txt $(ETCDIR)/make_html.sh
123         @echo "  INSTALL html"
124         $(H)tar -cjf $(DOWNDIR)/static_lddl.tar.bz2 -C static -X $< lddl 
125         $(H)scp $(DOWNDIR)/static_lddl.tar.bz2 $(RDOWNDIR)
126         $(H)ssh $(REMOTE) "cd $(RSTATICDIR) && tar -xjf ../../lambdadelta/download/static_lddl.tar.bz2
127
128 install-jed: $(SLS:%=$(JEDDIR)/%)
129         @echo "  INSTALL $(SLS)"
130         $(H)scp $^ $(DOWNDIR)
131
132 install-bib: $(BIB:%=$(BIBDIR)/%)
133         @echo "  INSTALL $(BIB)"
134         $(H)scp $< $(DOWNDIR)
135         $(H)scp $< $(DOWNDIR)/$(BIB:%.bib=%.txt)
136
137 install-2: $(CONTRIB:%=$(CONTRIBDIR)/%)
138         @echo "  INSTALL $(CONTRIB)"
139         $(H)scp $< $(DOWNDIR)
140
141 install-automath: $(HELENADIR)/$(AUTOMATH)
142         @echo "  INSTALL $(notdir $<)"
143         $(H)scp $< $(DOWNDIR)
144
145 install-matita: $(MATITA:%=$(HELENADIR)/%)
146         @echo "  INSTALL matita"
147         $(H)tar -C $(HELENADIR) -cjf $(DOWNDIR)/grundlagen_2.tar.bz2 $(MATITA)
148
149 install-1: etc/coq/ld_731/contrib/lambdadelta.tar.gz
150         @echo "  INSTALL $<"
151         $(H)scp $< $(DOWNDIR)/lambdadelta_1.tar.gz
152
153 install-coq:
154         @echo "  INSTALL coq"
155         $(H)ssh $(REMOTE) "cd $(RSTATICDIR)/coq && tar -xzf ../../../lambdadelta/download/lambdadelta_1.tar.gz && . ../../../lambdadelta/etc/to_text.sh v"
156
157 install-v: $(HELENADIR)/$(COQ)
158         @echo "  INSTALL $(notdir $<)"
159         $(H)scp $< $(DOWNDIR)
160
161 up:
162         @echo "  UPDATE $(RHOMEDIR)"
163         $(H)ssh $(REMOTE) "svn up $(RDIR)"
164
165 %.ld:
166         @echo "  XSLT $@"
167         $(H)mkdir -p $(LDDLDIR)/$(@D)
168         $(H)$(XSLT) $(XSLT_OUT) $(LDDLDIR)/$@.ldw.xml $(XSLT_XSL) $(XSLTDIR)/lddl.xsl $(XSLT_IN) $(XMLDIR)/$@.xml
169         $(H)mkdir -p $(HTMLDIR)/$(@D)
170         $(H)$(XSLT) $(XSLT_OUT) $(HTMLDIR)/$@.html $(XSLT_XSL) $(XSLTDIR)/ld_web.xsl $(XSLT_IN) $(LDDLDIR)/$@.ldw.xml
171
172 .PHONY: $(TAGS)