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 9e2efce4a..419075f59 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ the domain of programming languages, compilers and tools. Its general characteri * with automatic memory management (garbage collection). The name ![lama](lama.png) is an acronym for *Lambda-Algol* since the language has borrowed the syntactic shape of -operators from **Algol-68**; [**Haskell**](www.haskell.org) and [**OCaml**](www.ocaml.org) can be +operators from **Algol-68**; [**Haskell**](http://www.haskell.org) and [**OCaml**](http://ocaml.org) can be mentioned as other languages of inspiration. The main purpose of ![lama](lama.png) is to present a repertoire of constructs with certain runtime behavior and @@ -52,6 +52,12 @@ Windows users should get Windows Subsystem for Linux a.k.a WSL (recommended) or * System-wide prerequisites: - `sudo apt install gcc-multilib` (in Debian-based GNU/Linux) + + On some versions you need to install additional package `lib32gcc-9-dev` in case of errors like + ``` + /usr/bin/ld: cannot find -lgcc + /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/9/libgcc.a when searching for -lgcc + ``` - [opam](http://opam.ocaml.org) (>= 2.0.4) - [OCaml](http://ocaml.org) (>= 4.10.1). *Optional* because it can be easily installed through opam. Compiler variant with `flambda` switch is recommended @@ -98,6 +104,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/runtime/Makefile b/runtime/Makefile index 457906978..27657559f 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -1,12 +1,12 @@ + all: gc_runtime.o runtime.o - ar rc runtime.a gc_runtime.o runtime.o + ar rc runtime.a gc_runtime.o runtime.o gc_runtime.o: gc_runtime.s - gcc -g -fstack-protector-all -m32 -c gc_runtime.s + $(CC) -g -fstack-protector-all -m32 -c gc_runtime.s runtime.o: runtime.c - gcc -g -fstack-protector-all -m32 -c runtime.c + $(CC) -g -fstack-protector-all -m32 -c runtime.c clean: - rm -f *.a *.o *~ - + $(RM) *.a *.o *~ 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)