OCAML_LIBS    = ../idl/ocaml_backend/common ../idl/ocaml_backend/client
OCAMLINCLUDES = ../idl/ocaml_backend ../xapi
OCAMLPACKS    = xml-light2 stdext stunnel log

section
	OCAMLINCLUDES += .
	OCAMLFLAGS = -dtypes -thread -warn-error F -cclib -static
	CLI_FILES = newcli ../xapi/cli_protocol options
	OCamlProgram(xe, $(CLI_FILES))
	OCamlDocProgram(xe, $(CLI_FILES))

section

	OCAMLPACKS += xenbus xenstore netdev
	OCAML_CLIBS = ../xenops/statdev_stubs 

	OCamlProgram(fatxe, cli options \
		../xapi/xapi_cli \
		../xapi/pool_role \
		../xapi/helpers \
		../xapi/xapi_inventory \
		../xapi/db \
		../xapi/importexport \
		../xapi/parse_db_conf \
		../xapi/xapi_vm_helpers \
		../xapi/xapi_vm_lifecycle \
		../xapi/xapi_pv_driver_version \
		../xapi/memory_check \
		../license/license \
		../idl/dm_api \
		../idl/datamodel \
		../idl/datamodel_utils \
		../xenops/xenbus \
		../xenops/domain \
		../xenops/memory \
		../xenops/device \
		../xenops/netman \
		../xenops/watch \
		../xenops/balloon \
		../xenops/hotplug \
		../xenops/device_common \
		../xenops/xenguestHelper \
		../xenops/io \
		../database/generation \
		../database/eventgen \
		../database/ref_index \
		../database/db_filter \
		../database/db_upgrade \
		../database/db_exn \
		../database/db_cache \
		../database/db_action_helper \
		../database/db_connections \
		../database/db_conn_store \
		../database/db_remote_marshall \
		../database/db_lock \
		../database/db_dirty \
		../database/db_xml \
		../database/db_backend \
		../database/db_cache_types \
		../database/master_connection \
		../database/string_marshall_helper \
		../database/string_unmarshall_helper \
		../database/backend_xml \
		../http/http_svr \
		../gpg/gpg \
		../autogen/db_actions \
		../idl/ocaml_backend/exnHelper \
		../idl/ocaml_backend/taskHelper \
		../idl/ocaml_backend/locking_helpers \
		../idl/ocaml_backend/server_helpers \
		../idl/ocaml_backend/context \
		../database/escaping \
		../sexpr/sExpr \
		../sexpr/sExprParser \
		../sexpr/sExprLexer \
		../client_records/record_util \
		../client_records/records \
		../idl/constants \
		../xapi/cli_key \
		../xapi/cli_operations \
		../xapi/cli_operations_geneva \
		../xapi/cli_frontend \
		../xapi/xapi_globs \
		../xapi/cli_printer \
		../xapi/cli_util \
		../xva/xva \
		../xapi/cli_protocol)

.PHONY: clean
clean:
	rm -f $(CLEAN_OBJS)
	rm -f ./xe
	rm -f ./rt/gtclient
	rm -f ./rt/xgetip
	rm -f ./rt/gtserver_linux
	rm -f ./rt/test_host

.SUBDIRS: rt

.PHONY: install
install:
	mkdir -p $(BIN_PATH)
	$(IPROG) xe $(BIN_PATH)
	mkdir -p $(DESTDIR)/usr/bin
	ln -sf $(BIN_DIR)/xe $(DESTDIR)/usr/bin/xe
	mkdir -p $(DESTDIR)/etc/bash_completion.d
	$(IPROG) bash-completion $(DESTDIR)/etc/bash_completion.d/xe
	mkdir -p $(DEBUGDIST)

.PHONY: sdk-install
sdk-install: install
	@:

