OBJS:=$(patsubst %.c, %.o, $(SRCS))
+# If PolarSSL is in a nonstandard place. Usually not available in e.g. Fedora.
POLARSSL_LIB:=../../../../polarssl/polarssl-0.12.1/library/libpolarssl.a
+POLARSSL_INCLUDE:=../../../../polarssl/polarssl-0.12.1/include
+# **** Stuff used for debugging ******
# For Valgrind
-#CFLAGS:=$(CFLAGS) -I. -I/data/export/proj/openssl/include/ -Wall -g -DDEBUG
+#CFLAGS:=$(CFLAGS) -I. -I/data/export/proj/openssl/include/ -Wall
#LDFLAGS:=$(LDFLAGS) -L/data/export/proj/openssl/lib/ -lcrypto -lssl -lconfig
# PolarSSL
-CFLAGS:=$(CFLAGS) -DDEBUG -DUSE_POLARSSL -I. -I../../../../polarssl/polarssl-0.12.1/include -Wall -g
-LDFLAGS:=$(LDFLAGS) -L -lpolarssl -lconfig
-
-# OpenSSL
-#CFLAGS:=$(CFLAGS) -I. -Wall
-#LDFLAGS:=$(LDFLAGS) -L -lcrypto -lssl -lconfig
+#CFLAGS:=$(CFLAGS) -DUSE_POLARSSL -I. -I$(POLARSSL_INCLUDE) -Wall
+#LDFLAGS:=$(LDFLAGS) -L $(POLARSSL_LIB) -lconfig
# Debug
-#CFLAGS:=$(CFLAGS) -DDEBUG -I. -Wall -g
+#CFLAGS:=$(CFLAGS) -DDEBUG -g
+# ********** END ************
-# PolarSSL
-umurmurd:google/protobuf-c/libprotobuf_c.a depend.mak $(OBJS) $(POLARSSL_LIB)
- $(CC) $(LDFLAGS) $(OBJS) $(POLARSSL_LIB) google/protobuf-c/libprotobuf_c.a -o umurmurd
+
+# Build support and link to PolarSSL
+#EXTRA_CFLAGS:=-DUSE_POLARSSL -I$(POLARSSL_INCLUDE)
+#EXTRA_LDLAGS:=-lpolarssl
+#SSL_LIB:=$(POLARSSL_LIB)
# OpenSSL
-#umurmurd:google/protobuf-c/libprotobuf_c.a depend.mak $(OBJS)
-# $(CC) $(LDFLAGS) $(OBJS) google/protobuf-c/libprotobuf_c.a -o umurmurd
+EXTRA_CFFLAGS:=
+EXTRA_LDFLAGS:=-lcrypto -lssl
+
+CFLAGS:=$(CFLAGS) -I. -Wall $(EXTRA_CFLAGS)
+LDFLAGS:=$(LDFLAGS) -lconfig $(EXTRA_LDFLAGS)
+
+umurmurd:google/protobuf-c/libprotobuf_c.a depend.mak $(OBJS)
+ $(CC) $(LDFLAGS) $(OBJS) $(SSL_LIB) google/protobuf-c/libprotobuf_c.a -o umurmurd
google/protobuf-c/libprotobuf_c.a:
$(MAKE) -C google/protobuf-c/