diff --git a/.gitignore b/.gitignore index 582087932..2bc3b6158 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ *.cmx *.o version.ml +stdpath.ml diff --git a/regression/Makefile b/regression/Makefile index d1e0fa455..44ef70f9f 100644 --- a/regression/Makefile +++ b/regression/Makefile @@ -10,7 +10,7 @@ $(TESTS): %: %.lama @echo $@ cat $@.input | $(LAMAC) -i $< > $@.log && diff $@.log orig/$@.log cat $@.input | $(LAMAC) -s $< > $@.log && diff $@.log orig/$@.log - $(LAMAC) $< && cat $@.input | ./$@ > $@.log && diff $@.log orig/$@.log + LAMA=../runtime $(LAMAC) $< && cat $@.input | ./$@ > $@.log && diff $@.log orig/$@.log clean: $(RM) test*.log *.s *~ $(TESTS) *.i diff --git a/src/Makefile b/src/Makefile index afd4e52f9..d44eb43b1 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2,16 +2,17 @@ TOPFILE = lamac OCAMLC = ocamlfind c OCAMLOPT = ocamlfind opt OCAMLDEP = ocamlfind dep -SOURCES = Language.ml SM.ml X86.ml version.ml Driver.ml +SOURCES = version.ml stdpath.ml Language.ml SM.ml X86.ml Driver.ml CAMLP5 = -syntax camlp5o -package ostap.syntax,GT.syntax.all PXFLAGS = $(CAMLP5) BFLAGS = -rectypes -g OFLAGS = $(BFLAGS) -all: version .depend $(TOPFILE) +all: metagen .depend $(TOPFILE) -version: +metagen: echo "let version = \"Version `git rev-parse --abbrev-ref HEAD`, `git rev-parse --short HEAD`, `git rev-parse --verify HEAD |git show --no-patch --no-notes --pretty='%cd'`\"" > version.ml + echo "let path = \"`opam var share`/Lama\"" > stdpath.ml .depend: $(SOURCES) $(OCAMLDEP) $(PXFLAGS) *.ml > .depend diff --git a/src/X86.ml b/src/X86.ml index 74e2673d8..130e48825 100644 --- a/src/X86.ml +++ b/src/X86.ml @@ -692,7 +692,7 @@ let genasm cmd prog = let get_std_path () = match Sys.getenv_opt "LAMA" with | Some s -> s - | None -> "../runtime" + | None -> Stdpath.path (* Builds a program: generates the assembler file and compiles it with the gcc toolchain *) let build cmd prog = diff --git a/stdlib/Makefile b/stdlib/Makefile index 9a595260b..2e632223a 100644 --- a/stdlib/Makefile +++ b/stdlib/Makefile @@ -17,7 +17,7 @@ Ostap.o: List.o Collection.o Ref.o Fun.o Matcher.o Expr.o: Ostap.o %.o: %.lama - $(LAMAC) -I . -c $< + LAMA=../runtime $(LAMAC) -I . -c $< clean: rm -Rf *.s *.o *.i *~