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

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

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

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

Pietro Abate's avatar
Pietro Abate committed
101
############ CGI DEMO ###################
102

Pietro Abate's avatar
Pietro Abate committed
103
cgi: webiface evaluator
104

105
106
107
108
109
install_cgi: cgi
	@echo "Install cgi scripts"
	$(HIDE)$(INSTALL) -m755 webiface $(CGIDIR)/cduce
	$(HIDE)$(INSTALL) -m755 evaluator $(CGIDIR)/demo_evaluator

110
driver/examples.ml: cduce web/xhtml.cdo web/examples/build.cd web/examples/examples.xml
Pietro Abate's avatar
Pietro Abate committed
111
	(cd web/examples; ../../cduce build.cd -I .. --arg examples.xml)
112
113
114
115

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

Giuseppe Castagna's avatar
Giuseppe Castagna committed
116
webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
Pietro Abate's avatar
Pietro Abate committed
117
118
	@echo "Build $@"
	$(HIDE)$(LINK) -verbose $(INCLUDES) -o $@ $^ $(EXTRA_OPTS_WEBIFACE)
119
120

evaluator: $(EVALUATOR:.cmo=.$(EXTENSION))
Pietro Abate's avatar
Pietro Abate committed
121
122
	@echo "Build $@"
	$(HIDE)$(LINK) -verbose $(INCLUDES) -o $@ $^ $(EXTRA_OPTS_WEBIFACE)
123
124
125
126

# 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
127
# EXTRA_OPTS_WEBIFACE += -ccopt -static
128