2014-08-26 14:39:23 +02:00
|
|
|
#TODO : Opam auto-installer in makefile
|
|
|
|
|
2014-08-24 20:00:26 +02:00
|
|
|
# Check if QPACKAGE_ROOT is defined
|
|
|
|
|
|
|
|
ifndef QPACKAGE_ROOT
|
|
|
|
$(info -------------------- Error --------------------)
|
|
|
|
$(info QPACKAGE_ROOT undefined. Source the quantum_package.rc script)
|
|
|
|
$(info -----------------------------------------------)
|
|
|
|
$(error )
|
|
|
|
endif
|
|
|
|
|
2014-08-26 15:31:16 +02:00
|
|
|
|
2014-08-13 17:54:32 +02:00
|
|
|
LIBS=
|
|
|
|
PKGS=
|
2014-09-18 17:01:43 +02:00
|
|
|
OCAMLCFLAGS=-g
|
2014-09-17 23:47:13 +02:00
|
|
|
OCAMLBUILD=ocamlbuild -j 0 -cflags $(OCAMLCFLAGS) -lflags -g
|
2014-09-16 23:17:22 +02:00
|
|
|
MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml
|
2014-08-24 20:00:26 +02:00
|
|
|
MLIFILES=$(wildcard *.mli)
|
|
|
|
ALL_TESTS=$(patsubst %.ml,%.byte,$(wildcard test_*.ml))
|
2014-09-16 18:58:42 +02:00
|
|
|
ALL_EXE=$(patsubst %.ml,%.native,$(wildcard qp_*.ml))
|
2014-08-13 17:54:32 +02:00
|
|
|
|
2014-09-17 00:39:21 +02:00
|
|
|
.PHONY: executables default
|
2014-08-13 17:54:32 +02:00
|
|
|
|
2014-09-17 00:39:21 +02:00
|
|
|
default: $(ALL_TESTS) $(ALL_EXE)
|
2014-08-26 15:31:16 +02:00
|
|
|
|
2014-09-16 18:58:42 +02:00
|
|
|
executables: $(ALL_EXE)
|
2014-08-13 17:54:32 +02:00
|
|
|
|
2014-08-24 20:00:26 +02:00
|
|
|
%.inferred.mli: $(MLFILES)
|
2014-09-17 23:47:13 +02:00
|
|
|
$(OCAMLBUILD) $*.inferred.mli -use-ocamlfind $(PKGS)
|
|
|
|
mv _build/$*.inferred.mli .
|
2014-08-13 17:54:32 +02:00
|
|
|
|
2014-08-24 20:00:26 +02:00
|
|
|
%.byte: $(MLFILES) $(MLIFILES)
|
2014-10-07 14:45:44 +02:00
|
|
|
rm -f -- $*
|
2014-08-13 17:54:32 +02:00
|
|
|
$(OCAMLBUILD) $*.byte -use-ocamlfind $(PKGS)
|
2014-10-07 14:45:44 +02:00
|
|
|
ln -s $*.native $*
|
2014-08-13 17:54:32 +02:00
|
|
|
|
2014-08-24 20:00:26 +02:00
|
|
|
%.native: $(MLFILES) $(MLIFILES)
|
2014-10-07 14:45:44 +02:00
|
|
|
rm -f -- $*
|
2014-08-13 17:54:32 +02:00
|
|
|
$(OCAMLBUILD) $*.native -use-ocamlfind $(PKGS)
|
2014-10-07 14:45:44 +02:00
|
|
|
ln -s $*.native $*
|
2014-08-13 17:54:32 +02:00
|
|
|
|
2014-08-24 20:00:26 +02:00
|
|
|
ezfio.ml: ${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml
|
|
|
|
cp ${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml .
|
|
|
|
|
2014-08-26 15:31:16 +02:00
|
|
|
qptypes_generator.byte: qptypes_generator.ml
|
|
|
|
$(OCAMLBUILD) qptypes_generator.byte -use-ocamlfind
|
|
|
|
|
2014-09-17 00:39:21 +02:00
|
|
|
Qptypes.ml: qptypes_generator.byte
|
2014-09-16 23:17:22 +02:00
|
|
|
./qptypes_generator.byte > Qptypes.ml
|
2014-08-26 15:31:16 +02:00
|
|
|
rm qptypes_generator.byte
|
|
|
|
|
2014-08-24 20:00:26 +02:00
|
|
|
${QPACKAGE_ROOT}/EZFIO/Ocaml/ezfio.ml:
|
|
|
|
$(MAKE) -C ${QPACKAGE_ROOT}/src ezfio
|
|
|
|
|
2014-08-13 17:54:32 +02:00
|
|
|
clean:
|
2014-09-16 18:58:42 +02:00
|
|
|
rm -rf _build *.native *.byte
|