Makefile 4.11 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
SCRIPT =
30
INCLUDES_DEB = $(INCLUDES) $(shell ocamlfind query -i-format -recursive $(PACKAGES))
31 32
DEBUGGER = ocamldebug
debug:
33
	ledit $(DEBUGGER) $(INCLUDES_DEB) ./cduce $(SCRIPT)
34

35
# Packaging
36

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

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

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

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

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

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

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

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

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

98
driver/examples.ml: cduce web/xhtml.cdo web/examples/build.cd web/examples/examples.xml
Pietro Abate's avatar
Pietro Abate committed
99
	(cd web/examples; ../../cduce build.cd -I .. --arg examples.xml)
100 101 102 103 104

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

webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
Pietro Abate's avatar
Pietro Abate committed
105 106
	@echo "Build $@"
	$(HIDE)$(LINK) -verbose $(INCLUDES) -o $@ $^ $(EXTRA_OPTS_WEBIFACE)
107 108

evaluator: $(EVALUATOR:.cmo=.$(EXTENSION))
Pietro Abate's avatar
Pietro Abate committed
109 110
	@echo "Build $@"
	$(HIDE)$(LINK) -verbose $(INCLUDES) -o $@ $^ $(EXTRA_OPTS_WEBIFACE)
111 112 113 114

# 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
115
# EXTRA_OPTS_WEBIFACE += -ccopt -static
116