# directory where files with 'main' functions live (can be in SRC_DIR)
DRIVER_DIR := $(SRC_DIR)/bin
# make configuration directory
-CONF_DIR := $(ROOT_DIR)/.make
+CONF_DIR := $(ROOT_DIR)/make
# Source languages handled by this build system. These languages are capable of
# being compiled to an intermediary format for binary output by one of the
# provided compilersfor each language
--- /dev/null
+################################################################################
+# Desc: SDL2 Build Data
+# Author: Mihrtec LLC
+# Date: 2016
+################################################################################
+# SDL2 natively supports transpiling (well, almost)
+################################################################################
+# Download location
+HGADDR := https://hg.libsdl.org/SDL
+# No autogen for SDL
+undefine AUTOGEN
+# Ensure we have our other libraries, and their associated
+# accutrements (like jpeg/tiff, etc from SDL2_image)
+LIBDEPS := SDL2_image SDL2_ttf SDL2_net
+# Modifications to the build process when using specific compilers
+define emccMOD =
+$(eval CONFIGURE += --enable-joystick=no)
+$(eval CONFIGURE += --enable-pthreads=no)
+$(eval CONFIGURE += --enable-threads=no)
+MKCMD := $(subst make , emmake make ,$(MKCMD))
+CONFIGURE := $(subst ./configure , emconfigure ./configure ,$(CONFIGURE))
+endef
+define em++MOD =
+$(call EMCCMOD)
+endef
+$(eval $(call $(c_C)MOD))
--- /dev/null
+################################################################################
+# Desc: SDL2_image Build Data
+# Author: Mihrtec LLC
+# Date: 2016
+################################################################################
+# SDL2_image natively supports transpiling
+################################################################################
+# Download location
+HGADDR := https://hg.libsdl.org/SDL_image
+# SDL2_image depends on zlib, libpng, libtiff libpjeg, and libwebp
+LIBDEPS := webp png tiff z
--- /dev/null
+################################################################################
+# Desc: SDL2_net Build Data
+# Author: Mihrtec LLC
+# Date: 2016
+################################################################################
+# SDL2_net natively supports transpiling
+################################################################################
+# Download location
+HGADDR := https://hg.libsdl.org/SDL_net
+
--- /dev/null
+################################################################################
+# Desc: SDL2_ttf Build Data
+# Author: Mihrtec LLC
+# Date: 2016
+################################################################################
+# SDL2_ttf natively supports transpiling
+################################################################################
+# Download location
+HGADDR := https://hg.libsdl.org/SDL_ttf
--- /dev/null
+################################################################################
+# Desc: openjpeg Build Data
+# Author: Mihrtec LLC
+# Date: 2016
+################################################################################
+# openjpeg natively supports transpiling
+################################################################################
+# Download location
+GITADDR := https://github.com/uclouvain/openjpeg
+# OpenJPEG depends on png, tiff, lcms2, and z
+LIBDEPS := png tiff lcms2 z
+# Cmake autogen
+CMAKEOPT := -DPNG_LIBRARY:FILEPATH="$(abspath $(LIB_DIR)/libpng.so)"
+CMAKEOPT += -DPNG_INCLUDE_DIR:PATH="$(abspath $(ROOT_DIR)/include)"
+CMAKEOPT += -DPNG_PNG_INCLUDE_DIR:PATH="$(abspath $(ROOT_DIR)/include)"
+CMAKEOPT += -DZLIB_LIBRARY:FILEPATH="$(abspath $(LIB_DIR)/libz.so)"
+CMAKEOPT += -DZLIB_INCLUDE_DIR:PATH="$(abspath $(ROOT_DIR)/include)"
+CMAKEOPT += -DTIFF_LIBRARY:FILEPATH="$(abspath $(LIB_DIR)/libtiff.so)"
+CMAKEOPT += -DTIFF_INCLUDE_DIR:PATH="$(abspath $(ROOT_DIR)/include)"
+CMAKEOPT += -DBUILD_SHARED_LIBS:bool=off
+AUTOGEN := mkdir -p build && cd build
+AUTOGEN += && cmake $(CMAKEOPT) ..
+undefine CONFIGURE
+# Make is now in the build dir
+MKINSTALL := cd build && make DESTDIR=$(abspath $(LIB_DIR)/.trash) install
+
+# Emscripten mods
+define emccMOD =
+$(eval AUTOGEN := $(subst cmake , emcmake cmake ,$(AUTOGEN)))
+endef
+define em++MOD =
+$(call emccMOD)
+endef
+ifdef $($(c_C)MOD)
+$(eval $(call $($(c_C)MOD)))
+endif
--- /dev/null
+################################################################################
+# Desc: liblcms2 Build Data
+# Author: Mihrtec LLC
+# Date: 2016
+################################################################################
+# png natively supports transpiling
+################################################################################
+# Download location
+WEBADDR := https://sourceforge.net/projects/lcms/files/latest/download
+WEBTARG := liblcms2-latest.tar.gz
+WEBINIT := rm -Rf lcms2 && tar -xvf $(WEBTARG) && cp -r lcms2-*/ lcms2
--- /dev/null
+################################################################################
+# Desc: libpng Build Data
+# Author: Mihrtec LLC
+# Date: 2016
+################################################################################
+# png natively supports transpiling
+################################################################################
+# Download location
+WEBADDR := https://sourceforge.net/projects/libpng/files/latest/download
+WEBTARG := libpng-latest.tar.gz
+WEBINIT := tar -xvf $(WEBTARG) && rm $(WEBTARG)
+WEBINIT += && mv libpng-*/* png/
+# Instead of autogenning, just turn off zlib link checking during build
+AUTOGEN := sed -i -e 's@zlibVersion=no@zlibVersion=yes@g' ./configure
+# After configuration, alter the makefile
+DFLT_INC := -I. -I$(abspath $(LIBINC_DIR)) -I$(abspath $(LIBDL_DIR)/z)
+CONFIGURE += --without-zlib
+CONFIGURE += && sed -i -e 's@^DEFAULT_INCLUDES \= \-I\.@DEFAULT_INCLUDES = $(DFLT_INC)@g' ./Makefile
+CONFIGURE += && sed -i -e 's@^LIBS \= \-lz@LIBS = -L$(abspath $(LIB_DIR))@g' ./Makefile
+# Don't check
+MKCMD := make -k
--- /dev/null
+################################################################################
+# Desc: libtiff Build Data
+# Author: Mihrtec LLC
+# Date: 2016
+################################################################################
+# tiff natively supports transpiling
+################################################################################
+# Download location
+CVSADDR := :pserver:cvsanon@cvs.maptools.org:/cvs/maptools/cvsroot
+CVSGET := checkout libtiff && rm -Rf tiff && cp -r libtiff/ tiff
+
+MKCLEAN := echo Implementation needed
--- /dev/null
+################################################################################
+# Desc: webp Build Data
+# Author: Mihrtec LLC
+# Date: 2016
+################################################################################
+# webp natively supports transpiling
+################################################################################
+# Download location
+GITADDR := https://chromium.googlesource.com/webm/libwebp
--- /dev/null
+################################################################################
+# 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))
--- /dev/null
+################################################################################
+# Desc: zlib Build Data
+# Author: Mihrtec LLC
+# Date: 2016
+################################################################################
+# zlib natively supports transpiling
+################################################################################
+# Download location
+GITADDR := https://github.com/madler/zlib.git
+# No autogen
+undefine AUTOGEN