ligo/src/Makefile

703 lines
20 KiB
Makefile
Raw Normal View History

2016-09-08 21:13:10 +04:00
2017-01-02 17:02:55 +04:00
-include Makefile.local
2016-09-08 21:13:10 +04:00
include Makefile.config
TZCOMPILER=../tezos-protocol-compiler
TZNODE=../tezos-node
TZCLIENT=../tezos-client
2016-12-02 02:20:23 +04:00
TZWEBCLIENT=../tezos-webclient
2017-01-02 16:33:11 +04:00
TZATTACKER=../tezos-attacker
2016-09-08 21:13:10 +04:00
all: ${TZCOMPILER} ${TZNODE} ${TZCLIENT} ${TZWEBCLIENT} # ${TZATTACKER}
2016-09-08 21:13:10 +04:00
############################################################################
## Protocol environment
############################################################################
PROTOCOL_ENV_INTFS := \
$(addprefix proto/environment/, \
2016-09-08 21:13:10 +04:00
pervasives.mli \
compare.mli \
\
array.mli list.mli bytes.mli string.mli \
set.mli map.mli \
int32.mli int64.mli \
buffer.mli \
format.mli \
\
lwt_sequence.mli lwt.mli lwt_list.mli \
\
mBytes.mli \
hex_encode.mli \
\
uri.mli \
data_encoding.mli \
error_monad.mli \
logging.mli \
2016-09-08 21:13:10 +04:00
time.mli \
base58.mli \
2016-09-08 21:13:10 +04:00
hash.mli \
ed25519.mli \
persist.mli \
fitness.mli \
2016-09-08 21:13:10 +04:00
context.mli \
RPC.mli \
\
updater.mli \
)
2016-09-08 21:13:10 +04:00
.INTERMEDIATE: node/updater/environment_gen
.SECONDARY: node/updater/proto_environment.mli
node/updater/environment_gen: node/updater/environment_gen.ml
@echo LINK $(notdir $@)
@$(OCAMLOPT) -o $@ $^
node/updater/proto_environment.mli: \
node/updater/environment_gen $(PROTOCOL_ENV_INTFS)
@echo GENERATING $(notdir $@)
@node/updater/environment_gen node/updater/proto_environment.mli \
$(PROTOCOL_ENV_INTFS)
node/updater/proto_environment.cmi: \
node/updater/proto_environment.mli node/updater/protocol.cmi
@echo OCAMLOPT ${TARGET} $@
@$(OCAMLOPT) -nopervasives -nostdlib -opaque -I tmp -I node/updater -c $<
node/updater/protocol.cmi: node/updater/protocol.cmx
partial-clean::
2016-09-08 21:13:10 +04:00
rm -f node/updater/proto_environment.mli
rm -f node/updater/environment_gen
############################################################################
## Protocol environment
############################################################################
EMBEDDED_PROTOCOL_LIB_CMIS := \
tmp/camlinternalFormatBasics.cmi \
node/updater/proto_environment.cmi \
node/updater/register.cmi
node/updater/register.cmi: EXTRA_OCAMLFLAGS = -opaque
node/updater/environment.cmi: node/updater/environment.cmx
tmp/camlinternalFormatBasics.cmi:
mkdir -p tmp
ln -sf $(shell ocamlc -where)/camlinternalFormatBasics.cmi $@
.INTERMEDIATE: compiler/embedded_cmis.ml
compiler/embedded_cmis.cmx: compiler/embedded_cmis.cmi
compiler/embedded_cmis.ml: ${EMBEDDED_PROTOCOL_LIB_CMIS}
@echo OCAMLRES ${TARGET} $(notdir $@)
@$(OCAMLRES) -format ocaml -o $@ $^
partial-clean::
2016-09-08 21:13:10 +04:00
rm -f compiler/embedded_cmis.ml
rm -rf tmp
############################################################################
## Minimal utils library compatible with js_of_ocaml
############################################################################
MINUTILS_LIB_INTFS := \
minutils/mBytes.mli \
2017-01-14 16:13:59 +04:00
minutils/hex_encode.mli \
minutils/utils.mli \
minutils/compare.mli \
minutils/data_encoding.mli \
minutils/RPC.mli \
MINUTILS_LIB_IMPLS := \
minutils/mBytes.ml \
minutils/hex_encode.ml \
minutils/utils.ml \
minutils/compare.ml \
minutils/data_encoding.ml \
minutils/RPC.ml \
MINUTILS_PACKAGES := \
cstruct \
lwt \
ocplib-json-typed.bson \
ocplib-resto.directory \
$(COVERAGEPKG) \
MINUTILS_OBJS := \
${MINUTILS_LIB_IMPLS:.ml=.cmx} ${MINUTILS_LIB_IMPLS:.ml=.ml.deps} \
${MINUTILS_LIB_INTFS:.mli=.cmi} ${MINUTILS_LIB_INTFS:.mli=.mli.deps}
${MINUTILS_OBJS}: PACKAGES=${MINUTILS_PACKAGES}
${MINUTILS_OBJS}: SOURCE_DIRECTORIES=minutils
${MINUTILS_OBJS}: TARGET="(minutils.cmxa)"
${MINUTILS_OBJS}: OPENED_MODULES=
minutils.cmxa: ${MINUTILS_LIB_IMPLS:.ml=.cmx}
@echo LINK $(notdir $@)
@${OCAMLOPT} ${OCAMLFLAGS} -a -o $@ $^
2016-09-08 21:13:10 +04:00
2016-12-02 02:20:23 +04:00
MINUTILS_OBJS_BYTECODE := \
${MINUTILS_LIB_IMPLS:.ml=.cmo} ${MINUTILS_LIB_IMPLS:.ml=.ml.deps.byte}
${MINUTILS_OBJS_BYTECODE}: PACKAGES=${MINUTILS_PACKAGES}
${MINUTILS_OBJS_BYTECODE}: SOURCE_DIRECTORIES=minutils
${MINUTILS_OBJS_BYTECODE}: TARGET="(minutils.cma)"
${MINUTILS_OBJS_BYTECODE}: OPENED_MODULES=
minutils.cma: ${MINUTILS_LIB_IMPLS:.ml=.cmo}
@echo LINK $(notdir $@)
@${OCAMLC} ${OCAMLFLAGS} -a -o $@ $^
2016-09-08 21:13:10 +04:00
############################################################################
## Utils library
2016-09-08 21:13:10 +04:00
############################################################################
UTILS_LIB_INTFS := \
utils/base58.mli \
2016-09-08 21:13:10 +04:00
utils/cli_entries.mli \
utils/data_encoding_ezjsonm.mli \
utils/crypto_box.mli \
2016-09-08 21:13:10 +04:00
utils/time.mli \
utils/hash.mli \
utils/error_monad.mli \
utils/lwt_exit.mli \
2016-09-08 21:13:10 +04:00
utils/logging.mli \
utils/lwt_utils.mli \
2016-11-29 00:46:26 +04:00
utils/lwt_pipe.mli \
2016-09-08 21:13:10 +04:00
utils/IO.mli \
2016-11-29 00:54:32 +04:00
utils/moving_average.mli \
2017-01-14 16:13:19 +04:00
utils/ring.mli \
2017-02-17 21:15:46 +04:00
utils/watcher.mli \
2016-09-08 21:13:10 +04:00
UTILS_LIB_IMPLS := \
utils/base58.ml \
2016-09-08 21:13:10 +04:00
utils/cli_entries.ml \
utils/error_monad_sig.ml \
utils/error_monad.ml \
utils/data_encoding_ezjsonm.ml \
2016-09-08 21:13:10 +04:00
utils/time.ml \
utils/hash.ml \
utils/crypto_box.ml \
utils/lwt_exit.ml \
2016-09-08 21:13:10 +04:00
utils/logging.ml \
utils/lwt_utils.ml \
2016-11-29 00:46:26 +04:00
utils/lwt_pipe.ml \
2016-09-08 21:13:10 +04:00
utils/IO.ml \
2016-11-29 00:54:32 +04:00
utils/moving_average.ml \
2017-01-14 16:13:19 +04:00
utils/ring.ml \
2017-02-17 21:15:46 +04:00
utils/watcher.ml \
2016-09-08 21:13:10 +04:00
UTILS_PACKAGES := \
${MINUTILS_PACKAGES} \
2016-09-08 21:13:10 +04:00
base64 \
calendar \
ezjsonm \
ipaddr.unix \
lwt.unix \
2017-01-14 16:13:59 +04:00
mtime.os \
nocrypto \
2016-09-08 21:13:10 +04:00
sodium \
zarith \
$(COVERAGEPKG) \
2016-09-08 21:13:10 +04:00
UTILS_OBJS := \
${UTILS_LIB_IMPLS:.ml=.cmx} ${UTILS_LIB_IMPLS:.ml=.ml.deps} \
${UTILS_LIB_INTFS:.mli=.cmi} ${UTILS_LIB_INTFS:.mli=.mli.deps}
${UTILS_OBJS}: PACKAGES=${UTILS_PACKAGES}
${UTILS_OBJS}: SOURCE_DIRECTORIES=minutils utils
2016-09-08 21:13:10 +04:00
${UTILS_OBJS}: TARGET="(utils.cmxa)"
${UTILS_OBJS}: OPENED_MODULES=
utils.cmxa: ${UTILS_LIB_IMPLS:.ml=.cmx}
@echo LINK $(notdir $@)
@${OCAMLOPT} ${OCAMLFLAGS} -a -o $@ $^
utils.top: DEVFLAGS=
utils.top:
( $(patsubst %, echo "#require \"%\";;" ; ,${UTILS_PACKAGES}) ) > .ocamlinit.utils
( $(patsubst %, echo "#mod_use \"%\";;" ; ,${MINUTILS_LIB_IMPLS} ${UTILS_LIB_IMPLS}) ) >> .ocamlinit.utils
utop -init .ocamlinit.utils ${OCAMLFLAGS}
2016-09-08 21:13:10 +04:00
############################################################################
## Node protocol compiler (also embedded in the main program)
############################################################################
COMPILER_LIB_INTFS := \
compiler/tezos_compiler.mli \
compiler/embedded_cmis.mli \
COMPILER_LIB_IMPLS := \
compiler/embedded_cmis.ml \
compiler/tezos_compiler.ml \
2016-09-08 21:13:10 +04:00
COMPILER_IMPLS := \
compiler_main.ml \
2016-09-08 21:13:10 +04:00
COMPILER_PACKAGES := \
${UTILS_PACKAGES} \
compiler-libs.optcomp \
config-file \
lwt.unix \
ocplib-endian \
ocplib-ocamlres \
unix \
2016-09-08 21:13:10 +04:00
COMPILER_OBJS := \
${COMPILER_IMPLS:.ml=.cmx} ${COMPILER_IMPLS:.ml=.ml.deps} \
${COMPILER_LIB_IMPLS:.ml=.cmx} ${COMPILER_LIB_IMPLS:.ml=.ml.deps} \
${COMPILER_LIB_INTFS:.mli=.cmi} ${COMPILER_LIB_INTFS:.mli=.mli.deps} \
${TZCOMPILER}
${COMPILER_OBJS}: PACKAGES=${COMPILER_PACKAGES}
${COMPILER_OBJS}: SOURCE_DIRECTORIES=utils minutils compiler
2016-09-08 21:13:10 +04:00
${COMPILER_OBJS}: TARGET="(compiler.cmxa)"
${COMPILER_OBJS}: \
OPENED_MODULES=Error_monad Hash Utils
compiler.cmxa: ${COMPILER_LIB_IMPLS:.ml=.cmx}
@echo LINK $(notdir $@)
@${OCAMLOPT} ${OCAMLFLAGS} -a -o $@ $^
${TZCOMPILER}: minutils.cmxa utils.cmxa compiler.cmxa ${COMPILER_IMPLS:.ml=.cmx}
2016-09-08 21:13:10 +04:00
@echo LINK $(notdir $@)
@$(OCAMLOPT) -linkpkg $(patsubst %, -package %, $(COMPILER_PACKAGES)) -o $@ $^
clean::
rm -f ${TZCOMPILER}
############################################################################
## Node program
############################################################################
NODE_LIB_INTFS := \
\
2017-01-14 16:13:59 +04:00
node/net/p2p_types.mli \
node/net/p2p_io_scheduler.mli \
2017-01-14 16:14:02 +04:00
node/net/p2p_connection.mli \
node/net/p2p_connection_pool_types.mli \
node/net/p2p_connection_pool.mli \
node/net/p2p_welcome.mli \
node/net/p2p_discovery.mli \
node/net/p2p_maintenance.mli \
2016-09-08 21:13:10 +04:00
node/net/p2p.mli \
node/net/RPC_server.mli \
2016-09-08 21:13:10 +04:00
\
node/updater/fitness.mli \
\
node/db/raw_store.mli \
node/db/store_helpers.mli \
node/db/store.mli \
\
2016-09-08 21:13:10 +04:00
node/db/ir_funview.mli \
node/db/persist.mli \
node/db/context.mli \
\
node/updater/updater.mli \
node/updater/proto_environment.mli \
node/updater/register.mli \
\
node/shell/state.mli \
node/shell/distributed_db_functors.mli \
node/shell/distributed_db_message.mli \
node/shell/distributed_db_metadata.mli \
node/shell/distributed_db.mli \
2016-09-08 21:13:10 +04:00
node/shell/prevalidator.mli \
node/shell/validator.mli \
\
node/shell/node_rpc_services.mli \
node/shell/node.mli \
node/shell/node_rpc.mli \
NODE_LIB_IMPLS := \
\
2016-09-08 21:13:10 +04:00
compiler/node_compiler_main.ml \
\
2017-01-14 16:13:59 +04:00
node/net/p2p_types.ml \
node/net/p2p_io_scheduler.ml \
2017-01-14 16:14:02 +04:00
node/net/p2p_connection.ml \
node/net/p2p_connection_pool_types.ml \
node/net/p2p_connection_pool.ml \
node/net/p2p_welcome.ml \
node/net/p2p_discovery.ml \
node/net/p2p_maintenance.ml \
2016-09-08 21:13:10 +04:00
node/net/p2p.ml \
2017-01-14 16:13:59 +04:00
\
node/net/RPC_server.ml \
2016-09-08 21:13:10 +04:00
\
node/updater/fitness.ml \
\
node/db/store_sigs.ml \
node/db/raw_store.ml \
node/db/store_helpers.ml \
node/db/store.ml \
\
2016-09-08 21:13:10 +04:00
node/db/ir_funview.ml \
node/db/persist.ml \
node/db/context.ml \
\
node/updater/protocol.ml \
2016-09-08 21:13:10 +04:00
node/updater/updater.ml \
node/updater/environment.ml \
node/updater/proto_environment.ml \
node/updater/register.ml \
\
node/shell/state.ml \
node/shell/distributed_db_functors.ml \
node/shell/distributed_db_message.ml \
node/shell/distributed_db_metadata.ml \
node/shell/distributed_db.ml \
2016-09-08 21:13:10 +04:00
node/shell/prevalidator.ml \
node/shell/validator.ml \
\
node/shell/node_rpc_services.ml \
node/shell/node.ml \
node/shell/node_rpc.ml \
NODE_INTFS := \
node/main/node_identity_file.mli \
node/main/node_config_file.mli \
node/main/node_shared_arg.mli \
node/main/node_run_command.mli \
node/main/node_config_command.mli \
node/main/node_identity_command.mli \
2016-09-08 21:13:10 +04:00
NODE_IMPLS := \
node/main/node_identity_file.ml \
node/main/node_config_file.ml \
node/main/node_shared_arg.ml \
node/main/node_run_command.ml \
node/main/node_config_command.ml \
node/main/node_identity_command.ml \
2016-09-08 21:13:10 +04:00
node_main.ml \
NODE_PACKAGES := \
$(COMPILER_PACKAGES) \
calendar \
2017-01-14 16:14:17 +04:00
cmdliner \
2016-09-08 21:13:10 +04:00
cohttp.lwt \
dynlink \
git \
ipv6-multicast \
2016-09-08 21:13:10 +04:00
irmin.unix \
ocplib-resto.directory \
2016-09-08 21:13:10 +04:00
EMBEDDED_NODE_PROTOCOLS := \
$(patsubst proto/%/,proto/embedded_proto_%.cmxa, \
$(filter-out proto/environment/,$(shell ls -d proto/*/)))
NODE_OBJS := \
${NODE_IMPLS:.ml=.cmx} ${NODE_IMPLS:.ml=.ml.deps} \
${NODE_INTFS:.mli=.cmi} ${NODE_INTFS:.mli=.mli.deps} \
2016-09-08 21:13:10 +04:00
${NODE_LIB_IMPLS:.ml=.cmx} ${NODE_LIB_IMPLS:.ml=.ml.deps} \
${NODE_LIB_INTFS:.mli=.cmi} ${NODE_LIB_INTFS:.mli=.mli.deps} \
${TZNODE}
${NODE_OBJS}: PACKAGES=${NODE_PACKAGES}
${NODE_OBJS}: SOURCE_DIRECTORIES=minutils utils compiler node/db node/net node/updater node/shell node/main
2016-09-08 21:13:10 +04:00
${NODE_OBJS}: TARGET="(node.cmxa)"
${NODE_OBJS}: OPENED_MODULES=Error_monad Hash Utils
node.cmxa: ${NODE_LIB_IMPLS:.ml=.cmx}
@echo LINK $(notdir $@)
@${OCAMLOPT} ${OCAMLFLAGS} -a -o $@ $^
${NODE_IMPLS:.ml=.cmx}: ${EMBEDDED_CLIENT_PROTOCOLS}
${TZNODE}: minutils.cmxa utils.cmxa compiler.cmxa node.cmxa ${EMBEDDED_NODE_PROTOCOLS} ${NODE_IMPLS:.ml=.cmx}
2016-09-08 21:13:10 +04:00
@echo LINK $(notdir $@)
@${OCAMLOPT} -linkall -linkpkg ${OCAMLFLAGS} -o $@ $^
partial-clean::
2016-09-08 21:13:10 +04:00
-rm -f proto/*.cm* proto/*.a
node.top: DEVFLAGS=
node.top: ${MINUTILS_LIB_IMPLS} ${UTILS_LIB_IMPLS} ${COMPILER_LIB_IMPLS} ${NODE_LIB_IMPLS}
( $(patsubst %, echo "#require \"%\";;" ; ,${NODE_PACKAGES}) ) > .ocamlinit.node
( $(patsubst %, echo "#mod_use \"%\";;" ; ,${MINUTILS_LIB_IMPLS} ${UTILS_LIB_IMPLS}) ) >> .ocamlinit.node
( $(patsubst %, echo "open %;;" ; ,Error_monad Hash Utils) ) >> .ocamlinit.node
( $(patsubst %, echo "#mod_use \"%\";;" ; ,${COMPILER_LIB_IMPLS} ${NODE_LIB_IMPLS}) ) >> .ocamlinit.node
utop -init .ocamlinit.node ${OCAMLFLAGS}
2016-09-08 21:13:10 +04:00
## Embedded protocol modules
.SECONDEXPANSION:
proto/embedded_proto_%.cmxa: \
${TZCOMPILER} \
proto/%/TEZOS_PROTOCOL \
$$(wildcard proto/%/*.ml) \
$$(wildcard proto/%/*.mli)
2017-01-02 17:02:55 +04:00
@${TZCOMPILER} -static ${DEVFLAGS} \
-build-dir proto/$*/_tzbuild \
$@ proto/$*/
2016-09-08 21:13:10 +04:00
CLIENT_PROTO_INCLUDES := \
minutils utils node/updater node/db node/net node/shell client \
$(shell ocamlfind query lwt ocplib-json-typed sodium)
2016-09-08 21:13:10 +04:00
proto/client_embedded_proto_%.cmxa: \
${TZCOMPILER} \
node/updater/environment.cmi \
node/updater/environment.cmx \
proto/%/TEZOS_PROTOCOL \
$$(wildcard proto/%/*.ml) \
$$(wildcard proto/%/*.mli)
2017-01-02 17:02:55 +04:00
@./${TZCOMPILER} -static -client ${DEVFLAGS} \
-build-dir client/embedded/$*/_tzbuild \
2016-09-08 21:13:10 +04:00
$(addprefix -I , ${CLIENT_PROTO_INCLUDES}) \
$@ proto/$*
clean::
rm -f ${TZNODE}
############################################################################
## Client program
############################################################################
CLIENT_LIB_INTFS := \
client/client_commands.mli \
2016-09-08 21:13:10 +04:00
client/client_node_rpcs.mli \
client/client_generic_rpcs.mli \
2016-10-16 23:57:56 +04:00
client/client_helpers.mli \
2016-09-08 21:13:10 +04:00
client/client_aliases.mli \
client/client_keys.mli \
2016-10-25 21:00:03 +04:00
client/client_protocols.mli \
2016-09-08 21:13:10 +04:00
CLIENT_LIB_IMPLS := \
client/client_commands.ml \
2016-09-08 21:13:10 +04:00
client/client_config.ml \
client/client_node_rpcs.ml \
client/client_generic_rpcs.ml \
2016-10-16 23:57:56 +04:00
client/client_helpers.ml \
2016-09-08 21:13:10 +04:00
client/client_aliases.ml \
client/client_keys.ml \
2016-10-25 21:00:03 +04:00
client/client_protocols.ml \
2017-02-25 16:24:53 +04:00
client/client_blocks.ml \
2016-09-08 21:13:10 +04:00
2016-12-02 02:20:23 +04:00
WEBCLIENT_LIB_INTFS := \
WEBCLIENT_LIB_IMPLS := \
client/webclient_version.ml \
2016-09-08 21:13:10 +04:00
CLIENT_IMPLS := \
client_main.ml
2016-12-02 02:20:23 +04:00
WEBCLIENT_IMPLS := \
webclient_static.ml \
webclient_main.ml
2016-09-08 21:13:10 +04:00
CLIENT_PACKAGES := \
${NODE_PACKAGES}
EMBEDDED_CLIENT_PROTOCOLS := \
$(patsubst client/embedded/%/, \
proto/client_embedded_proto_%.cmxa, \
$(shell ls -d client/embedded/*/))
2016-12-02 02:20:23 +04:00
EMBEDDED_CLIENT_VERSIONS := \
$(patsubst client/embedded/%/, \
client/embedded/client_%.cmx, \
$(shell ls -d client/embedded/*/))
EMBEDDED_WEBCLIENT_VERSIONS := \
$(patsubst client/embedded/%/, \
client/embedded/webclient_%.cmx, \
$(shell ls -d client/embedded/*/))
2016-09-08 21:13:10 +04:00
CLIENT_OBJS := \
${CLIENT_IMPLS:.ml=.cmx} ${CLIENT_IMPLS:.ml=.ml.deps} \
2016-12-02 02:20:23 +04:00
${WEBCLIENT_IMPLS:.ml=.cmx} ${WEBCLIENT_IMPLS:.ml=.ml.deps} \
2016-09-08 21:13:10 +04:00
${CLIENT_LIB_IMPLS:.ml=.cmx} ${CLIENT_LIB_IMPLS:.ml=.ml.deps} \
${CLIENT_LIB_INTFS:.mli=.cmi} ${CLIENT_LIB_INTFS:.mli=.mli.deps} \
2016-12-02 02:20:23 +04:00
${WEBCLIENT_LIB_IMPLS:.ml=.cmx} ${WEBCLIENT_LIB_IMPLS:.ml=.ml.deps} \
${WEBCLIENT_LIB_INTFS:.mli=.cmi} ${WEBCLIENT_LIB_INTFS:.mli=.mli.deps} \
${TZCLIENT} \
${TZWEBCLIENT}
2016-09-08 21:13:10 +04:00
${CLIENT_OBJS}: PACKAGES=${CLIENT_PACKAGES}
${CLIENT_OBJS}: SOURCE_DIRECTORIES=client client/embedded minutils utils node/net node/shell node/updater node/db compiler
2016-09-08 21:13:10 +04:00
${CLIENT_OBJS}: OPENED_MODULES=Error_monad Hash Utils
2016-12-02 02:20:23 +04:00
${CLIENT_LIB_IMPLS:.ml=.cmx} ${CLIENT_LIB_IMPLS:.ml=.ml.deps}: TARGET="(client.cmxa)"
${CLIENT_LIB_INTFS:.mli=.cmi} ${CLIENT_LIB_INTFS:.mli=.mli.deps}: TARGET="(client.cmxa)"
${WEBCLIENT_LIB_IMPLS:.ml=.cmx} ${WEBCLIENT_LIB_IMPLS:.ml=.ml.deps}: TARGET="(webclient.cmxa)"
${WEBCLIENT_LIB_INTFS:.mli=.cmi} ${WEBCLIENT_LIB_INTFS:.mli=.mli.deps}: TARGET="(webclient.cmxa)"
2016-09-08 21:13:10 +04:00
client.cmxa: ${CLIENT_LIB_IMPLS:.ml=.cmx}
@echo LINK $(notdir $@)
@${OCAMLOPT} ${OCAMLFLAGS} -a -o $@ $^
2016-12-02 02:20:23 +04:00
webclient.cmxa: ${WEBCLIENT_LIB_IMPLS:.ml=.cmx} client.cmxa
@echo LINK $(notdir $@)
${OCAMLOPT} ${OCAMLFLAGS} -a -o $@ ${WEBCLIENT_LIB_IMPLS:.ml=.cmx}
${EMBEDDED_CLIENT_VERSIONS}: client.cmxa
${CLIENT_IMPLS:.ml=.cmx}: ${EMBEDDED_CLIENT_VERSIONS}
${EMBEDDED_WEBCLIENT_VERSIONS}: webclient.cmxa
${WEBCLIENT_IMPLS:.ml=.cmx}: ${EMBEDDED_CLIENT_VERSIONS} ${EMBEDDED_WEBCLIENT_VERSIONS}
2016-09-08 21:13:10 +04:00
${TZCLIENT}: minutils.cmxa utils.cmxa compiler.cmxa node.cmxa \
2016-12-02 02:20:23 +04:00
client.cmxa \
${EMBEDDED_CLIENT_PROTOCOLS} \
${EMBEDDED_CLIENT_VERSIONS} \
${CLIENT_IMPLS:.ml=.cmx}
@echo LINK $(notdir $@)
@${OCAMLOPT} -linkpkg ${OCAMLFLAGS} -o $@ $^
${TZWEBCLIENT}: minutils.cmxa utils.cmxa compiler.cmxa node.cmxa \
client.cmxa webclient.cmxa \
${EMBEDDED_CLIENT_PROTOCOLS} \
${EMBEDDED_CLIENT_VERSIONS} \
${EMBEDDED_WEBCLIENT_VERSIONS} \
${WEBCLIENT_IMPLS:.ml=.cmx}
2016-09-08 21:13:10 +04:00
@echo LINK $(notdir $@)
@${OCAMLOPT} -linkpkg ${OCAMLFLAGS} -o $@ $^
2016-12-02 02:20:23 +04:00
webclient_static.ml: $$(shell find webclient_static/)
ocp-ocamlres webclient_static -o $@
2016-09-08 21:13:10 +04:00
clean::
2016-12-02 02:20:23 +04:00
-rm -f ${TZCLIENT} $(TZWEBCLIENT)
2016-09-08 21:13:10 +04:00
## Embedded client protocol modules
.SECONDEXPANSION:
2016-12-02 02:20:23 +04:00
2016-09-08 21:13:10 +04:00
client/embedded/client_%.cmx: \
$(patsubst %.ml, %.cmx, $(NODE_LIB_IMPLS) $(CLIENT_LIB_IMPLS)) \
proto/client_embedded_proto_%.cmxa \
$$(shell find client/embedded/% -name \*.ml -or -name \*.mli)
@$(MAKE) -C client/embedded/$* ../client_$*.cmx
2016-12-02 02:20:23 +04:00
client/embedded/webclient_%.cmx: \
client/embedded/client_%.cmx \
minutils.cma \
$$(shell find client/embedded/%/webclient -name \*.ml -or -name \*.mli) \
$$(shell find client/embedded/%/webclient/static/)
@$(MAKE) -C client/embedded/$* ../webclient_$*.cmx
partial-clean::
2016-09-08 21:13:10 +04:00
-for d in $$(ls -d client/embedded/*/) ; do make clean -C $$d ; done
-rm -f client/embedded/*.cm* client/embedded/*.o
2017-01-02 16:33:11 +04:00
############################################################################
## Attacker program
############################################################################
ATTACKER_LIB_INTFS := \
attacker/attacker_minimal.mli \
ATTACKER_LIB_IMPLS := \
attacker/attacker_minimal.ml \
ATTACKER_IMPLS := \
attacker_main.ml
ATTACKER_PACKAGES := \
${NODE_PACKAGES}
EMBEDDED_ATTACKER_PROTOCOLS := \
$(patsubst client/embedded/%/, \
proto/client_embedded_proto_%.cmxa, \
$(shell ls -d client/embedded/*/))
ATTACKER_OBJS := \
${ATTACKER_IMPLS:.ml=.cmx} ${ATTACKER_IMPLS:.ml=.ml.deps} \
${ATTACKER_LIB_IMPLS:.ml=.cmx} ${ATTACKER_LIB_IMPLS:.ml=.ml.deps} \
${ATTACKER_LIB_INTFS:.mli=.cmi} ${ATTACKER_LIB_INTFS:.mli=.mli.deps} \
${TZATTACKER}
${ATTACKER_OBJS}: PACKAGES=${ATTACKER_PACKAGES}
${ATTACKER_OBJS}: SOURCE_DIRECTORIES=attacker proto client/embedded minutils utils node/net node/shell node/updater node/db compiler
${ATTACKER_OBJS}: TARGET="(attacker.cmxa)"
${ATTACKER_OBJS}: OPENED_MODULES=Error_monad Hash Utils
attacker.cmxa: ${ATTACKER_LIB_IMPLS:.ml=.cmx}
@echo LINK $(notdir $@)
@${OCAMLOPT} ${OCAMLFLAGS} -a -o $@ $^
${ATTACKER_LIB_IMPLS:.ml=.cmx} ${ATTACKER_IMPLS:.ml=.cmx}: \
${EMBEDDED_ATTACKER_PROTOCOLS}
${TZATTACKER}: minutils.cmxa utils.cmxa compiler.cmxa node.cmxa \
${EMBEDDED_ATTACKER_PROTOCOLS} attacker.cmxa \
${ATTACKER_IMPLS:.ml=.cmx}
@echo LINK $(notdir $@)
@${OCAMLOPT} -linkpkg ${OCAMLFLAGS} -o $@ $^
clean::
-rm -f ${TZATTACKER}
############################################################################
2016-09-08 21:13:10 +04:00
## Generic rules
2017-01-02 16:33:11 +04:00
############################################################################
2016-09-08 21:13:10 +04:00
%.cmx: %.ml
@echo OCAMLOPT ${TARGET} $(notdir $@)
@$(OCAMLOPT) ${OCAMLFLAGS} -c $<
%.cmo: %.ml
2016-12-02 02:20:23 +04:00
@echo OCAMLC ${TARGET} $(notdir $@)
2016-09-08 21:13:10 +04:00
@$(OCAMLC) ${OCAMLFLAGS} -c $<
%.cmi: %.mli
@echo OCAMLOPT ${TARGET} $(notdir $@)
@$(OCAMLOPT) ${OCAMLFLAGS} -c $<
## Cleaning
.PHONY: clean partial-clean
clean:: partial-clean
partial-clean::
-find \( -name \*.cm\* -or -name \*.cmp -or -name \*.out -or -name \*~ -or -name \*.o -or -name \*.a \) -delete
2016-09-08 21:13:10 +04:00
## Dependencies
NO_DEPS := \
compiler/embedded_cmis.ml \
compiler/embedded_cmis.mli
compiler/embedded_cmis.cmx compiler/embedded_cmis.cmi: OPENED_MODULES=
ifneq ($(MAKECMDGOALS),clean)
2016-12-02 02:20:23 +04:00
include .depend
2016-09-08 21:13:10 +04:00
endif
2017-01-02 16:33:11 +04:00
DEPENDS := $(filter-out $(NO_DEPS), \
$(MINUTILS_LIB_INTFS) $(MINUTILS_LIB_IMPLS) \
$(UTILS_LIB_INTFS) $(UTILS_LIB_IMPLS) \
$(COMPILER_LIB_INTFS) $(COMPILER_LIB_IMPLS) \
$(COMPILER_INTFS) $(COMPILER_IMPLS) \
$(NODE_LIB_INTFS) $(NODE_LIB_IMPLS) \
$(NODE_INTFS) $(NODE_IMPLS) \
$(CLIENT_LIB_INTFS) $(CLIENT_LIB_IMPLS) \
$(CLIENT_INTFS) $(CLIENT_IMPLS) \
$(WEBCLIENT_LIB_INTFS) $(WEBCLIENT_LIB_IMPLS) \
$(ATTACKER_LIB_INTFS) $(ATTACKER_LIB_IMPLS) \
$(WEBCLIENT_INTFS) $(WEBCLIENT_IMPLS) \
$(ATTACKER_INTFS) $(ATTACKER_IMPLS) \
)
DEPENDS_BYTECODE := \
$(filter-out $(NO_DEPS), $(MINUTILS_LIB_INTFS) $(MINUTILS_LIB_IMPLS))
2016-09-08 21:13:10 +04:00
predepend: node/updater/proto_environment.mli
compiler/tezos_compiler.cmo compiler/tezos_compiler.cmx: \
compiler/embedded_cmis.cmi compiler/embedded_cmis.cmx
2016-12-02 02:20:23 +04:00
.SECONDARY: $(patsubst %,%.deps,${DEPENDS}) $(patsubst %,%.deps.byte,${DEPENDS_BYTECODE})
.depend: $(patsubst %,%.deps,${DEPENDS}) $(patsubst %,%.deps.byte,${DEPENDS_BYTECODE})
2016-09-08 21:13:10 +04:00
@cat $^ > .depend
%.ml.deps: %.ml | predepend
@echo OCAMLDEP ${TARGET} $(notdir $^)
@$(OCAMLDEP) -native $(INCLUDES) $^ > $@
%.mli.deps: %.mli | predepend
@echo OCAMLDEP ${TARGET} $(notdir $^)
@$(OCAMLDEP) -native $(INCLUDES) $^ > $@
2016-12-02 02:20:23 +04:00
%.ml.deps.byte: %.ml | predepend
@echo OCAMLDEP ${TARGET} $(notdir $^)
@$(OCAMLDEP) $(INCLUDES) $^ > $@
%.mli.deps.byte: %.mli | predepend
@echo OCAMLDEP ${TARGET} $(notdir $^)
@$(OCAMLDEP) $(INCLUDES) $^ > $@
2016-09-08 21:13:10 +04:00
partial-clean::
2016-09-08 21:13:10 +04:00
-rm -f .depend
-find \( -name \*.mli.deps -or -name \*.ml.deps \) -delete