--- Makefile.distrib 2007/07/10 17:57:26 708 +++ Makefile.distrib 2007/07/10 18:16:35 1001 @@ -1,13 +1,27 @@ include Makefile.conf -VERSION = 0.2.0 +VERSION = 0.2.0-pre4 -PACKAGES = pxp-engine pxp-lex-iso88591 ulex camlp4 num cgi pcre netstring +PACKAGES = pxp-engine pxp-lex-iso88591 ulex camlp4 num cgi pcre netstring ifeq ($(PXP_WLEX), true) PACKAGES += pxp-wlex-utf8 else PACKAGES += pxp-lex-utf8 endif + + + +# +# Check if running Cygwin +# + +ifneq (,$(findstring Cygwin, $(shell echo "Sys.os_type;;" | ocaml))) + EXE=.exe +else + EXE= +endif + + SYNTAX = -I misc/ q_symbol.cmo \ -symbol cduce_version=\"$(VERSION)\" \ -symbol build_date=\"$(shell date +%Y-%m-%d)\" \ @@ -24,6 +38,16 @@ SYNTAX += -symbol EXPAT= endif +ifeq ($(CURL), true) + PACKAGES += curl + SYNTAX += -symbol CURL= +endif + +ifeq ($(NETCLIENT), true) + PACKAGES += netclient + SYNTAX += -symbol NETCLIENT= +endif + SYNTAX_PARSER = -syntax camlp4o $(SYNTAX:%=-ppopt %) CAMLC_P = ocamlc -g @@ -40,6 +64,14 @@ endif OPT = -warn-error FPS +ANNOT = +INTERFACE = +ifeq ($(ANNOT), true) + OPT += -passopt -dtypes +endif +ifeq ($(INTERFACE), true) + OPT += -passopt -i +endif OCAMLFIND = ocamlfind CAMLC = $(OCAMLFIND) $(CAMLC_P) $(OPT) -package "$(PACKAGES)" CAMLOPT = $(OCAMLFIND) $(CAMLOPT_P) $(OPT) -package "$(PACKAGES)" @@ -52,21 +84,46 @@ LINK = $(CAMLC) -custom -linkpkg gramlib.cma endif -all: cduce dtd2cduce +INSTALL := $(shell which install) +all: cduce dtd2cduce validate + install: all mkdir -p $(PREFIX)/bin/ mkdir -p $(PREFIX)/man/man1/ - install -m755 cduce dtd2cduce $(PREFIX)/bin/ - install -m644 doc/cduce.1 $(PREFIX)/man/man1/ + $(INSTALL) -m755 cduce$(EXE) dtd2cduce$(EXE) $(PREFIX)/bin/ + $(INSTALL) -m644 doc/cduce.1 $(PREFIX)/man/man1/ uninstall: - rm $(PREFIX)/bin/cduce $(PREFIX)/bin/dtd2cduce $(PREFIX)/man/man1/cduce.1 + rm $(PREFIX)/bin/cduce$(EXE) $(PREFIX)/bin/dtd2cduce$(EXE) $(PREFIX)/man/man1/cduce.1 + +help: + @echo "GOALS" + @echo " cduce : compiles the CDuce command line interpreter" + @echo " dtd2cduce : compiles the dtd2cduce tools" + @echo " validate : compiles the schema validation tool" + @echo " webiface : compiles the CDuce web interface interpreter (CGI script)" + @echo " webpages : compiles in web/www/ the files for the CDuce website" + @echo " (including the tutorial and manual)" + @echo " install_web : compiles webiface and webpages, and install everything" + @echo " all : equivalent to (make cduce dtd2cduce validate)" + @echo " install : install cduce dtd2cduce, validate et man pages" + @echo " clean : back to the starting point" + @echo " uninstall : remove installed files" + @echo "" + @echo "OPTIONS (default value in brackets)" + @echo " PREFIX= : set the prefix for installation [/usr/local]" + @echo " NATIVE=false : use the OCaml native code compiler to build CDuce [true]" + @echo " PXP_WLEX=true : use wlex for parsing UTF-8 XML files [false]" + @echo " EXPAT=true : build expat support [false]" + @echo " CURL=true: build curl support [false]" + @echo " NETCLIENT=false: build netclient support [true]" + @echo "" # Source directories -DIRS = misc parser schema typing types compile runtime driver module +DIRS = misc parser schema typing types compile runtime driver query CLEAN_DIRS = $(DIRS) tools tests # Objects to build @@ -75,7 +132,7 @@ misc/stats.cmo \ misc/serialize.cmo misc/custom.cmo \ misc/state.cmo misc/pool.cmo misc/encodings.cmo misc/bool.cmo \ - misc/pretty.cmo misc/ns.cmo \ + misc/pretty.cmo misc/ns.cmo misc/inttbl.cmo misc/imap.cmo \ \ types/sortedList.cmo types/boolean.cmo types/ident.cmo \ types/intervals.cmo types/chars.cmo types/atoms.cmo \ @@ -85,10 +142,13 @@ \ runtime/value.cmo \ \ - schema/schema_types.cmo schema/schema_xml.cmo schema/schema_builtin.cmo \ - schema/schema_validator.cmo schema/schema_parser.cmo \ + schema/schema_xml.cmo \ + schema/schema_common.cmo \ + schema/schema_builtin.cmo \ + schema/schema_validator.cmo \ + schema/schema_parser.cmo \ \ - parser/location.cmo parser/ulexer.cmo parser/ast.cmo parser/parser.cmo \ + parser/location.cmo parser/url.cmo parser/ulexer.cmo parser/ast.cmo parser/parser.cmo \ \ typing/typed.cmo typing/typer.cmo \ \ @@ -100,43 +160,52 @@ compile/compile.cmo \ compile/operators.cmo \ \ - types/builtin.cmo driver/cduce.cmo + types/builtin.cmo driver/librarian.cmo driver/cduce.cmo + +CQL_OBJECTS= query/query.cmo query/query_parse.cmo +CQL_OBJECTS_RUN = query/query_run.cmo -CDUCE = $(OBJECTS) driver/run.cmo -WEBIFACE = $(OBJECTS) driver/examples.cmo driver/webiface.cmo +VALIDATE_OBJECTS := $(shell for o in $(OBJECTS); do echo $$o; if [ "$$o" = "schema/schema_parser.cmo" ]; then exit 0; fi; done) # all objects until schema_parser.cmo + +CDUCE = $(OBJECTS) $(CQL_OBJECTS) driver/run.cmo $(CQL_OBJECTS_RUN) +WEBIFACE = $(OBJECTS) $(CQL_OBJECTS) driver/examples.cmo driver/webiface.cmo DTD2CDUCE = tools/dtd2cduce.cmo -ALL_OBJECTS = $(OBJECTS) \ +ALL_OBJECTS = $(OBJECTS) $(CQL_OBJECTS) \ driver/run.cmo driver/examples.cmo driver/webiface.cmo \ - tools/dtd2cduce.cmo + tools/dtd2cduce.cmo tools/validate.cmo \ + $(CQL_OBJECTS_RUN) +ALL_INTERFACES = schema/schema_types.mli -DEPEND = $(ALL_OBJECTS:.cmo=.ml) $(ALL_OBJECTS:.cmo=.mli) +DEPEND = $(ALL_OBJECTS:.cmo=.ml) $(ALL_OBJECTS:.cmo=.mli) $(ALL_INTERFACES) INCLUDES = $(DIRS:%=-I %) cduce: $(CDUCE:.cmo=.$(EXTENSION)) - $(LINK) $(INCLUDES) -o $@ $^ + $(LINK) $(INCLUDES) -o $@ $^ $(EXTRA_LINK_OPTS) -bug: $(OBJECTS) bug.cmo - $(LINK) $(INCLUDES) -o $@ $^ +cDuce_all: $(OBJECTS) + $(CAMLC) -o cDuce_all.cmo -pack $(OBJECTS) + $(CAMLC) -a -o cDuce_all.cma -linkpkg gramlib.cma cDuce_all.cmo webiface: $(WEBIFACE:.cmo=.$(EXTENSION)) - $(LINK) $(INCLUDES) -o $@ $^ -ccopt -static + $(LINK) -verbose $(INCLUDES) -o $@ $^ -ccopt -static # webiface is made static to be able to move it more easily # (to compile it on a machine which is not the web server) dtd2cduce: $(DTD2CDUCE:.cmo=.$(EXTENSION)) $(LINK) $(INCLUDES) -o $@ $^ -validate: $(OBJECTS:.cmo=.$(EXTENSION)) tools/validate.ml +validate: $(VALIDATE_OBJECTS:.cmo=.$(EXTENSION)) tools/validate.$(EXTENSION) $(LINK) $(INCLUDES) -o $@ $^ .PHONY: compute_depend compute_depend: $(DEPEND_OCAMLDEP) + echo $(DEPEND) @echo "Computing dependencies ..." - ocamlfind ocamldep -package "$(PACKAGES)" $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) | \ - sed -e "s|: |: misc/q_symbol.cmo |" > depend - + ocamlfind ocamldep -package "$(PACKAGES)" \ + $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) | \ + sed -e "s|: |: misc/q_symbol.cmo |" > depend clean: for i in $(CLEAN_DIRS); do \ (cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \ @@ -170,21 +239,25 @@ # CDuce-generated files driver/examples.ml: cduce web/examples/build.cd web/examples/examples.xml - (cd web/examples; ../../cduce --quiet build.cd --arg examples.xml) + (cd web/examples; ../../cduce build.cd --arg examples.xml) webpages: cduce web/site.cdo - (cd web; ../cduce --run site.cd --arg site.xml) + (cd web; ../cduce --run site.cdo --arg site.xml) + +web/site.cdo: cduce web/xhtml.cdo web/site.cd + ./cduce -I web/ --compile web/site.cd -web/site.cdo: cduce web/site.cd - ./cduce --compile web/site.cd +web/xhtml.cdo: cduce web/xhtml.cd + ./cduce -I web/ --compile web/xhtml.cd website: webpages webiface install_web: website cp web/www/*.html web/cduce.css $(HTML_DIR)/ - cp CHANGES $(HTML_DIR)/ + cp CHANGES INSTALL INSTALL.WIN32 $(HTML_DIR)/ cp webiface $(CGI_DIR)/cduce if test ! -d "$(HTML_DIR)/img" ; then \ mkdir $(HTML_DIR)/img; \ fi; cp web/img/*.* $(HTML_DIR)/img +#*: help