-UNAME:=$(shell uname -m)
-export CFLAGS=-fPIC
-ifeq (solaris,$(UNAME))
- export LDFLAGS=-shared -lresolv -lsocket -lnsl
-else
- ifeq (Darwin,$(UNAME))
- export LDFLAGS=-bundle
- else
- ifeq (x86_64,$(UNAME))
- export LDFLAGS=-m32 -shared
- export CFLAGS+= -m32
- else
- export LDFLAGS=-shared
- endif
- endif
+UNAME:=$(shell uname -s)
+
+ifeq (SunOS,$(UNAME))
+ EXTRA_CFLAGS=-D_XOPEN_SOURCE=500 -D__EXTENSIONS__
+endif
+ifeq (CYGWIN,$(findstring CYGWIN,$(UNAME)))
+ EXTRA_CFLAGS=-mno-cygwin
+ # 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))))