diff --git a/README.md b/README.md index 9bb391c..b97dbec 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,9 @@ Special thanks to http://craftinginterpreters.com/ for their fantastic book that ## Building -For Windows and MacOS, simply run `make` in the root directory. +For Windows, Linux and MacOS, simply run `make` in the root directory. -For Linux, run `make repl-static` in the root directory (see [this issue for details](https://github.com/Ratstail91/Toy/issues/26)). +Note: For Linux, you may need to `cd` into the `out` directory before running. Note: MacOS is not officially supported (no machines for testing), but we'll do our best! diff --git a/repl/makefile b/repl/makefile index 494cd56..640ef56 100644 --- a/repl/makefile +++ b/repl/makefile @@ -15,7 +15,7 @@ ifeq ($(shell uname),Darwin) cp $(PWD)/$(TOY_OUTDIR)/lib$(OUTNAME).dylib /usr/local/lib/ $(CC) -DTOY_IMPORT $(CFLAGS) -o $(OUT) $(OBJ) $(LIBS) else - $(CC) -DTOY_IMPORT $(CFLAGS) -o $(OUT) $(OBJ) -L$(realpath $(shell pwd)/../$(TOY_OUTDIR)) $(LIBS) + $(CC) -DTOY_IMPORT $(CFLAGS) -o $(OUT) $(OBJ) -Wl,-rpath,. -L$(realpath $(shell pwd)/../$(TOY_OUTDIR)) $(LIBS) endif $(OBJ): | $(ODIR) diff --git a/source/makefile b/source/makefile index b2bfdde..635313e 100644 --- a/source/makefile +++ b/source/makefile @@ -16,7 +16,7 @@ ifeq ($(findstring CYGWIN, $(shell uname)),CYGWIN) else ifeq ($(shell uname),Linux) #I can't get this working as a shared lib LIBLINE=-Wl,--out-implib=../$(TOY_OUTDIR)/lib$(OUTNAME).a -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive - OUT=../$(TOY_OUTDIR)/$(OUTNAME) + OUT=../$(TOY_OUTDIR)/lib$(OUTNAME).so CFLAGS += -fPIC else ifeq ($(OS),Windows_NT) LIBLINE =-Wl,--out-implib=../$(TOY_OUTDIR)/lib$(OUTNAME).dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive $(OBJ) -Wl,--no-whole-archive