--- old/./Makefile	Fri Jul  3 01:10:29 2015
+++ new/./Makefile	Fri Jul  3 01:10:29 2015
@@ -18,38 +18,38 @@
 OBJS=$(SRCS:.c=.o)
 
 all: bin
-	make -C tests
+	$(MAKE) -C tests
 
 include s2n.mk
 
 libs:
-	make -C utils
-	make -C error
-	make -C stuffer
-	make -C crypto
-	make -C tls
-	make -C lib
+	$(MAKE) -C utils
+	$(MAKE) -C error
+	$(MAKE) -C stuffer
+	$(MAKE) -C crypto
+	$(MAKE) -C tls
+	$(MAKE) -C lib
 
 bin: libs
-	make -C bin
+	$(MAKE) -C bin
 
 indent:
-	make -C tests indentsource
-	make -C stuffer indentsource
-	make -C crypto indentsource
-	make -C utils indentsource
-	make -C error indentsource
-	make -C tls indentsource
-	make -C bin indentsource
+	$(MAKE) -C tests indentsource
+	$(MAKE) -C stuffer indentsource
+	$(MAKE) -C crypto indentsource
+	$(MAKE) -C utils indentsource
+	$(MAKE) -C error indentsource
+	$(MAKE) -C tls indentsource
+	$(MAKE) -C bin indentsource
 
 pre_commit_check: all indent clean
 
 clean:
-	make -C tests clean
-	make -C stuffer decruft
-	make -C crypto decruft
-	make -C utils decruft
-	make -C error decruft
-	make -C tls decruft
-	make -C bin decruft
-	make -C lib decruft
+	$(MAKE) -C tests clean
+	$(MAKE) -C stuffer decruft
+	$(MAKE) -C crypto decruft
+	$(MAKE) -C utils decruft
+	$(MAKE) -C error decruft
+	$(MAKE) -C tls decruft
+	$(MAKE) -C bin decruft
+	$(MAKE) -C lib decruft
--- old/bin/Makefile	Fri Jul  3 01:10:30 2015
+++ new/bin/Makefile	Fri Jul  3 01:10:30 2015
@@ -19,7 +19,7 @@
 ifeq ($(shell uname),Darwin)
     LIBS = 
 else
-    LIBS = -ldl -lrt -lpthread
+    LIBS = -ldl -lrt -lpthread -lsocket -lnsl
 endif
 
 LDFLAGS += -L../lib/ -ls2n ${LIBS}
--- old/bin/echo.c	Fri Jul  3 01:10:30 2015
+++ new/bin/echo.c	Fri Jul  3 01:10:30 2015
@@ -16,6 +16,7 @@
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/ioctl.h>
+#include <sys/filio.h>
 #include <sys/poll.h>
 #include <netdb.h>
 
@@ -22,6 +23,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <string.h>
+#include <stropts.h>
 #include <stdio.h>
 
 #include <errno.h>
--- old/lib/Makefile	Fri Jul  3 01:10:30 2015
+++ new/lib/Makefile	Fri Jul  3 01:10:30 2015
@@ -16,7 +16,7 @@
 ifeq ($(shell uname),Darwin)
     LIBS = -lc -lpthread
 else
-    LIBS = -lc -lpthread -lrt
+    LIBS = -lc -lpthread -lrt -lcrypto
 endif
 
 OBJS = $(wildcard ../utils/*.o ../stuffer/*.o ../tls/*.o ../iana/*.o ../crypto/*.o ../error/*.o ../libcrypto-root/lib/libcrypto.a)
@@ -28,8 +28,11 @@
 	ar cru libs2n.a ${OBJS}
 	ranlib libs2n.a
 
+#libs2n.so: ${OBJS}
+#	${CC} -shared ${LIBS} -o libs2n.so ${OBJS}
+
 libs2n.so: ${OBJS}
-	${CC} -shared ${LIBS} -o libs2n.so ${OBJS}
+	ld -shared ${LIBS} -o libs2n.so ${OBJS}
 
 libs2n.dylib: ${OBJS}
 	test ! -f /usr/lib/libSystem.dylib || libtool -dynamic ${LIBS} -o libs2n.dylib ${OBJS}
--- old/./s2n.mk	Fri Jul  3 01:10:30 2015
+++ new/./s2n.mk	Fri Jul  3 01:10:30 2015
@@ -18,8 +18,8 @@
 INDENT  = $(shell (if indent --version 2>&1 | grep GNU > /dev/null; then echo indent ; elif gindent --version 2>&1 | grep GNU > /dev/null; then echo gindent; else echo true ; fi ))
 
 CFLAGS = -pedantic -Wall -Werror -Wimplicit -Wunused -Wcomment -Wchar-subscripts -Wuninitialized \
-         -Wshadow -Wcast-qual -Wcast-align -Wwrite-strings -Wstack-protector -fPIC \
-         -std=c99 -D_POSIX_C_SOURCE=200112L -fstack-protector-all -O2 -I../libcrypto-root/include/ \
+         -Wshadow -Wcast-qual -Wcast-align -fPIC \
+         -std=c99 -D_POSIX_C_SOURCE=200112L -O2 -I../libcrypto-root/include/ \
          -I../api/ -I../ -Wno-deprecated-declarations -Wno-unknown-pragmas -Wformat-security \
          -D_FORTIFY_SOURCE=2
 
--- old/tests/Makefile	Fri Jul  3 01:10:30 2015
+++ new/tests/Makefile	Fri Jul  3 01:10:30 2015
@@ -14,11 +14,11 @@
 #
 
 all:
-	make -C testlib
-	make -C unit
+	$(MAKE) -C testlib
+	$(MAKE) -C unit
 
 include ../s2n.mk
 
 clean:
-	make -C testlib decruft
-	make -C unit decruft
+	$(MAKE) -C testlib decruft
+	$(MAKE) -C unit decruft
--- old/tls/s2n_recv.c	Fri Jul  3 01:10:30 2015
+++ new/tls/s2n_recv.c	Fri Jul  3 01:10:30 2015
@@ -14,7 +14,9 @@
  */
 
 /* Use usleep */
+#ifndef __sun
 #define _XOPEN_SOURCE 500
+#endif /* __sun doesn't need XOPEN_SOURCE defined for usleep() in unistd.h. */
 #include <unistd.h>
 
 #include <errno.h>
