# -*- makefile-mode -*-
TOP_DIR=../..

include $(TOP_DIR)/Makefile.conf

PRE = 1
PKGNAME = rpc-generator
GENERATE = parser.ml META configure
PACKLIST = rpcgen-packlist
INSTALL_EXTRA = rpcgen-packlist
INSTOTHER = install-rpcgen

PP_OPTIONS = -pp "$(CPPO) $(PP_BYTES) $(PP_DEPRECATED)"

include $(TOP_DIR)/Makefile.rules

CLEAN_LIST += ocamlrpcgen$(EXEC_SUFFIX) parser.mli config.ml

.PHONY: install-rpcgen
install-rpcgen:
	mkdir -p "$(DESTDIR)$(BINDIR)"
	cp ocamlrpcgen$(EXEC_SUFFIX) "$(DESTDIR)$(BINDIR)"
	@echo "Installed ocamlrpcgen$(EXEC_SUFFIX) into $(DESTDIR)$(BINDIR)"

.PHONY: configure
configure:
	echo "let cpp = \"$(OCAMLRPCGEN_CPP)\";;" > config.ml

