ligo/src/client/embedded/Makefile.shared
2017-01-02 14:49:56 +01:00

130 lines
3.7 KiB
Makefile

all: \
../client_$(PROTO_VERSION).cmx \
../webclient_$(PROTO_VERSION).cmx
-include ../../../Makefile.local
include ../../../Makefile.config
NODE_DIRECTORIES = \
$(addprefix ../../../, \
minutils \
utils \
node/updater \
node/db \
node/net \
node/shell \
client \
)
SOURCE_DIRECTORIES += \
${NODE_DIRECTORIES} \
../../../proto
OPENED_MODULES := \
Client_embedded_proto_${PROTO_VERSION} \
Register_client_embedded_proto_${PROTO_VERSION} \
Error_monad \
Hash \
${OPENED_MODULES}
OBJS := \
${CLIENT_IMPLS:.ml=.cmx} ${CLIENT_INTFS:.mli=.cmi}
OBJS_DEPS := \
${CLIENT_IMPLS:.ml=.ml.deps} ${CLIENT_INTFS:.mli=.mli.deps}
${OBJS} ${OBJS_DEPS}: TARGET="(client_$(PROTO_VERSION).cmx)"
${OBJS}: EXTRA_OCAMLFLAGS = -for-pack Client_$(PROTO_VERSION)
../client_$(PROTO_VERSION).cmx: EXTRA_OCAMLFLAGS =
${OBJS} ${OBJS_DEPS} ../client_$(PROTO_VERSION).cmx: \
PACKAGES=lwt ocplib-json-typed config-file sodium ocplib-ocamlres
${OBJS} ${OBJS_DEPS} ../client_$(PROTO_VERSION).cmx: \
../../../proto/client_embedded_proto_${PROTO_VERSION}.cmxa
WEBOBJS := \
${WEBCLIENT_IMPLS:.ml=.cmx} ${WEBCLIENT_INTFS:.mli=.cmi}
WEBOBJS_DEPENDS := \
${WEBCLIENT_IMPLS:.ml=.ml.deps} ${WEBCLIENT_INTFS:.mli=.mli.deps}
${WEBOBJS} ${WEBOBJS_DEPS}: TARGET="(webclient_$(PROTO_VERSION).cmx)"
${WEBOBJS} ${WEBOBJS_DEPS}: SOURCE_DIRECTORIES += ..
${WEBOBJS} ${WEBOBJS_DEPS}: OPENED_MODULES += Client_${PROTO_VERSION}
${WEBOBJS}: EXTRA_OCAMLFLAGS = -for-pack Webclient_$(PROTO_VERSION)
../client_$(PROTO_VERSION).cmx: EXTRA_OCAMLFLAGS =
${WEBOBJS} ${WEBOBJS_DEPS} ../webclient_$(PROTO_VERSION).cmx: \
PACKAGES=lwt ocplib-json-typed config-file sodium ocplib-ocamlres
${WEBOBJS} ${WEBOBJS_DEPS} ../webclient_$(PROTO_VERSION).cmx: \
../../../proto/client_embedded_proto_${PROTO_VERSION}.cmxa
${WEBOBJS} ../webclient_$(PROTO_VERSION).cmx: \
../client_${PROTO_VERSION}.cmx
../client_$(PROTO_VERSION).cmx: $(patsubst %.ml, %.cmx, ${CLIENT_IMPLS})
@echo LINK $(notdir $@)
@$(OCAMLOPT) -linkall ${OCAMLFLAGS} -pack -o $@ \
$(patsubst %.ml, %.cmx, ${CLIENT_IMPLS})
../webclient_$(PROTO_VERSION).cmx: $(patsubst %.ml, %.cmx, ${WEBCLIENT_IMPLS})
@echo LINK $(notdir $@)
@$(OCAMLOPT) -linkall ${OCAMLFLAGS} -pack -o $@ \
$(patsubst %.ml, %.cmx, ${WEBCLIENT_IMPLS})
%.cmx: %.ml
@echo OCAMLOPT ${TARGET} $(notdir $@)
@$(OCAMLOPT) ${OCAMLFLAGS} -c $<
%.cmo: %.ml
@echo OCAMLC ${TARGET} $(notdir $@)
@$(OCAMLC) ${OCAMLFLAGS} -c $<
%.cmi: %.mli
@echo OCAMLOPT ${TARGET} $(notdir $@)
@$(OCAMLOPT) ${OCAMLFLAGS} -c $<
%.ml: %.mll
@echo OCAMLLEX ${TARGET} $(notdir $@)
@$(OCAMLLEX) $<
%.ml %.mli: %.mly
@echo MENHIR ${TARGET} $(notdir $@)
@$(MENHIR) --explain $<
.PHONY: clean
clean::
-rm -f ../client_$(PROTO_VERSION).cm* ../client_$(PROTO_VERSION).o
-rm -f ../webclient_$(PROTO_VERSION).cm* ../webclient_$(PROTO_VERSION).o
-rm -f *.cm* *~ *.o *.a *.deps *.deps.byte
-rm -rf _tzbuild
-rm -f .depend
ifneq ($(MAKECMDGOALS),clean)
include .depend
endif
predepend:
DEPENDS += \
$(patsubst %,%.deps,${CLIENT_INTFS} ${CLIENT_IMPLS}) \
$(patsubst %,%.deps,${WEBCLIENT_INTFS} ${WEBCLIENT_IMPLS})
DEPENDS := $(filter-out ${NODEPENDS}, ${DEPENDS})
.SECONDARY: ${DEPENDS}
.depend: ${DEPENDS}
@cat $^ > .depend
%.ml.deps: %.ml | predepend
@echo OCAMLDEP ${TARGET} $(notdir $<)
@$(OCAMLDEP) -native $(INCLUDES) ${EXTRA_OCAMLFLAGS} $< > $@
%.mli.deps: %.mli | predepend
@echo OCAMLDEP ${TARGET} $(notdir $<)
@$(OCAMLDEP) -native $(INCLUDES) ${EXTRA_OCAMLFLAGS} $< > $@
%.ml.deps.byte: %.ml | predepend
@echo OCAMLDEP ${TARGET} $(notdir $<)
@$(OCAMLDEP) $(INCLUDES) ${EXTRA_OCAMLFLAGS} $< > $@
%.mli.deps.byte: %.mli | predepend
@echo OCAMLDEP ${TARGET} $(notdir $<)
@$(OCAMLDEP) $(INCLUDES) ${EXTRA_OCAMLFLAGS} $< > $@