10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-24 13:23:41 +01:00
quantum_package/ocaml/Makefile

83 lines
2.3 KiB
Makefile
Raw Normal View History

2015-01-06 19:12:17 +01:00
.NOPARALLEL:
2015-06-08 15:16:28 +02:00
# Check if QP_ROOT is defined
ifndef QP_ROOT
2014-08-24 20:00:26 +02:00
$(info -------------------- Error --------------------)
2015-06-08 15:16:28 +02:00
$(info QP_ROOT undefined. Source the quantum_package.rc script)
2014-08-24 20:00:26 +02:00
$(info -----------------------------------------------)
$(error )
endif
2014-08-26 15:31:16 +02:00
2014-08-13 17:54:32 +02:00
LIBS=
PKGS=
2014-11-12 17:17:44 +01:00
OCAMLCFLAGS="-g -warn-error A"
OCAMLBUILD=ocamlbuild -j 0 -syntax camlp4o -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS)
2015-06-03 13:23:10 +02:00
MLFILES=$(wildcard *.ml) ezfio.ml Qptypes.ml Input_auto_generated.ml qp_edit.ml
2014-08-24 20:00:26 +02:00
MLIFILES=$(wildcard *.mli)
ALL_TESTS=$(patsubst %.ml,%.byte,$(wildcard test_*.ml))
2015-06-03 13:23:10 +02:00
ALL_EXE=$(patsubst %.ml,%.native,$(wildcard qp_*.ml)) qp_edit.native
2014-08-13 17:54:32 +02:00
.PHONY: executables default remake_executables
2014-08-13 17:54:32 +02:00
default: $(ALL_TESTS) $(ALL_EXE) .gitignore
.gitignore: $(MLFILES)
@for i in .gitignore ezfio.ml Qptypes.ml qptypes_generator.byte _build $(ALL_EXE) $(ALL_TESTS) \
2015-04-13 11:21:20 +02:00
$(patsubst %.ml,%,$(wildcard test_*.ml)) $(patsubst %.ml,%,$(wildcard qp_*.ml)) \
$(shell grep Input Input_auto_generated.ml | awk '{print $$2 ".ml"}') \
2015-06-03 13:23:10 +02:00
qp_edit.ml qp_edit qp_edit.native Input_auto_generated.ml;\
2015-04-13 11:21:20 +02:00
do \
echo $$i ; \
2015-10-17 15:54:29 +02:00
done |sort | uniq > .gitignore
2014-08-26 15:31:16 +02:00
2015-06-08 15:16:28 +02:00
executables: $(QP_ROOT)/data/executables
2015-03-26 02:03:01 +01:00
$(QP_ROOT)/data/executables: remake_executables
2015-06-08 15:16:28 +02:00
$(QP_ROOT)/scripts/module/create_executables_list.sh
2014-08-13 17:54:32 +02:00
external_libs:
opam install cryptokit core
2014-10-27 01:23:04 +01:00
qpackage.odocl: $(MLIFILES)
ls $(MLIFILES) | sed "s/\.mli//" > qpackage.odocl
doc: qpackage.odocl
$(OCAMLBUILD) qpackage.docdir/index.html -use-ocamlfind $(PKGS)
2014-10-27 01:14:18 +01: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)
rm -f -- $*
2014-08-13 17:54:32 +02:00
$(OCAMLBUILD) $*.byte -use-ocamlfind $(PKGS)
2014-10-07 19:33:11 +02:00
ln -s $*.byte $*
2014-08-13 17:54:32 +02:00
2015-03-26 23:38:40 +01:00
qp_run.native: $(MLFILES) $(MLIFILES) executables
%.native: $(MLFILES) $(MLIFILES)
rm -f -- $*
2014-08-13 17:54:32 +02:00
$(OCAMLBUILD) $*.native -use-ocamlfind $(PKGS)
ln -s $*.native $*
2014-08-13 17:54:32 +02:00
2015-06-08 18:13:51 +02:00
ezfio.ml: ${QP_ROOT}/install/EZFIO/Ocaml/ezfio.ml
cp ${QP_ROOT}/install/EZFIO/Ocaml/ezfio.ml .
2015-05-26 16:08:52 +02:00
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
./qptypes_generator.byte > Qptypes.ml
2014-08-26 15:31:16 +02:00
2015-06-08 18:13:51 +02:00
${QP_ROOT}/install/EZFIO/Ocaml/ezfio.ml:
2015-06-11 16:25:35 +02:00
$(NINJA) -C ${QP_ROOT}/install/EZFIO
2015-05-26 16:08:52 +02:00
2015-06-03 13:23:10 +02:00
Input_auto_generated.ml qp_edit.ml:
2015-06-02 15:47:24 +02:00
ei_handler.py ocaml_global
2014-08-13 17:54:32 +02:00
clean:
2015-06-02 15:47:24 +02:00
rm -rf _build Qptypes.ml Input_auto_generated.ml $(ALL_EXE) $(ALL_TESTS)