ligo/test/Makefile.shared

91 lines
2.6 KiB
Makefile

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/%: ${MINUTILSLIB}
${SRCDIR}/utils/%: ${UTILSLIB}
${SRCDIR}/compiler/%: ${COMPILERLIB}
${SRCDIR}/node/%: ${NODELIB}
${SRCDIR}/client/%: ${CLIENTLIB}
############################################################################
## 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
-include .depend
.depend: $(shell find . -name \*.ml -or -name \*.ml)
@echo OCAMLDEP "(test/$(notdir $(shell echo $$PWD)))"
@$(OCAMLDEP) -native $(INCLUDES) $^ > .depend
clean::
-rm .depend