Update compilation of tutorial and instruction in README

Signed-off-by: Kakadu <Kakadu@pm.me>
This commit is contained in:
Kakadu 2021-02-15 21:34:23 +03:00
parent 107a2e2061
commit 9b3678f8bd
4 changed files with 23 additions and 20 deletions

View file

@ -1,17 +1,15 @@
EXECUTABLE = src/lamac EXECUTABLE = src/lamac
INSTALL ?= install -v INSTALL ?= install -v
MKDIR ?= mkdir MKDIR ?= mkdir
SHELL := /bin/bash
.PHONY: all regression .PHONY: all regression
all: all:
make -C src $(MAKE) -C src
make -C runtime $(MAKE) -C runtime
make -C stdlib $(MAKE) -C stdlib
STD_FILES=$(shell ls stdlib/*.[oi] stdlib/*.lama runtime/runtime.a runtime/Std.i) STD_FILES=$(shell ls stdlib/*.[oi] stdlib/*.lama runtime/runtime.a runtime/Std.i)
#$(info $(STD_FILES))
install: all install: all
$(INSTALL) $(EXECUTABLE) `opam var bin` $(INSTALL) $(EXECUTABLE) `opam var bin`
@ -23,13 +21,12 @@ uninstall:
$(RM) `opam var bin`/$(EXECUTABLE) $(RM) `opam var bin`/$(EXECUTABLE)
regression: regression:
make clean check -C regression $(MAKE) clean check -C regression
make clean check -C stdlib/regression $(MAKE) clean check -C stdlib/regression
clean: clean:
make clean -C src $(MAKE) clean -C src
make clean -C runtime $(MAKE) clean -C runtime
make clean -C stdlib $(MAKE) clean -C stdlib
make clean -C regression $(MAKE) clean -C regression
$(MAKE) clean -C bench $(MAKE) clean -C bench

View file

@ -98,6 +98,6 @@ Windows users should get Windows Subsystem for Linux a.k.a WSL (recommended) or
/home/user/.opam/lama/bin/lamac /home/user/.opam/lama/bin/lamac
``` ```
### Smoke-testing: ### Smoke-testing (optional)
Clone the repository and run `make -C tutorial LAMAC=../src/lamac`. Without extra `LAMAC` switch it will try to use `lamac` installed system-wide to build tutorial. Clone the repository and run `make -C tutorial`. It should build local compiler `src/lamac` and a few tutorial executables in `tutorial/`.

View file

@ -24,7 +24,7 @@ $(TOPFILE).byte: $(SOURCES:.ml=.cmo)
$(OCAMLC) -o $(TOPFILE).byte $(BFLAGS) -linkpkg $(SOURCES:.ml=.cmo) $(OCAMLC) -o $(TOPFILE).byte $(BFLAGS) -linkpkg $(SOURCES:.ml=.cmo)
clean: clean:
rm -Rf *.cmi *.cmo *.cmx *.annot *.o *.opt *.byte *~ .depend $(RM) $(TOPFILE) *.cm[ioxa] *.annot *.o *.opt *.byte *~ .depend
-include .depend -include .depend
# generic rules # generic rules

View file

@ -1,13 +1,19 @@
SHELL := /bin/bash
FILES=$(wildcard *.lama) FILES=$(wildcard *.lama)
ALL=$(sort $(FILES:.lama=)) ALL=$(sort $(FILES:.lama=))
LAMAC=lamac EXTRA_TARGETS =
all: $(ALL) ifeq ($(LAMAC),)
LAMAC := ../src/lamac
EXTRA_TARGETS += $(LAMAC)
endif
all: $(EXTRA_TARGETS) $(ALL)
../src/lamac:
$(MAKE) -C ../src
%: %.lama %: %.lama
$(LAMAC) $< $(LAMAC) $<
clean: clean:
rm -Rf *.s *.o *.i *~ $(ALL) $(RM) -R *.s *.o *.i *~ $(ALL)