Makefile 5.19 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 49 50 51 52
DISTRIB = $(DIRS) cduce.spec tools depend INSTALL INSTALL.WIN32 CHANGES \
 LICENSE README AUTHORS Makefile.conf.template configure configure.ml doc

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

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

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

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

83
OCAML_STDLIBDIR := $(shell ocamlc -where)
84 85 86
.PHONY: .ocamlinit
.ocamlinit:
	echo '(* AUTOMATICALLY GENERATED by Makefile: DO NOT EDIT! *)' > $@
87 88 89 90 91 92 93 94 95 96 97 98
	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";;' >> $@
99 100 101 102 103 104
	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: *)' >> $@

105
CVS_DISTRIB = web CHANGES LICENSE README AUTHORS doc cduce dtd2cduce
106
cvs_snapshot_bin: clean
107 108 109 110 111 112 113 114 115
	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
	cp -R $(CVS_DISTRIB) cduce-cvs
	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
116 117 118 119 120

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

121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157

# Web site

driver/examples.ml: cduce web/examples/build.cd web/examples/examples.xml
	(cd web/examples; ../../cduce build.cd --arg examples.xml)

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
	cp evaluator $(CGI_DIR)/
	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
# EXTRA_OPTS_WEBIFACE = -ccopt -static

158