diff --git a/Makefile b/Makefile index 5a6b8fc4..689db685 100644 --- a/Makefile +++ b/Makefile @@ -22,27 +22,12 @@ SNOW_CHIBI ?= tools/snow-chibi ######################################################################## -# Choose compiled library on MSYS -ifeq ($(OS), Windows_NT) -ifeq ($(PLATFORM),msys) -EXCLUDE_WIN32_LIBS=1 -else -ifeq ($(shell uname -o),Cygwin) -EXCLUDE_WIN32_LIBS=1 -else -EXCLUDE_POSIX_LIBS=1 -endif -endif -endif - -######################################################################## - CHIBI_COMPILED_LIBS = lib/chibi/filesystem$(SO) lib/chibi/weak$(SO) \ lib/chibi/heap-stats$(SO) lib/chibi/disasm$(SO) lib/chibi/ast$(SO) \ lib/chibi/json$(SO) lib/chibi/emscripten$(SO) CHIBI_POSIX_COMPILED_LIBS = lib/chibi/process$(SO) lib/chibi/time$(SO) \ lib/chibi/system$(SO) lib/chibi/stty$(SO) lib/chibi/pty$(SO) \ - lib/chibi/net$(SO) + lib/chibi/net$(SO) lib/srfi/18/threads$(SO) CHIBI_WIN32_COMPILED_LIBS = lib/chibi/win32/process-win32$(SO) CHIBI_CRYPTO_COMPILED_LIBS = lib/chibi/crypto/crypto$(SO) CHIBI_IO_COMPILED_LIBS = lib/chibi/io/io$(SO) @@ -50,12 +35,6 @@ CHIBI_OPT_COMPILED_LIBS = lib/chibi/optimize/rest$(SO) \ lib/chibi/optimize/profile$(SO) EXTRA_COMPILED_LIBS ?= -ifndef EXCLUDE_POSIX_LIBS -CHIBI_COMPILED_LIBS += $(CHIBI_POSIX_COMPILED_LIBS) -else -CHIBI_COMPILED_LIBS += $(CHIBI_WIN32_COMPILED_LIBS) -endif - COMPILED_LIBS = $(CHIBI_COMPILED_LIBS) $(CHIBI_IO_COMPILED_LIBS) \ $(CHIBI_OPT_COMPILED_LIBS) $(CHIBI_CRYPTO_COMPILED_LIBS) \ $(EXTRA_COMPILED_LIBS) \ @@ -64,10 +43,6 @@ COMPILED_LIBS = $(CHIBI_COMPILED_LIBS) $(CHIBI_IO_COMPILED_LIBS) \ lib/srfi/98/env$(SO) lib/srfi/144/math$(SO) lib/srfi/160/uvprims$(SO) \ lib/scheme/time$(SO) -ifndef EXCLUDE_POSIX_LIBS -COMPILED_LIBS += lib/srfi/18/threads$(SO) -endif - BASE_INCLUDES = include/chibi/sexp.h include/chibi/features.h include/chibi/install.h include/chibi/bignum.h INCLUDES = $(BASE_INCLUDES) include/chibi/eval.h include/chibi/gc_heap.h @@ -83,38 +58,11 @@ HTML_LIBS = $(MODULE_DOCS:%=doc/lib/chibi/%.html) META_FILES = lib/.chibi.meta lib/.srfi.meta lib/.scheme.meta ######################################################################## +# This includes the rules to build optional libraries. +# It also pulls in Makefile.detect for platform detection. include Makefile.libs -######################################################################## -# Library config. -# -# This is to allow "make SEXP_USE_BOEHM=1" and "make SEXP_USE_DL=0" to -# automatically include the necessary compiler and linker flags in -# addition to setting those features. If not using GNU make just -# comment out the ifs and use the else branches for the defaults. - -ifeq ($(SEXP_USE_BOEHM),1) -GCLDFLAGS := -lgc -XCPPFLAGS := $(CPPFLAGS) -Iinclude $(D:%=-DSEXP_USE_%) -DSEXP_USE_BOEHM=1 -else -GCLDFLAGS := -XCPPFLAGS := $(CPPFLAGS) -Iinclude $(D:%=-DSEXP_USE_%) -endif - -ifeq ($(SEXP_USE_DL),0) -XLDFLAGS := $(LDFLAGS) $(RLDFLAGS) $(GCLDFLAGS) -lm -XCFLAGS := -Wall -DSEXP_USE_DL=0 -g -g3 -O3 $(CFLAGS) -else -XLDFLAGS := $(LDFLAGS) $(RLDFLAGS) $(GCLDFLAGS) $(LIBDL) -lm -XCFLAGS := -Wall -g -g3 -O3 $(CFLAGS) -endif - -ifeq ($(PLATFORM),solaris) -XLDFLAGS += -lsocket -XCPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS -endif - ######################################################################## all: chibi-scheme$(EXE) all-libs chibi-scheme.pc $(META_FILES) diff --git a/Makefile.detect b/Makefile.detect index 3146f74d..7dfaa6bd 100644 --- a/Makefile.detect +++ b/Makefile.detect @@ -131,6 +131,59 @@ ifeq ($(PLATFORM),unix) RLDFLAGS=-Wl,-R$(LIBDIR) endif +######################################################################## +# Library config. +# +# This is to allow "make SEXP_USE_BOEHM=1" and "make SEXP_USE_DL=0" to +# automatically include the necessary compiler and linker flags in +# addition to setting those features. If not using GNU make just +# comment out the ifs and use the else branches for the defaults. + +ifeq ($(SEXP_USE_BOEHM),1) +GCLDFLAGS := -lgc +XCPPFLAGS := $(CPPFLAGS) -Iinclude $(D:%=-DSEXP_USE_%) -DSEXP_USE_BOEHM=1 +else +GCLDFLAGS := +XCPPFLAGS := $(CPPFLAGS) -Iinclude $(D:%=-DSEXP_USE_%) +endif + +ifeq ($(SEXP_USE_DL),0) +XLDFLAGS := $(LDFLAGS) $(RLDFLAGS) $(GCLDFLAGS) -lm +XCFLAGS := -Wall -DSEXP_USE_DL=0 -g -g3 -O3 $(CFLAGS) +else +XLDFLAGS := $(LDFLAGS) $(RLDFLAGS) $(GCLDFLAGS) $(LIBDL) -lm +XCFLAGS := -Wall -g -g3 -O3 $(CFLAGS) +endif + +ifeq ($(PLATFORM),solaris) +XLDFLAGS += -lsocket +XCPPFLAGS += -D_POSIX_PTHREAD_SEMANTICS +endif + +# Choose compiled library on MSYS +ifeq ($(OS), Windows_NT) +ifeq ($(PLATFORM),msys) +EXCLUDE_WIN32_LIBS=1 +else +ifeq ($(shell uname -o),Cygwin) +EXCLUDE_WIN32_LIBS=1 +else +EXCLUDE_POSIX_LIBS=1 +endif +endif +endif + +CHIBI_POSIX_COMPILED_LIBS = lib/chibi/process$(SO) lib/chibi/time$(SO) \ + lib/chibi/system$(SO) lib/chibi/stty$(SO) lib/chibi/pty$(SO) \ + lib/chibi/net$(SO) lib/srfi/18/threads$(SO) +CHIBI_WIN32_COMPILED_LIBS = lib/chibi/win32/process-win32$(SO) + +ifndef EXCLUDE_POSIX_LIBS +COMPILED_LIBS += $(CHIBI_POSIX_COMPILED_LIBS) +else +COMPILED_LIBS += $(CHIBI_WIN32_COMPILED_LIBS) +endif + ######################################################################## # Check for headers (who needs autoconf?) diff --git a/README.md b/README.md index d356e92f..6ed93b9a 100644 --- a/README.md +++ b/README.md @@ -12,22 +12,32 @@ allowing multiple VMs to run simultaneously in different OS threads. There are no external dependencies so is relatively easy to drop into any project. -The default repl language contains all bindings from -[R7RS small](http://trac.sacrideo.us/wg/wiki/R7RSHomePage), -available explicitly as the `(scheme small)` library. The -language is built in layers, however - see the manual for -instructions on compiling with fewer features or requesting -a smaller language on startup. +Despite the small size, Chibi-Scheme attempts to do The Right Thing. +The default settings include: + +* a full numeric tower, with rational and complex numbers +* full and seemless Unicode support +* low-level and high-level hygienic macros +* an extensible module system + +Specifically, the default repl language contains all bindings from +[R7RS small](https://small.r7rs.org/), available explicitly as the +`(scheme small)` library. The language is built in layers, however - +see the manual for instructions on compiling with fewer features or +requesting a smaller language on startup. Chibi-Scheme is known to work on **32** and **64-bit** Linux, FreeBSD, -NetBSD, OpenBSD and OS X, Plan 9, Windows (using Cygwin), iOS, Android, +NetBSD, OpenBSD and OS X, Plan 9, Windows, iOS, Android, ARM and [Emscripten](https://kripken.github.io/emscripten-site). Basic support for native Windows desktop also exists. See README-win32.md for details and build instructions. -To build on most platforms just run `make && make test`. This will -provide a shared library *libchibi-scheme*, as well as a sample -*chibi-scheme* command-line repl. You can then run +To build on most platforms just run `make && make test`. This has a +few conditionals assuming GNU make. If using another make, there are +a few parameters in Makefile.detect you need to set by hand. + +This will provide a shared library *libchibi-scheme*, as well as a +sample *chibi-scheme* command-line repl. You can then run sudo make install