Makefile 5.54 KB
Newer Older
1
include Makefile.distrib
2

3 4
# For development

5 6
pull: tools/pull.$(EXTENSION)
	$(LINK) -o $@ $^
7

8
PREPRO = camlp4o -I `ocamlfind query ulex` pa_ulex.cma pr_o.cmo $(SYNTAX) -sep "\n"
9

10
profile: misc/q_symbol.cmo
11 12 13 14 15 16 17 18 19 20 21
	rm -Rf prepro
	mkdir prepro
	for i in $(DIRS); do \
	mkdir prepro/$$i; \
	for j in $$i/*.ml $$i/*.mli; do \
	if [ -f "$$j" ]; then \
	 echo $$j; \
	 $(PREPRO) $$j -o prepro/$$j; \
	fi; \
	done; \
	done
22 23 24 25 26
	cp Makefile.distrib Makefile Makefile.conf prepro/
	(cd prepro;  \
	touch depend; \
	$(MAKE) compute_depend PROFILE=true SYNTAX_PARSER= ; \
	$(MAKE) cduce PROFILE=true SYNTAX_PARSER= NATIVE=false)
27

28

29
# Site-specific installation
30

31 32
charme_build:
	rsh charme ". .env; cd IMPLEM/CDUCE; $(MAKE) webiface webpages"
33
	scp CHANGES INSTALL INSTALL.WIN32 web/www/*.html web/cduce.css cduce@iris:public_html/
34
	scp webiface cduce@iris:cgi-bin/cduce
35

36
install_web_distant:
37
	$(MAKE) webpages
38
	scp CHANGES  INSTALL INSTALL.WIN32 web/www/*.html web/demo.js web/cduce.css cduce@iris.ens.fr:public_html/
39

40
SCRIPT =
41
INCLUDES_DEB = $(INCLUDES) $(shell ocamlfind query -i-format -recursive $(PACKAGES))
42 43
DEBUGGER = ocamldebug
debug:
44
	ledit $(DEBUGGER) $(INCLUDES_DEB) ./cduce $(SCRIPT)
45

46
# Packaging
47

48
DISTRIB = $(DIRS) cduce.spec tools depend INSTALL INSTALL.WIN32 CHANGES \
49 50
 LICENSE README AUTHORS Makefile.conf.template configure configure.ml doc \
 META.in cduce_mktop
51 52 53

DISTRIB_DOC = doc.xml memento.xml tutorial.xml manual.xml tutorial manual \
 xhtml.cd xhtml-categ.cd xhtml-strict.cd site.cd
54

55
PACKAGE = cduce-$(VERSION)
56
.PHONY: package
57
package: clean
58 59 60 61
	rm -Rf $(PACKAGE)
	mkdir $(PACKAGE)
	cp -R $(DISTRIB) $(PACKAGE)/
	cp Makefile.distrib $(PACKAGE)/Makefile
62 63 64
	mkdir -p $(PACKAGE)/web/img
	(cd web; cp -R $(DISTRIB_DOC) ../$(PACKAGE)/web; \
	cd img; cp left.gif right.gif ../../$(PACKAGE)/web/img)
65 66
	(cd $(PACKAGE); \
	rm -f types/IDEAS; \
67
        for F in $(DEPEND); do headache -h ../header $$F; done)
68
	tar czf $(PACKAGE).tar.gz --exclude CVS --exclude ".#*" $(PACKAGE)
69 70
	rm -Rf $(PACKAGE)

71 72 73
#cvs_snapshot:
#	$(MAKE) package VERSION=cvs`date +%Y%m%d`

74
MSTONE=3
75
cvs_snapshot:
76 77 78
	(cd /tmp; \
	rm -Rf cduce; \
	cvs -z3 -d ":pserver:anonymous@cvs.cduce.org:/cvsroot" co cduce; \
79
	tar czf cduce-cvs$(MSTONE).tar.gz cduce; \
80
	rm -Rf cduce; \
81 82
	scp cduce-cvs$(MSTONE).tar.gz cduce@iris.ens.fr:public_html/download; \
	rm -f cduce-cvs$(MSTONE).tar.gz)
83

84
OCAML_STDLIBDIR := $(shell ocamlc -where)
85 86 87
.PHONY: .ocamlinit
.ocamlinit:
	echo '(* AUTOMATICALLY GENERATED by Makefile: DO NOT EDIT! *)' > $@
88 89 90 91 92 93 94 95 96 97 98 99
	echo '#load "$(OCAML_STDLIBDIR)/pcre/pcre.cma";;' >> $@
	echo '#load "$(OCAML_STDLIBDIR)/unix.cma";;' >> $@
	echo '#load "$(OCAML_STDLIBDIR)/netstring/netstring.cma";;' >> $@
# 	echo '#load "$(OCAML_STDLIBDIR)/netstring/netstring_top.cmo";;' >> $@
	echo '#load "$(OCAML_STDLIBDIR)/pxp-engine/pxp_engine.cma";;' >> $@
# 	echo '#load "$(OCAML_STDLIBDIR)/pxp-engine/pxp_top.cmo";;' *)' >> $@
	echo '#load "$(OCAML_STDLIBDIR)/pxp-lex-iso88591/pxp_lex_iso88591.cma";;' >> $@
	echo '#load "$(OCAML_STDLIBDIR)/pxp-lex-iso88591/pxp_lex_link_iso88591.cmo";;' >> $@
	echo '#load "$(OCAML_STDLIBDIR)/ulex/ulexing.cma";;' >> $@
	echo '#load "$(OCAML_STDLIBDIR)/nums.cma";;' >> $@
# 	echo '#load "$(OCAML_STDLIBDIR)/num_top.cma";;' >> $@
	echo '#load "$(OCAML_STDLIBDIR)/cgi/cgi.cma";;' >> $@
100 101 102 103 104 105
	for o in $(VALIDATE_OBJECTS); do echo "prerr_endline \"Loading $$o ...\";;" >> $@; echo "#load \"$$o\";;" >> $@; done
	for d in $(DIRS); do echo "#directory \"$$d\";;" >> $@; done
	for p in pcre netstring pxp-engine ulex cgi; do echo "#directory \"`$(OCAMLFIND) query $$p`\";;" >> $@; done
	echo "prerr_endline \"All done!\"" >> $@
	echo '(* vim: set ft=ocaml: *)' >> $@

106 107
CVS_DISTRIB = web CHANGES LICENSE README AUTHORS cduce dtd2cduce
CVS_DOC = doc/cdo2ml.1 doc/cduce.1 doc/cduce_mktop.1  doc/cduce_validate.1 doc/dtd2cduce.1 doc/fomanual/tutorial.pdf doc/fomanual/manual.pdf
108
cvs_snapshot_bin: clean
109 110 111 112
	if [[ `uname` != Linux ]]; then echo "Not a Linux box!"; exit 2; fi
	$(MAKE) cduce dtd2cduce NATIVE=true EXTRA_LINK_OPTS="-ccopt -static" VERSION=cvs`date +%Y%m%d`
	rm -Rf cduce-cvs
	mkdir cduce-cvs
113
	mkdir cduce-cvs/doc
114
	cp -R $(CVS_DISTRIB) cduce-cvs
115
	cp $(CVS_DOC) cduce-cvs/doc
116 117 118 119
	cp Makefile.binary cduce-cvs/Makefile
	tar czf cduce-cvs-linux-static.tar.gz --exclude CVS cduce-cvs
	rm -Rf cduce-cvs
	scp cduce-cvs-linux-static.tar.gz cduce@di.ens.fr:public_html/download
120 121 122 123 124

.PHONY: test
test:
	$(MAKE) -C tests test

125 126 127

# Web site

128 129
driver/examples.ml: cduce web/xhtml.cdo web/examples/build.cd web/examples/examples.xml
	(cd web/examples; ../../cduce build.cd -I .. --arg examples.xml)
130

131 132 133
web_fetch_tralala:
	wget -O web/tralala_documents_lille.inc http://www.grappa.univ-lille3.fr/bibtex/tralalamachine.php

134 135 136 137 138 139 140 141 142
webpages: cduce web/site.cdo
	(cd web; ../cduce --run site.cdo --arg site.xml)

website: webpages webiface evaluator

install_web: website
	cp  web/www/*.html web/demo.js web/cduce.css  $(HTML_DIR)/
	cp CHANGES  INSTALL INSTALL.WIN32 $(HTML_DIR)/
	cp webiface $(CGI_DIR)/cduce
143
	cp evaluator $(CGI_DIR)/demo_evaluator
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
	if test ! -d "$(HTML_DIR)/img" ; then \
	  mkdir $(HTML_DIR)/img; \
	fi;  
	cp web/img/*.*  $(HTML_DIR)/img

WEBIFACE  = $(OBJECTS) driver/examples.cmo driver/webiface.cmo
EVALUATOR = $(OBJECTS) driver/evaluator.cmo

webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
	@echo "Build $@"
	$(HIDE)$(LINK) -verbose $(INCLUDES) -o $@ $^ $(EXTRA_OPTS_WEBIFACE)

evaluator: $(EVALUATOR:.cmo=.$(EXTENSION))
	@echo "Build $@"
	$(HIDE)$(LINK) -verbose $(INCLUDES) -o $@ $^ $(EXTRA_OPTS_WEBIFACE)

# webiface can be made static to be able to move it more easily
# (to compile it on a machine which is not the web server)
# Seems to be some problems with statically linking curl
163
# EXTRA_OPTS_WEBIFACE += -ccopt -static
164

165