MAIN=qmcchem # Main program to build PACKAGES=-package core,pa_sexp_conv,cryptokit,str,ZMQ # 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 LINK_FLAGS= # 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 command = ninja -f $GENERATED_NINJA -t clean ; rm -f $GENERATED_NINJA rm -f *.cmx *.cmi *.o .ls_md5 ; ninja -t clean 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 command = ocamlfind ocamlopt $OCAMLC_FLAGS $THREAD -linkpkg $PACKAGES $PACKAGES $SYNTAX -o $out $in description = Compiling $out (native) rule create_qptypes command = ./$in description = Creating $out rule copy command = cp $in $out description = Copying $in to $out build always: phony build $GENERATED_NINJA: run_ninja_ocaml | Qptypes.ml ezfio.ml always build ezfio.ml: copy ../EZFIO/Ocaml/ezfio.ml 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 build clean: run_clean build $MAIN: run_ninja | ezfio.ml Qptypes.ml $GENERATED_NINJA target = $MAIN build all: run_ninja | ezfio.ml Qptypes.ml $GENERATED_NINJA target = default $MAIN