--- Makefile.old	2013-03-12 21:49:03.976676966 +0100
+++ Makefile	2013-03-12 21:50:02.888103540 +0100
@@ -1,11 +1,11 @@
 include Makefile.options
 
 all::
-	make documentation
-	make accelerator
-	make libraries
-	make symlinks
-	make precompile
+	$(MAKE) documentation
+	$(MAKE) accelerator
+	$(MAKE) libraries
+	$(MAKE) symlinks
+	$(MAKE) precompile
 
 documentation::
 	rm -f doc/autodoc.tmp
@@ -14,12 +14,12 @@
 	rm -f doc/autodoc.tmp
 
 accelerator::
-	cd framework/accelerator; make
+	$(MAKE) -C framework/accelerator
 
 libraries::
-	cd libraries/extos; make
-	cd libraries/mondelefant; make
-	cd libraries/multirand; make
+	$(MAKE) -C libraries/extos
+	$(MAKE) -C libraries/mondelefant
+	$(MAKE) -C libraries/multirand
 
 symlinks::
 	ln -s -f ../../libraries/atom/atom.lua framework/lib/
--- Makefile.options.old	2013-03-12 21:54:27.245530485 +0100
+++ Makefile.options	2013-03-12 21:55:45.756768247 +0100
@@ -10,13 +8,13 @@
 # C compiler flags
 # TODO: check alternatives to -D_GNU_SOURCE -fPIC
 #       using libtool?
-CFLAGS = -O2 -D_GNU_SOURCE -fPIC -Wall -I /usr/include -I /usr/local/include
+CPPFLAGS = -D_GNU_SOURCE
 
 # additional C compiler flags for parts which depend on PostgreSQL
 CFLAGS_PGSQL = -I /usr/include/postgresql -I /usr/include/postgresql/server -I /usr/local/include/postgresql -I /usr/local/include/postgresql/server
 
 # linker flags
-LDFLAGS = -shared -L /usr/lib -L /usr/local/lib
+LDFLAGS += -shared
 
 # additional linker flags for parts which depend on PostgreSQL
 LDFLAGS_PGSQL =
--- libraries/extos/Makefile.old	2013-03-13 21:49:19.710360750 +0100
+++ libraries/extos/Makefile	2013-03-13 21:49:47.778096460 +0100
@@ -1,7 +1,7 @@
 include ../../Makefile.options
 
 extos.so: extos.o
-	$(LD) $(LDFLAGS) -lrt -lcrypt -o extos.$(SLIB_EXT) extos.o 
+	$(LD) $(LDFLAGS) -o extos.$(SLIB_EXT) extos.o -lrt -lcrypt -llua
 
 extos.o: extos.c
 	$(CC) -c $(CFLAGS) -o extos.o extos.c
--- libraries/mondelefant/Makefile.old	2013-03-13 21:52:54.884250479 +0100
+++ libraries/mondelefant/Makefile	2013-03-13 21:53:27.511932686 +0100
@@ -1,7 +1,7 @@
 include ../../Makefile.options
 
 mondelefant_native.so: mondelefant_native.o
-	$(LD) $(LDFLAGS) $(LDFLAGS_PGSQL) -o mondelefant_native.$(SLIB_EXT) mondelefant_native.o -lpq
+	$(LD) $(LDFLAGS) $(LDFLAGS_PGSQL) -o mondelefant_native.$(SLIB_EXT) mondelefant_native.o -lpq -llua
 
 mondelefant_native.o: mondelefant_native.c
 	$(CC) -c $(CFLAGS) $(CFLAGS_PGSQL) -o mondelefant_native.o mondelefant_native.c
--- libraries/multirand/Makefile.old	2013-03-13 21:54:29.399328173 +0100
+++ libraries/multirand/Makefile	2013-03-13 21:54:58.019048434 +0100
@@ -1,7 +1,7 @@
 include ../../Makefile.options
 
 multirand.so: multirand.o
-	$(LD) $(LDFLAGS) -o multirand.$(SLIB_EXT) multirand.o
+	$(LD) $(LDFLAGS) -o multirand.$(SLIB_EXT) multirand.o -llua
 
 multirand.o: multirand.c
 	$(CC) -c $(CFLAGS) -o multirand.o multirand.c
--- libraries/extos/extos.c.old	2013-04-05 23:19:52.028115226 +0200
+++ libraries/extos/extos.c	2013-04-05 23:20:14.819896253 +0200
@@ -12,6 +12,7 @@
 #include <fcntl.h>
 #include <poll.h>
 #include <stdlib.h>
+#include <crypt.h>
 
 #define EXTOS_MAX_ERRLEN 80
 #define EXTOS_EXEC_MAX_ARGS 64
--- framework/accelerator/Makefile.old	2014-06-21 20:15:21.019918183 +0200
+++ framework/accelerator/Makefile	2014-06-21 20:15:44.700471794 +0200
@@ -4,7 +4,7 @@
 	$(LD) $(LDFLAGS) -o webmcp_accelerator.$(SLIB_EXT) webmcp_accelerator.o
 
 webmcp_accelerator.o: webmcp_accelerator.c
-	$(CC) -c $(CFLAGS) -o webmcp_accelerator.o webmcp_accelerator.c
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) -fPIC -o webmcp_accelerator.o webmcp_accelerator.c
 
 clean::
 	rm -f webmcp_accelerator.so webmcp_accelerator.o
--- libraries/extos/Makefile.old	2014-06-21 20:18:25.594611956 +0200
+++ libraries/extos/Makefile	2014-06-21 20:18:50.457183029 +0200
@@ -4,7 +4,7 @@
 	$(LD) $(LDFLAGS) -o extos.$(SLIB_EXT) extos.o -lrt -lcrypt -llua
 
 extos.o: extos.c
-	$(CC) -c $(CFLAGS) -o extos.o extos.c
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) -fPIC -o extos.o extos.c
 
 clean::
 	rm -f extos.so extos.o
--- libraries/mondelefant/Makefile.old	2014-06-21 20:19:58.218962359 +0200
+++ libraries/mondelefant/Makefile	2014-06-21 20:20:24.527476578 +0200
@@ -4,7 +4,7 @@
 	$(LD) $(LDFLAGS) $(LDFLAGS_PGSQL) -o mondelefant_native.$(SLIB_EXT) mondelefant_native.o -lpq -llua
 
 mondelefant_native.o: mondelefant_native.c
-	$(CC) -c $(CFLAGS) $(CFLAGS_PGSQL) -o mondelefant_native.o mondelefant_native.c
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) -fPIC $(CFLAGS_PGSQL) -o mondelefant_native.o mondelefant_native.c
 
 test:: mondelefant_native.so mondelefant.lua
 	lua -l mondelefant
--- libraries/multirand/Makefile.old	2014-06-21 20:21:36.950197127 +0200
+++ libraries/multirand/Makefile	2014-06-21 20:22:04.967703944 +0200
@@ -4,7 +4,7 @@
 	$(LD) $(LDFLAGS) -o multirand.$(SLIB_EXT) multirand.o -llua
 
 multirand.o: multirand.c
-	$(CC) -c $(CFLAGS) -o multirand.o multirand.c
+	$(CC) -c $(CFLAGS) $(CPPFLAGS) -fPIC -o multirand.o multirand.c
 
 clean::
 	rm -f multirand.so multirand.o
