title: How to build Qhull into Javascript with Emscripten?
body: <p>I've been trying to build <a href="https://github.com/qhull/qhull" rel="nofollow noreferrer">Qhull</a> for use on the net, and to be honest. I'm completely lost. I've already installed the <a href="https://github.com/emscripten-core/emsdk" rel="nofollow noreferrer">Emscripten SDK</a>, and I've tried reading through the guides. From what I can gather, it seems that there are two ways to compile a large project like this one: I can either pass the files as arguments to <code>emcc</code>, or I can make my own custom Makefile that somehow does that for me. But I can neither figure out how to pass multiple files as arguments, nor how Makefiles work.</p>
  <p>After scouring the web, I managed to find <a href="https://github.com/mikolalysenko/qhull-js" rel="nofollow noreferrer">this port of an old Qhull version</a>, which comes with its own Makefile:</p>
  <pre><code>QHULL_PATH = ./src/libqhull
  TARGET = qhull.js
  EMCC = ../emscripten/emcc
  PREJS = ./src/pre.js
  POSTJS = ./src/post.js
  MAIN = ./src/main.c
  EXPORTJS = &quot;['_run_qhull']&quot;
  CFLAGS = -O1
  
  SOURCES := $(shell find $(QHULL_PATH) -type f -name '*.c')
  
  all: $(TARGET)
      @echo  &quot;Done&quot;
  
  $(TARGET): $(SOURCES) $(PREJS) $(POSTJS) $(MAIN)
      $(EMCC) $(CFLAGS) $(SOURCES) $(MAIN) -s EXPORTED_FUNCTIONS=$(EXPORTJS) --pre-js $(PREJS) --post-js $(POSTJS) -o $(TARGET)
  
  clean:
      rm -rf $(TARGET)
  </code></pre>
  <p>Unfortunately, the Makefile is in the Unix format, which I only figured out after about two hours of frustration. I don't know how to make it work on Windows.</p>
  <p>So, what can I do to get the latest version of Qhull running in Javascript?</p>
  <p>I'm using Windows, and my current IDE is Dev-C++.</p>