Makefile 4.38 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 49 50
	rm -Rf $(PACKAGE)
	mkdir $(PACKAGE)
	cp -R $(DISTRIB) $(PACKAGE)/
	cp Makefile.distrib $(PACKAGE)/Makefile
(no author)'s avatar
(no author) committed
51 52
	mkdir $(PACKAGE)/tools
	cp tools/dtd2cduce.ml  $(PACKAGE)/tools/
53 54
	(cd $(PACKAGE); \
	rm -f types/IDEAS; \
55
        for F in $(DEPEND); do headache -h ../header $$F; done)
Pietro Abate's avatar
Pietro Abate committed
56
	tar czf $(PACKAGE).tar.gz --exclude .svn --exclude ".#*" $(PACKAGE)
57 58
	rm -Rf $(PACKAGE)

59
OCAML_STDLIBDIR := $(shell ocamlc -where)
60 61 62
.PHONY: .ocamlinit
.ocamlinit:
	echo '(* AUTOMATICALLY GENERATED by Makefile: DO NOT EDIT! *)' > $@
63 64 65 66 67 68 69 70 71 72 73 74
	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";;' >> $@
75 76 77 78 79 80
	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: *)' >> $@

81 82
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
83
cvs_snapshot_bin: clean
84 85 86 87
	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
88
	mkdir cduce-cvs/doc
89
	cp -R $(CVS_DISTRIB) cduce-cvs
90
	cp $(CVS_DOC) cduce-cvs/doc
91 92 93 94
	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
95 96

.PHONY: test
97
test: all
98 99 100 101
	@tests/test.sh

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

Pietro Abate's avatar
Pietro Abate committed
103
############ CGI DEMO ###################
104

Pietro Abate's avatar
Pietro Abate committed
105
cgi: webiface evaluator
106

107
driver/examples.ml: cduce web/xhtml.cdo web/examples/build.cd web/examples/examples.xml
108
	(cd web/examples; ../../cduce build.cd -I .. --arg examples.xml)
109 110 111 112 113

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

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

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

# 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
124
# EXTRA_OPTS_WEBIFACE += -ccopt -static
125