make dir unhidden
[henge/webcc.git] / make / wolfssl.mk
diff --git a/make/wolfssl.mk b/make/wolfssl.mk
new file mode 100644 (file)
index 0000000..3940630
--- /dev/null
@@ -0,0 +1,33 @@
+################################################################################
+# Desc:   WolfSSL Build Data
+# Author: Mihrtec LLC
+# Date:   2016
+################################################################################
+# Wolfssl is built for static linking, and only builds its crypt library
+################################################################################
+# Download location
+GITADDR   := git@github.com:wolfSSL/wolfssl.git
+# Typical Configuration to allow static linking on a tiny crypt-only lib
+CONFIGURE += --enable-static=yes
+CONFIGURE += --enable-cryptonly=yes
+# Wolfssl has some badly indented text somewhere and a weird distribution system
+CONFIGURE += CFLAGS=-w
+MKCMD     := export CFLAGS=-w
+# Only build libwolfssl.la for a minimal distribution (speeds up build)
+MKCMD     += && make -k src/libwolfssl.la
+
+# Modifications to the build process when using specific compilers
+define emccMOD =
+$(eval CONFIGURE += --enable-fastmath=no)
+$(eval CONFIGURE += --enable-singlethreaded=yes)
+# Wolfssl doesn't properly detect sizeof long and longlong when compiling with
+# emscripten
+$(eval CONFIGURE += && sed -i 's@SIZEOF_LONG 0@SIZEOF_LONG 4@' config.h)
+$(eval CONFIGURE += && sed -i 's@SIZEOF_LONG_LONG 0@SIZEOF_LONG_LONG 8@' config.h)
+$(eval MKCMD     := $(subst  make , emmake make ,$(MKCMD)))
+$(eval CONFIGURE := $(subst  ./configure , emconfigure ./configure ,$(CONFIGURE)))
+endef
+define em++MOD =
+$(call EMCCMOD)
+endef
+$(eval $(call $(c_C)MOD))