10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-11-13 09:33:39 +01:00
qmcchem/ocaml/build.ninja

84 lines
2.3 KiB
Plaintext
Raw Normal View History

2015-12-20 01:25:51 +01:00
MAIN=qmcchem
# Main program to build
2016-03-17 15:32:17 +01:00
PACKAGES=-package core,pa_sexp_conv,cryptokit,str,ZMQ
2015-12-20 01:25:51 +01:00
# Required opam packages, for example:
# PACKAGES=-package core,sexplib.syntax
THREAD=-thread
# If you need threding support, use:
# THREAD=-thread
SYNTAX=-syntax camlp4o
# If you need pre-processing, use:
# SYNTAX=-syntax camlp4o
OCAMLC_FLAGS=-g -warn-error A
# Flags to give to ocamlc, for example:
# OCAMLC_FLAGS=-g -warn-error A
2015-12-29 02:19:08 +01:00
LINK_FLAGS=
2015-12-20 01:25:51 +01:00
# Flags to give to the linker, for example:
# LINK_FLAGS=-cclib '-Wl,-rpath=../lib,--enable-new-dtags'
GENERATED_NINJA=generated.ninja
# Name of the auto-generated ninja file
rule run_ninja
command = ../scripts/compile_ocaml.sh $target
description = Compiling OCaml executables
pool = console
rule run_ninja_ocaml
command = ../scripts/compile_ocaml_dep.sh
description = Finding dependencies in OCaml files
rule run_clean
2015-12-29 02:19:08 +01:00
command = ninja -f $GENERATED_NINJA -t clean ; rm -f $GENERATED_NINJA rm -f *.cmx *.cmi *.o .ls_md5 ; ninja -t clean
2015-12-20 01:25:51 +01:00
pool = console
description = Cleaning directory
rule ocamlc
command = ocamlfind ocamlc -c $OCAMLC_FLAGS $THREAD $PACKAGES $SYNTAX -o $out $in
description = Compiling $in (bytecode)
rule ocamlopt
command = ocamlfind ocamlopt -c $OCAMLC_FLAGS $THREAD $PACKAGES $SYNTAX -o $out $in
description = Compiling $in (native)
rule ocamlc_link
command = ocamlfind ocamlc $OCAMLC_FLAGS $THREAD $LINK_FLAGS $PACKAGES $SYNTAX -o $out $in
description = Compiling $out (bytecode)
rule ocamlopt_link
2015-12-29 02:19:08 +01:00
command = ocamlfind ocamlopt $OCAMLC_FLAGS $THREAD -linkpkg $PACKAGES $PACKAGES $SYNTAX -o $out $in
2015-12-20 01:25:51 +01:00
description = Compiling $out (native)
rule create_qptypes
command = ./$in
description = Creating $out
rule copy
command = cp $in $out
description = Copying $in to $out
2015-12-29 02:19:08 +01:00
build always: phony
build $GENERATED_NINJA: run_ninja_ocaml | Qptypes.ml ezfio.ml always
2015-12-20 01:25:51 +01:00
build ezfio.ml: copy ../EZFIO/Ocaml/ezfio.ml
2015-12-29 02:19:08 +01:00
build Qptypes.ml: create_qptypes qptypes_generator | ezfio.ml
build qptypes_generator.o qptypes_generator.cmx: ocamlopt qptypes_generator.ml | ezfio.ml
build qptypes_generator: ocamlopt_link qptypes_generator.cmx
2015-12-20 01:25:51 +01:00
build clean: run_clean
2015-12-29 02:19:08 +01:00
build $MAIN: run_ninja | ezfio.ml Qptypes.ml $GENERATED_NINJA
2015-12-20 01:25:51 +01:00
target = $MAIN
2015-12-29 02:19:08 +01:00
build all: run_ninja | ezfio.ml Qptypes.ml $GENERATED_NINJA
2015-12-20 01:25:51 +01:00
target =
default $MAIN