mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Resolved #26, shared libs work on linux
This commit is contained in:
@@ -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!
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user