diff --git a/Makefile.am b/Makefile.am
index 6eaf62a4..906ba04e 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,31 @@
-SUBDIRS=src
+CLOSURE=java -jar $(srcdir)/lsp/closure-compiler.jar --warning_level QUIET
EXTRA_DIST=server.html server.html.h VERSION lsp/*.js lsp/*.html lsp/*.css src/embed.js*
+SUBDIRS=. src
+BUILT_SOURCES=lsp/compressed.js server.html.h src/embed.js.h
+CLEANFILES=$(BUILT_SOURCES)
docs:
doxygen ./Doxyfile > /dev/null
.PHONY: docs
+SOURCES=server.html.h
+
+lspSOURCES=$(srcdir)/lsp/jquery.js $(srcdir)/lsp/placeholder.js $(srcdir)/lsp/md5.js $(srcdir)/lsp/main.js $(srcdir)/lsp/functions.js
+lsp/compressed.js: $(lspSOURCES)
+ -mkdir lsp
+ $(CLOSURE) --js_output_file $@ $(lspSOURCES)
+src/embed.js.h: $(srcdir)/src/embed.js
+ $(CLOSURE) --js_output_file embed.js $<
+ xxd -i embed.js embed.js.h
+ rm embed.js
+ mv embed.js.h src/
+
+server.html: lsp/compressed.js
+ cat $(srcdir)/lsp/header.html lsp/compressed.js > $@
+ echo "" >> $@
+ cat $(srcdir)/lsp/footer.html >> $@
+server.html.h: server.html
+ xxd -i server.html server.html.h
diff --git a/lsp/closure-compiler.jar b/lsp/closure-compiler.jar
new file mode 100644
index 00000000..52a920f2
Binary files /dev/null and b/lsp/closure-compiler.jar differ
diff --git a/lsp/jscompiler.jar b/lsp/jscompiler.jar
deleted file mode 100644
index 4dfa5ad0..00000000
Binary files a/lsp/jscompiler.jar and /dev/null differ
diff --git a/src/Makefile.am b/src/Makefile.am
index 18bdd0b0..69c1e0c9 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,23 +1,3 @@
-../lsp/uncompressed.js: ../lsp/jquery.js ../lsp/placeholder.js ../lsp/md5.js ../lsp/main.js ../lsp/functions.js
- cat ../lsp/jquery.js ../lsp/placeholder.js ../lsp/md5.js ../lsp/main.js ../lsp/functions.js > ../lsp/uncompressed.js
-../lsp/compressed.js: ../lsp/uncompressed.js
- echo "" >> ../lsp/compressed.js
-../server.html: ../lsp/compressed.js
- cat ../lsp/header.html ../lsp/compressed.js > ../server.html
- echo "" >> ../server.html
- cat ../lsp/footer.html >> ../server.html
-../server.html.h: ../server.html
- xxd -i ../server.html ../server.html.h
-./embed.js.h: ./embed.js
- mv embed.js tmp.js
- java -jar ../lsp/jscompiler.jar < tmp.js > embed.js
- xxd -i embed.js embed.js.h
- mv tmp.js embed.js
-
AM_CPPFLAGS = $(MIST_CFLAGS)
LDADD = $(MIST_LIBS)
SUBDIRS=converters analysers
diff --git a/src/controller.cpp b/src/controller.cpp
index 7fb7f61e..c03ca30e 100644
--- a/src/controller.cpp
+++ b/src/controller.cpp
@@ -503,7 +503,7 @@ int main(int argc, char ** argv){
it->H.SetHeader("Content-Type", "text/html");
it->H.SetHeader("X-Info", "To force an API response, request the file /api");
it->H.SetHeader("Server", "mistserver/" PACKAGE_VERSION "/" + Util::Config::libver);
- it->H.SetBody(std::string((char*)___server_html, (size_t)___server_html_len));
+ it->H.SetBody(std::string((char*)server_html, (size_t)server_html_len));
it->C.Send(it->H.BuildResponse("200", "OK"));
it->H.Clean();
}else{