From 9b3678f8bd1a6878b577a4576b87f33c3a53309e Mon Sep 17 00:00:00 2001 From: Kakadu Date: Mon, 15 Feb 2021 21:34:23 +0300 Subject: [PATCH] Update compilation of tutorial and instruction in README Signed-off-by: Kakadu --- Makefile | 21 +++++++++------------ README.md | 4 ++-- src/Makefile | 2 +- tutorial/Makefile | 16 +++++++++++----- 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index e7e2e6eea..b92b9bbec 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,15 @@ EXECUTABLE = src/lamac INSTALL ?= install -v MKDIR ?= mkdir -SHELL := /bin/bash .PHONY: all regression all: - make -C src - make -C runtime - make -C stdlib + $(MAKE) -C src + $(MAKE) -C runtime + $(MAKE) -C stdlib STD_FILES=$(shell ls stdlib/*.[oi] stdlib/*.lama runtime/runtime.a runtime/Std.i) -#$(info $(STD_FILES)) install: all $(INSTALL) $(EXECUTABLE) `opam var bin` @@ -23,13 +21,12 @@ uninstall: $(RM) `opam var bin`/$(EXECUTABLE) regression: - make clean check -C regression - make clean check -C stdlib/regression + $(MAKE) clean check -C regression + $(MAKE) clean check -C stdlib/regression clean: - make clean -C src - make clean -C runtime - make clean -C stdlib - make clean -C regression + $(MAKE) clean -C src + $(MAKE) clean -C runtime + $(MAKE) clean -C stdlib + $(MAKE) clean -C regression $(MAKE) clean -C bench - diff --git a/README.md b/README.md index 122264f26..4caea9aaf 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,6 @@ Windows users should get Windows Subsystem for Linux a.k.a WSL (recommended) or /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/`. diff --git a/src/Makefile b/src/Makefile index af5d51222..710fb359f 100644 --- a/src/Makefile +++ b/src/Makefile @@ -24,7 +24,7 @@ $(TOPFILE).byte: $(SOURCES:.ml=.cmo) $(OCAMLC) -o $(TOPFILE).byte $(BFLAGS) -linkpkg $(SOURCES:.ml=.cmo) clean: - rm -Rf *.cmi *.cmo *.cmx *.annot *.o *.opt *.byte *~ .depend + $(RM) $(TOPFILE) *.cm[ioxa] *.annot *.o *.opt *.byte *~ .depend -include .depend # generic rules diff --git a/tutorial/Makefile b/tutorial/Makefile index 014b24f20..9f879e826 100644 --- a/tutorial/Makefile +++ b/tutorial/Makefile @@ -1,13 +1,19 @@ -SHELL := /bin/bash - FILES=$(wildcard *.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 $(LAMAC) $< clean: - rm -Rf *.s *.o *.i *~ $(ALL) + $(RM) -R *.s *.o *.i *~ $(ALL)