This commit is contained in:
Dmitry Boulytchev 2020-02-16 02:02:54 +03:00
parent 3b9fac8e9a
commit 83bd6d7ad8
5 changed files with 8 additions and 6 deletions

1
.gitignore vendored
View file

@ -3,4 +3,5 @@
*.cmx *.cmx
*.o *.o
version.ml version.ml
stdpath.ml

View file

@ -10,7 +10,7 @@ $(TESTS): %: %.lama
@echo $@ @echo $@
cat $@.input | $(LAMAC) -i $< > $@.log && diff $@.log orig/$@.log cat $@.input | $(LAMAC) -i $< > $@.log && diff $@.log orig/$@.log
cat $@.input | $(LAMAC) -s $< > $@.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: clean:
$(RM) test*.log *.s *~ $(TESTS) *.i $(RM) test*.log *.s *~ $(TESTS) *.i

View file

@ -2,16 +2,17 @@ TOPFILE = lamac
OCAMLC = ocamlfind c OCAMLC = ocamlfind c
OCAMLOPT = ocamlfind opt OCAMLOPT = ocamlfind opt
OCAMLDEP = ocamlfind dep 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 CAMLP5 = -syntax camlp5o -package ostap.syntax,GT.syntax.all
PXFLAGS = $(CAMLP5) PXFLAGS = $(CAMLP5)
BFLAGS = -rectypes -g BFLAGS = -rectypes -g
OFLAGS = $(BFLAGS) 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 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) .depend: $(SOURCES)
$(OCAMLDEP) $(PXFLAGS) *.ml > .depend $(OCAMLDEP) $(PXFLAGS) *.ml > .depend

View file

@ -692,7 +692,7 @@ let genasm cmd prog =
let get_std_path () = let get_std_path () =
match Sys.getenv_opt "LAMA" with match Sys.getenv_opt "LAMA" with
| Some s -> s | Some s -> s
| None -> "../runtime" | None -> Stdpath.path
(* Builds a program: generates the assembler file and compiles it with the gcc toolchain *) (* Builds a program: generates the assembler file and compiles it with the gcc toolchain *)
let build cmd prog = let build cmd prog =

View file

@ -17,7 +17,7 @@ Ostap.o: List.o Collection.o Ref.o Fun.o Matcher.o
Expr.o: Ostap.o Expr.o: Ostap.o
%.o: %.lama %.o: %.lama
$(LAMAC) -I . -c $< LAMA=../runtime $(LAMAC) -I . -c $<
clean: clean:
rm -Rf *.s *.o *.i *~ rm -Rf *.s *.o *.i *~