-UNAME:=$(shell uname -m)
-ifeq (x86_64,$(UNAME))
- export EXTRA_LDFLAGS=-m32 -shared
- export EXTRA_CFLAGS+=-m32
+UNAME:=$(shell uname -s)
+DEST=$(SBCL_PWD)/obj/sbcl-home/contrib/
+FASL=$(DEST)/$(SYSTEM).fasl
+ASD=$(DEST)/$(SYSTEM).asd
+
+ifeq (SunOS,$(UNAME))
+ EXTRA_CFLAGS=-D_XOPEN_SOURCE=500 -D__EXTENSIONS__
+ PATH:=/usr/xpg4/bin:${PATH}
+endif
+ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
+ EXTRA_CFLAGS=-mno-cygwin
+ # GCC 4.x doesn't accept -mno-cygwin.
+ CC:=gcc-3
+ # SBCL can't read cygwin symlinks, and cygwin likes to symlink
+ # gcc. To further complicate things, SBCL can't handle cygwin
+ # paths, either.
+ CC:=$(shell cygpath -m $(shell readlink -fn $(shell which $(CC))))
+endif
+ifeq (Linux,$(UNAME))
+ EXTRA_CFLAGS=-D_GNU_SOURCE