Makefile 4.38 KB
Newer Older
1
include Makefile.distrib
2
CGIDIR = /usr/lib/cgi-bin/cduce
3

4 5
# For development

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

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

11
profile: misc/q_symbol.cmo.stamp
12 13 14 15 16 17 18 19 20 21 22
	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
23 24 25 26 27
	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)
28

29

30
SCRIPT =
31
INCLUDES_DEB = $(INCLUDES) $(shell ocamlfind query -i-format -recursive $(PACKAGES))
32 33
DEBUGGER = ocamldebug
debug:
34
	ledit $(DEBUGGER) $(INCLUDES_DEB) ./cduce $(SCRIPT)
35

36
# Packaging
37

38
DISTRIB = $(DIRS) web cduce.spec depend INSTALL INSTALL.WIN32 CHANGES \
39
 LICENSE README AUTHORS Makefile.conf.template configure configure.ml doc \
40
 META.in cduce_mktop VERSION PLIST.godi Makefile.macosx tools/make-package-macosx
41 42

DISTRIB_DOC = doc.xml memento.xml tutorial.xml manual.xml tutorial manual \
43
 xhtml.cd xhtml-categ.cd xhtml-strict.cd site.cd siteTypes.cd
44

45
PACKAGE = cduce-$(VERSION)
46
.PHONY: package
47
package: clean
48 49
	rm -Rf $(PACKAGE).tar.gz
	git archive --prefix=$(PACKAGE)/ -o $(PACKAGE).tar.gz HEAD
50

51
OCAML_STDLIBDIR := $(shell ocamlc -where)
52 53 54
.PHONY: .ocamlinit
.ocamlinit:
	echo '(* AUTOMATICALLY GENERATED by Makefile: DO NOT EDIT! *)' > $@
55 56 57 58 59 60 61 62 63 64 65 66
	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";;' >> $@
67 68 69 70 71 72
	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: *)' >> $@

73 74
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
75
cvs_snapshot_bin: clean
76 77 78 79
	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
80
	mkdir cduce-cvs/doc
81
	cp -R $(CVS_DISTRIB) cduce-cvs
82
	cp $(CVS_DOC) cduce-cvs/doc
83 84 85 86
	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
87 88

.PHONY: test
89
test: all
90 91 92 93
	@tests/test.sh

extendedtest: all
	@tests/test.sh -e
94

Pietro Abate's avatar
Pietro Abate committed
95
############ CGI DEMO ###################
96

Pietro Abate's avatar
Pietro Abate committed
97
cgi: webiface evaluator
98

99 100 101 102 103
install_cgi: cgi
	@echo "Install cgi scripts"
	$(HIDE)$(INSTALL) -m755 webiface $(CGIDIR)/cduce
	$(HIDE)$(INSTALL) -m755 evaluator $(CGIDIR)/demo_evaluator

104
driver/examples.ml: cduce web/xhtml.cdo web/examples/build.cd web/examples/examples.xml
105
	(cd web/examples; ../../cduce build.cd -I .. --arg examples.xml)
106 107 108 109

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

Giuseppe Castagna's avatar
Giuseppe Castagna committed
110
webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
111 112
	@echo "Build $@"
	$(HIDE)$(LINK) -verbose $(INCLUDES) -o $@ $^ $(EXTRA_OPTS_WEBIFACE)
113 114

evaluator: $(EVALUATOR:.cmo=.$(EXTENSION))
115 116
	@echo "Build $@"
	$(HIDE)$(LINK) -verbose $(INCLUDES) -o $@ $^ $(EXTRA_OPTS_WEBIFACE)
117 118 119 120

# 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
121
# EXTRA_OPTS_WEBIFACE += -ccopt -static
122

123 124 125
typestop:
	ocamlbuild typesOUnit.cma
	ocaml -init tests/toplevel/typesOUnit.ocamlinit