diff -Naur a/Makefile b/Makefile
--- a/Makefile	2019-08-03 10:48:42.000000000 -0700
+++ b/Makefile	2020-03-01 19:26:14.000000000 -0800
@@ -1,21 +1,17 @@
-OS = windows
+OS = linux
 BUILD_TYPE = release_static
 
 OUTPUT := ps3netsrv
 OBJS = src/main.o src/compat.o src/File.o src/VIsoFile.o
 
-CFLAGS = -Wall -I./include -I./polarssl-1.3.2/include -std=gnu99 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL
-CPPFLAGS += -Wall -I./include -I./polarssl-1.3.2/include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -DPOLARSSL
-
-#CFLAGS += -DNOSSL
-#CPPFLAGS +=-DNOSSL
-
-LDFLAGS = -L. -L./polarssl-1.3.2/library
-LIBS = -lstdc++ -lpolarssl
+CFLAGS = -Wall -I./include -std=gnu99 -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
+CPPFLAGS = -Wall -I./include -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 
+LDFLAGS = -L.
+LIBS = -lstdc++
 
 ifeq ($(OS), linux)
-LIBS += -lpthread
+LIBS += -lpthread -lgcc_eh
 endif
 
 ifeq ($(OS), windows)
@@ -37,28 +33,82 @@ endif
 ifeq ($(BUILD_TYPE), debug)
 CFLAGS += -O0 -g3 -DDEBUG
 CPPFLAGS += -O0 -g3 -DDEBUG
+LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
+endif
+
+ifeq ($(BUILD_TYPE), debug_nossl)
+CFLAGS += -O0 -g3 -DDEBUG -DNOSSL
+CPPFLAGS += -O0 -g3 -DDEBUG -DNOSSL
+endif
+
+ifeq ($(BUILD_TYPE), debug_polar)
+CFLAGS += -O0 -g3 -DDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
+CPPFLAGS += -O0 -g3 -DDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
+LDFLAGS += -L./polarssl-1.3.2/library
+LIBS += -lpolarssl
 endif
 
 ifeq ($(BUILD_TYPE), debug_static)
 CFLAGS += -O0 -static -g3 -DDEBUG
 CPPFLAGS += -O0 -static -g3 -DDEBUG
+LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
+endif
+
+ifeq ($(BUILD_TYPE), debug_static_nossl)
+CFLAGS += -O0 -static -g3 -DDEBUG -DNOSSL
+CPPFLAGS += -O0 -static -g3 -DDEBUG -DNOSSL
+endif
+
+ifeq ($(BUILD_TYPE), debug_static_polar)
+CFLAGS += -O0 -static -g3 -DDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
+CPPFLAGS += -O0 -static -g3 -DDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
+LDFLAGS += -L./polarssl-1.3.2/library
+LIBS += -lpolarssl
 endif
 
 ifeq ($(BUILD_TYPE), release)
 CFLAGS += -O3 -s -DNDEBUG
 CPPFLAGS += -O3 -s -DNDEBUG
+LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
+endif
+
+ifeq ($(BUILD_TYPE), release_nossl)
+CFLAGS += -O3 -s -DNDEBUG -DNOSSL
+CPPFLAGS += -O3 -s -DNDEBUG -DNOSSL
+endif
+
+ifeq ($(BUILD_TYPE), release_polar)
+CFLAGS += -O3 -s -DNDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
+CPPFLAGS += -O3 -s -DNDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
+LDFLAGS += -L./polarssl-1.3.2/library
+LIBS += -lpolarssl
 endif
 
 ifeq ($(BUILD_TYPE), release_static)
 CFLAGS += -static -O3 -s -DNDEBUG
 CPPFLAGS += -static -O3 -s -DNDEBUG
+LIBS += -lmbedtls -lmbedx509 -lmbedcrypto
+endif
+
+ifeq ($(BUILD_TYPE), release_static_nossl)
+CFLAGS += -static -O3 -s -DNDEBUG -DNOSSL
+CPPFLAGS += -static -O3 -s -DNDEBUG -DNOSSL
+endif
+
+ifeq ($(BUILD_TYPE), release_static_polar)
+CFLAGS += -static -O3 -s -DNDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
+CPPFLAGS += -static -O3 -s -DNDEBUG -I./polarssl-1.3.2/include -DPOLARSSL
+LDFLAGS += -L./polarssl-1.3.2/library
+LIBS += -lpolarssl
 endif
 
 all: $(OUTPUT)
 	rm -r -f src/*.o
+	rm -r -f polarssl-1.3.2/library/*.o
 
 clean:
 	rm -r -f $(OUTPUT) src/*.o
+	rm -r -f polarssl-1.3.2/library/*.o
 
 $(OUTPUT): $(OBJS)
 	$(LINK.c) $(LDFLAGS) -o $@ $^ $(LIBS)
