diff options
| author | Christopher | 2015-12-21 00:26:05 +0100 |
|---|---|---|
| committer | Christopher | 2015-12-21 00:26:05 +0100 |
| commit | 3b2484a8d10a35b31b6071e39fd2c3018b007b46 (patch) | |
| tree | 5140f78857680aa6fce48fcff946e0773045f2a9 /mips/Makefile | |
| parent | ce7431d8e452952329439564969f8b592a01563b (diff) | |
| parent | f7a642bd3f8a5436873d0163114a30dad23ba9c2 (diff) | |
Merge branch 'master' of https://bitbucket.org/Peter_Sewell/l2
Diffstat (limited to 'mips/Makefile')
| -rw-r--r-- | mips/Makefile | 74 |
1 files changed, 74 insertions, 0 deletions
diff --git a/mips/Makefile b/mips/Makefile new file mode 100644 index 00000000..7bd20737 --- /dev/null +++ b/mips/Makefile @@ -0,0 +1,74 @@ +BITBUCKETDIR= ~/bitbucket +SAILDIR=$(BITBUCKETDIR)/l2/ +SAIL=$(SAILDIR)/src/_build/sail.native +BUILDDIR=./build/ +LEMDIR=$(BITBUCKETDIR)/lem/ +LEM=$(LEMDIR)/lem + +# we need bash to use PIPESTATUS for the error parsing +# (if bash is not found the build will still work) +ifneq ("$(wildcard /bin/bash)","") +SHELL=/bin/bash +endif + + +# the order of the files is important +MIPSSOURCES= mips.sail + +all: $(BUILDDIR)mips.ml $(BUILDDIR)mips_extras.ml + +lem: $(BUILDDIR)mips.lem + +# this will force build everything, including the tools +full: + $(MAKE) -B + +test: $(BUILDDIR)/test.lem + +### tools: these will run only if the tools don't already exist or with 'make full' + +$(SAIL): + $(MAKE) -C $(SAILDIR) + +$(LEM): + $(MAKE) -C $(LEMDIR) + +### tools end + +$(BUILDDIR): + mkdir -p $@ + +$(BUILDDIR)mips.lem: $(MIPSSOURCES) $(SAIL) | $(BUILDDIR) +# if bash is detected we can print nicer errors +ifeq ($(SHELL),/bin/bash) +# the test at the end is so we return the exit code of sail and not parse_sail.sh + $(SAIL) -lem_ast $(MIPSSOURCES) 2>&1 | ./parse_sail.sh; test "$${PIPESTATUS[0]}" -eq 0 +else + $(SAIL) -lem_ast $(MIPSSOURCES) +endif +# sail uses the name of the first file on the list + @mv $(<:.sail=.lem) $(BUILDDIR)mips.lem + +$(BUILDDIR)mips.ml: $(BUILDDIR)mips.lem $(LEM) + $(LEM) -ocaml -only_changed_output -lib $(SAILDIR)/src/lem_interp/ $< +# FIXME: lem bug, does not change modification time + touch $@ + +$(BUILDDIR)mips_extras.ml: + cp mips_extras.lem $@ + $(LEM) -ocaml -only_changed_output -lib $(SAILDIR)/src/lem_interp/ $< + touch $@ + +$(BUILDDIR)/test.lem: test.sail $(SAIL) | $(BUILDDIR) +# if bash is detected we can print nicer errors +ifeq ($(SHELL),/bin/bash) +# the test at the end is so we return the exit code of sail and not parse_sail.sh + $(SAIL) -lem_ast test.sail 2>&1 | ./parse_sail.sh; test "$${PIPESTATUS[0]}" -eq 0 +else + $(SAIL) -lem_ast test.sail +endif + +clean: + rm -rf $(BUILDDIR) + +.PHONY: all full clean test |
