From ee2eb2bad10ad8d7c730538f239474ce103efa16 Mon Sep 17 00:00:00 2001 From: Alasdair Date: Fri, 8 Feb 2019 23:06:47 +0000 Subject: Cleanup src Makefile When we are building from git, we put the git version info in manifest.ml, so we'll get the following from sail -v Sail $last_git_tag ($branch @ $commit_sha) If we are be built from opam we can't assume we are in a git repository as opam downloads specific tags as tarballs, so instead we check for the precense of SHARE_DIR which is set by our opam build script, and instead output Sail 0.8 (sail2 @ opam) which is the next git tag (current is 0.7.1, this must be updated by hand), the branch name from which opam releases are generated and then opam rather than the commit SHA. I also removed the Makefile-non-opam file as it's bitrotted and unused --- src/Makefile | 39 ++++++++++----------------------------- 1 file changed, 10 insertions(+), 29 deletions(-) (limited to 'src/Makefile') diff --git a/src/Makefile b/src/Makefile index aeb23b9e..b0b22f77 100644 --- a/src/Makefile +++ b/src/Makefile @@ -62,16 +62,14 @@ endif endif -.PHONY: all sail coverage sail.native sail.byte manifest.ml test clean doc lib power test_power test_idempotence +.PHONY: all sail isail coverage sail.native sail.byte manifest.ml clean doc lib # set to -p on command line to enable gprof profiling OCAML_OPTS?= -SHARE_DIR?=$(realpath ..) - all: sail lib doc -full: sail lib power doc test +full: sail lib doc ast.lem: ../language/sail.ott ott -sort false -generate_aux_rules true -o ast.lem -picky_multiple_parses true ../language/sail.ott @@ -87,15 +85,19 @@ bytecode.ml: bytecode.lem lem -ocaml bytecode.lem -lib . -lib gen_lib/ sed -i.bak -f ast.sed bytecode.ml -lem_interp/interp_ast.lem: ../language/l2.ott - ott -sort false -generate_aux_rules true -o lem_interp/interp_ast.lem -picky_multiple_parses true ../language/l2.ott - manifest.ml: echo "(* Generated file -- do not edit. *)" > manifest.ml - echo let dir=\"$(SHARE_DIR)\" >> manifest.ml +ifndef SHARE_DIR + echo let dir=\"$(realpath ..)\" >> manifest.ml echo let commit=\"$(shell git rev-parse HEAD)\" >> manifest.ml echo let branch=\"$(shell git rev-parse --abbrev-ref HEAD)\" >> manifest.ml echo let version=\"$(shell git describe)\" >> manifest.ml +else + echo let dir=\"$(SHARE_DIR)\" >> manifest.ml + echo let commit=\"opam\" >> manifest.ml + echo let branch=\"sail2\" >> manifest.ml + echo let version=\"0.8\" >> manifest.ml +endif sail: ast.ml bytecode.ml manifest.ml ocamlbuild -use-ocamlfind sail.native sail_lib.cma sail_lib.cmxa @@ -115,31 +117,10 @@ interpreter: lem_interp/interp_ast.lem ocamlbuild -use-ocamlfind lem_interp/extract.cmxa ocamlbuild -use-ocamlfind lem_interp/extract.cma -test: sail interpreter - ocamlbuild -use-ocamlfind test/run_tests.native - ./run_tests.native - THIS_MAKEFILE := $(realpath $(lastword $(MAKEFILE_LIST))) SAIL_DIR:=$(realpath $(dir $(THIS_MAKEFILE))..) PROJECT_ROOT=$(realpath $(dir $(THIS_MAKEFILE))../..) -_build/sail_values.ml: gen_lib/sail_values.ml - $(CP_TO_BUILD) - -_build/power.ml: $(SAIL_DIR)/src/test/power.sail sail.native - cd _build; \ - ./sail.native -lem_ast -ocaml $< -o $(basename $(@)) - -_build/power.native: _build/sail_values.ml _build/power.ml - env OCAMLRUNPARAM=l=100M ocamlfind ocamlopt $(OCAML_OPTS) -g -package zarith -package unix -I _build -linkpkg $^ -o $@ - -_build/armv8_embed.ml: sail.native - make -C ../arm ocaml - cp ../arm/build/armv8_embed.ml $@ - -_build/arm.native: _build/sail_values.ml _build/armv8_embed.ml - env OCAMLRUNPARAM=l=100M ocamlfind ocamlopt $(OCAML_OPTS) -g -package zarith -package unix -I _build -linkpkg $^ -o $@ - clean: -ocamlbuild -clean -rm -rf _build *.native -- cgit v1.2.3