ligo/test/Makefile.shared

118 lines
3.7 KiB
Makefile
Raw Normal View History

2017-04-05 20:24:26 +04:00
ifeq ($(strip ${SRCDIR}),)
$(error "Undefined value for $${SRCDIR}")
endif
.PHONY: build run
all:
@${MAKE} --no-print-directory build
@${MAKE} --no-print-directory run
build: ${addprefix test-,${TESTS}}
run:
@$(patsubst %,${MAKE} --no-print-directory run-test-% && , ${TESTS}) \
echo && echo "Success" && echo
############################################################################
-include ${SRCDIR}/Makefile.local
include ${SRCDIR}/Makefile.config
include ${SRCDIR}/Makefile.files
COVERAGESRCDIR=$(patsubst %, -I %, $(SOURCE_DIRECTORIES))
############################################################################
## External packages
############################################################################
TESTLIB := ${SRCDIR}/../test/lib/testlib.cmxa
${TESTLIB}: $(shell find ${SRCDIR}/../test/lib -name \*.ml -or -name \*.mli)
${MAKE} -C ${SRCDIR}/../test/lib testlib.cmxa
############################################################################
## External packages
############################################################################
MINUTILSLIB := ${SRCDIR}/minutils.cmxa
UTILSLIB := ${SRCDIR}/utils.cmxa
COMPILERLIB := ${SRCDIR}/compiler.cmxa
NODELIB := ${SRCDIR}/node.cmxa
CLIENTLIB := ${SRCDIR}/client.cmxa \
$(patsubst ${SRCDIR}/client/embedded/%/, \
${SRCDIR}/proto/client_embedded_proto_%.cmxa, \
$(shell ls -d ${SRCDIR}/client/embedded/*/)) \
$(patsubst ${SRCDIR}/client/embedded/%/, \
${SRCDIR}/client/embedded/client_%.cmx, \
$(shell ls -d ${SRCDIR}/client/embedded/*/))
${MINUTILSLIB} ${UTILSLIB} ${COMPILERLIB} ${NODELIB} ${CLIENTLIB}:
${MAKE} -C ${SRCDIR} $@
${SRCDIR}/minutils/%.cmi: ${SRCDIR}/minutils/%.mli
${MAKE} -C ${SRCDIR} minutils.cmxa
${SRCDIR}/minutils/%.cmx : ${SRCDIR}/minutils/%.ml
${MAKE} -C ${SRCDIR} minutils.cmxa
${SRCDIR}/utils/%.cmi: ${SRCDIR}/utils/%.mli
${MAKE} -C ${SRCDIR} utils.cmxa
${SRCDIR}/utils/%.cmx : ${SRCDIR}/utils/%.ml
${MAKE} -C ${SRCDIR} utils.cmxa
${SRCDIR}/compiler/%.cmi: ${SRCDIR}/compiler/%.mli
${MAKE} -C ${SRCDIR} compiler.cmxa
${SRCDIR}/compiler/%.cmx : ${SRCDIR}/compiler/%.ml
${MAKE} -C ${SRCDIR} compiler.cmxa
${SRCDIR}/node/db/%.cmi: ${SRCDIR}/node/db/%.mli
${MAKE} -C ${SRCDIR} node.cmxa
${SRCDIR}/node/db/%.cmx : ${SRCDIR}/node/db/%.ml
${MAKE} -C ${SRCDIR} node.cmxa
${SRCDIR}/node/net/%.cmi: ${SRCDIR}/node/net/%.mli
${MAKE} -C ${SRCDIR} node.cmxa
${SRCDIR}/node/net/%.cmx : ${SRCDIR}/node/net/%.ml
${MAKE} -C ${SRCDIR} node.cmxa
${SRCDIR}/node/shell/%.cmi: ${SRCDIR}/node/shell/%.mli
${MAKE} -C ${SRCDIR} node.cmxa
${SRCDIR}/node/shell/%.cmx : ${SRCDIR}/node/shell/%.ml
${MAKE} -C ${SRCDIR} node.cmxa
${SRCDIR}/node/updater/%.cmi: ${SRCDIR}/node/updater/%.mli
${MAKE} -C ${SRCDIR} node.cmxa
${SRCDIR}/node/updater/%.cmx : ${SRCDIR}/node/updater/%.ml
${MAKE} -C ${SRCDIR} node.cmxa
${SRCDIR}/client/%.cmi: ${SRCDIR}/client/%.mli
${MAKE} -C ${SRCDIR} client.cmxa
${SRCDIR}/client/%.cmx : ${SRCDIR}/client/%.ml
${MAKE} -C ${SRCDIR} client.cmxa
2017-04-05 20:24:26 +04:00
############################################################################
## Generic rules
############################################################################
%.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 $<
## 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
2017-04-05 20:24:26 +04:00
-include .depend
.depend: $(shell find . -name \*.mli -or -name \*.ml)
2017-04-05 20:24:26 +04:00
@echo OCAMLDEP "(test/$(notdir $(shell echo $$PWD)))"
@$(OCAMLDEP) -native $(INCLUDES) $^ > .depend
clean::
-rm .depend