TOP_DIR = ../..
include $(TOP_DIR)/Makefile.rules

PACKAGES = netstring,bytes
OCAMLC_OPTIONS = -I +compiler-libs

OBJ =   pxp_lexing.cmo \
        pxp_core_types.cmo pxp_lexer_types.cmo \
	pxp_lex_aux.cmo pxp_lexers.cmo \
	pxp_lib.cmo pxp_aux.cmo pxp_reader.cmo \
	pxp_dfa.cmo \
	pxp_entity.cmo pxp_dtd.cmo \
	pxp_entity_manager.cmo \
	pxp_types.cmo pxp_event.cmo pxp_document.cmo \
	pxp_core_parser.cmo pxp_tree_parser.cmo pxp_ev_parser.cmo \
	pxp_dtd_parser.cmo \
	pxp_yacc.cmo pxp_marshal.cmo pxp_codewriter.cmo

DOC =   pxp_types.mli pxp_document.mli pxp_dtd.mli pxp_tree_parser.mli \
	pxp_core_types.mli pxp_ev_parser.mli \
 	pxp_event.mli pxp_dtd_parser.mli pxp_codewriter.mli \
  	pxp_marshal.mli pxp_yacc.mli pxp_reader.mli \
	intro_trees.txt intro_extensions.txt intro_namespaces.txt \
        intro_events.txt intro_resolution.txt intro_getting_started.txt \
	intro_advanced.txt intro_preprocessor.txt \
	example_readme.txt

XOBJ = $(OBJ:.cmo=.cmx)

all: pxp_engine.cma pxp_top.cmo

opt: pxp_engine.cmxa

pxp_engine.cma: $(OBJ)
	$(OCAMLC) -o pxp_engine.cma -a $(OBJ)

pxp_engine.cmxa: $(XOBJ)
	$(OCAMLOPT) -o pxp_engine.cmxa -a $(XOBJ)

pxp_engine.dump: $(DOC)
	if [ ! -f pxp_engine.cma ]; then $(MAKE) -f Makefile.code pxp_engine.cma; fi
	ocamlfind ocamldoc -package "$(PACKAGES)" -stars -dump pxp_engine.dump \
		$(DOC)


include depend
