Makefile.distrib 3.57 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
NATIVE = true
PROFILE = false
PXP_WLEX = false

PACKAGES = -package "pxp-engine pxp-lex-iso88591 wlexing camlp4 num cgi"
ifeq ($(PXP_WLEX), true)
  PACKAGES += -package pxp-wlex-utf8
else
  PACKAGES += -package pxp-lex-utf8
endif

12 13 14 15 16 17 18 19 20 21
SYNTAX = camlp4o -I misc/ pa_extend.cmo \
  q_symbol.cmo \
  -symbol cduce_version=\"$(VERSION)\" \
  -symbol build_date=\"$(shell date +%Y-%m-%d)\"

ifeq ($(NATIVE), true)
	SYNTAX += -symbol ocaml_compiler=\"native\"
else
	SYNTAX += -symbol ocaml_compiler=\"bytecode\"
endif
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90

VERSION = 0.0.9

ifeq ($(PROFILE), true)
	CAMLC_P = ocamlcp -p a
	CAMLOPT_P = ocamlopt -p
	SYNTAX_PARSER = 
else
	CAMLC_P = ocamlc
	CAMLOPT_P = ocamlopt
	SYNTAX_PARSER = -pp '$(SYNTAX)'
endif

OPT = -warn-error A
CAMLC = ocamlfind $(CAMLC_P) $(OPT) $(PACKAGES)
CAMLOPT = ocamlfind $(CAMLOPT_P) $(OPT) $(PACKAGES)

ifeq ($(NATIVE), true)
	EXTENSION = cmx
	LINK = $(CAMLOPT) -linkpkg gramlib.cmxa
else
	EXTENSION = cmo
	LINK = $(CAMLC) -custom -linkpkg gramlib.cma
endif

all: cduce dtd2cduce local_website

# Source directories 

DIRS = misc parser typing types runtime driver
CLEAN_DIRS = $(DIRS) tools tests

# Objects to build

OBJECTS = \
 misc/state.cmo misc/pool.cmo misc/encodings.cmo misc/bool.cmo \
 misc/pretty.cmo \
 \
 types/sortedList.cmo types/boolean.cmo types/ident.cmo \
 types/intervals.cmo types/chars.cmo types/atoms.cmo types/normal.cmo \
 types/types.cmo types/patterns.cmo types/sequence.cmo \
 types/sample.cmo \
 \
 parser/location.cmo parser/wlexer.cmo parser/ast.cmo parser/parser.cmo \
 \
 typing/typed.cmo typing/typer.cmo \
 \
 runtime/value.cmo runtime/load_xml.cmo runtime/run_dispatch.cmo \
 runtime/print_xml.cmo runtime/eval.cmo \
 \
 types/builtin.cmo driver/cduce.cmo

CDUCE = $(OBJECTS) driver/run.cmo
WEBIFACE  = $(OBJECTS) driver/examples.cmo driver/webiface.cmo
DTD2CDUCE = tools/dtd2cduce.cmo

DEPEND = $(DIRS:=/*.ml) $(DIRS:=/*.mli)
INCLUDES = $(DIRS:%=-I %)

cduce: $(CDUCE:.cmo=.$(EXTENSION))
	$(LINK) $(INCLUDES) -o $@ $^

webiface: $(WEBIFACE:.cmo=.$(EXTENSION))
	$(LINK) -o $@ $^

dtd2cduce: $(DTD2CDUCE:.cmo=.$(EXTENSION))
	$(LINK) -o $@ $^

.PHONY: compute_depend
91
compute_depend: misc/q_symbol.cmo
92
	@echo "Computing dependencies ..."
93 94
	ocamldep $(INCLUDES) $(SYNTAX_PARSER) $(DEPEND) | \
        sed -e "s|: |: misc/q_symbol.cmo |" > depend
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112

parser/wlexer.ml: parser/wlexer.mll
	wlex parser/wlexer.mll

clean:
	for i in $(CLEAN_DIRS); do \
	(cd $$i; rm -f *.cmi *.cmo *.cma *.cmx *.o *~); \
	done
	rm -f `find -name "*~"`
	rm -f *.cmi *.cmo *.cma *.cmx *.a *.cmxa *.o *~
	rm -f cduce ocamlprof.dump
	rm -f dtd2cduce pool webiface
	rm -Rf prepro package
	rm -f web/www/*.php web/www/*.html web/*~


.SUFFIXES: .ml .mli .cmo .cmi .cmx

113 114 115
misc/q_symbol.cmo: misc/q_symbol.ml
	$(CAMLC) -c $<

116 117 118 119 120 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
.ml.cmo:
	$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<

.ml.cmx:
	$(CAMLOPT) -c $(SYNTAX_PARSER) $(INCLUDES) $<

.mli.cmi:
	$(CAMLC) -c $(SYNTAX_PARSER) $(INCLUDES) $<

include depend

# CDuce-generated files

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

web/files: cduce web/site.cd
	(cd web; ../cduce --quiet site.cd --arg -php site.xml)

#
# Customize the following variables to match the settings
# of your local web server
#
WEB_PREFIX = /var/www
CGI_DIR = $(WEB_PREFIX)/cgi-bin
CDUCE_HTML_DIR = $(WEB_PREFIX)/html

install_web_local:web/files webiface
	cp  web/www/*.php web/cduce.css  $(CDUCE_HTML_DIR)/
	cp webiface $(CGI_DIR)/
	if test ! -d "$(CDUCE_HTML_DIR)/img" ; then \
	  mkdir $(CDUCE_HTML_DIR)/img; \
	fi;  
	cp web/img/*.*  $(CDUCE_HTML_DIR)/img


local_website: cduce
	(cd web; ../cduce --quiet site.cd --arg site.xml)