From abe38472c46e1a1e1ca097f96b5e5c56278ab97c Mon Sep 17 00:00:00 2001
From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz>
Date: Wed, 17 Jun 2015 11:20:31 +0200
Subject: [PATCH] allow to use ramdisk for obj, bin and lib files

---
 aarbology2/makefile            | 40 +++++++++++++++--
 acast2/makefile                | 40 +++++++++++++++--
 acompaction2/makefile          | 40 +++++++++++++++--
 acompare2/makefile             | 40 +++++++++++++++--
 aconversions2/makefile         | 40 +++++++++++++++--
 aconvert2/makefile             | 40 +++++++++++++++--
 aderivation2/makefile          | 40 +++++++++++++++--
 adeterminize2/makefile         | 40 +++++++++++++++--
 aecho2/makefile                | 40 +++++++++++++++--
 aepsilon2/makefile             | 40 +++++++++++++++--
 agenerate2/makefile            | 40 +++++++++++++++--
 aintegral2/makefile            | 40 +++++++++++++++--
 alangop2/makefile              | 40 +++++++++++++++--
 alib2algo/makefile             | 79 +++++++++++++++++++++++++++++++---
 alib2data/makefile             | 79 +++++++++++++++++++++++++++++++---
 alib2elgo/makefile             | 79 +++++++++++++++++++++++++++++++---
 alib2std/makefile              | 79 +++++++++++++++++++++++++++++++---
 aminimize2/makefile            | 40 +++++++++++++++--
 anormalize2/makefile           | 40 +++++++++++++++--
 arand2/makefile                | 40 +++++++++++++++--
 araw2/makefile                 | 40 +++++++++++++++--
 arename2/makefile              | 40 +++++++++++++++--
 areverse2/makefile             | 40 +++++++++++++++--
 arun2/makefile                 | 40 +++++++++++++++--
 astat2/makefile                | 40 +++++++++++++++--
 astringology2/makefile         | 40 +++++++++++++++--
 atrim2/makefile                | 40 +++++++++++++++--
 makefile                       | 19 +++++++-
 tests.aarbology.sh             |  2 +-
 tests.aconversion.sh           |  2 +-
 tests.aderivation.aintegral.sh |  2 +-
 tests.adeterminize.sh          |  2 +-
 tests.anormalize.sh            |  2 +-
 tests.astringology.sh          |  2 +-
 tests.examples.sh              |  2 +-
 tniceprint/makefile            | 40 +++++++++++++++--
 36 files changed, 1204 insertions(+), 105 deletions(-)

diff --git a/aarbology2/makefile b/aarbology2/makefile
index 2c6fadea10..f19c977454 100644
--- a/aarbology2/makefile
+++ b/aarbology2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/acast2/makefile b/acast2/makefile
index 2c6fadea10..f19c977454 100644
--- a/acast2/makefile
+++ b/acast2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/acompaction2/makefile b/acompaction2/makefile
index 2c6fadea10..f19c977454 100644
--- a/acompaction2/makefile
+++ b/acompaction2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/acompare2/makefile b/acompare2/makefile
index 2c6fadea10..f19c977454 100644
--- a/acompare2/makefile
+++ b/acompare2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/aconversions2/makefile b/aconversions2/makefile
index 2c6fadea10..f19c977454 100644
--- a/aconversions2/makefile
+++ b/aconversions2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/aconvert2/makefile b/aconvert2/makefile
index 2c6fadea10..f19c977454 100644
--- a/aconvert2/makefile
+++ b/aconvert2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/aderivation2/makefile b/aderivation2/makefile
index 2c6fadea10..f19c977454 100644
--- a/aderivation2/makefile
+++ b/aderivation2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/adeterminize2/makefile b/adeterminize2/makefile
index 2c6fadea10..f19c977454 100644
--- a/adeterminize2/makefile
+++ b/adeterminize2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/aecho2/makefile b/aecho2/makefile
index 2c6fadea10..f19c977454 100644
--- a/aecho2/makefile
+++ b/aecho2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/aepsilon2/makefile b/aepsilon2/makefile
index 2c6fadea10..f19c977454 100644
--- a/aepsilon2/makefile
+++ b/aepsilon2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/agenerate2/makefile b/agenerate2/makefile
index 2c6fadea10..f19c977454 100644
--- a/agenerate2/makefile
+++ b/agenerate2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/aintegral2/makefile b/aintegral2/makefile
index 2c6fadea10..f19c977454 100644
--- a/aintegral2/makefile
+++ b/aintegral2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/alangop2/makefile b/alangop2/makefile
index 2c6fadea10..f19c977454 100644
--- a/alangop2/makefile
+++ b/alangop2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/alib2algo/makefile b/alib2algo/makefile
index 25d4a7751d..ced22944d2 100644
--- a/alib2algo/makefile
+++ b/alib2algo/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 FULL_LIBRARY:=lib$(LIBRARY).so
@@ -29,7 +30,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -79,7 +87,14 @@ obj%/makefile: makefile makefile.conf
 	-include \$$(DEPENDENCIES)" > $@
 
 test-obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -140,11 +155,25 @@ test: unit-test-debug unit-test-release
 
 
 lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -169,11 +198,25 @@ build-release: lib-release/$(FULL_LIBRARY)
 
 
 test-bin-debug/$(TESTBIN): lib-debug/$(FULL_LIBRARY) $(TEST_OBJECTS_DEBUG) test-obj-debug/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG)
 
 test-bin-release/$(TESTBIN): lib-release/$(FULL_LIBRARY) $(TEST_OBJECTS_RELEASE) test-obj-release/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE)
 
 
@@ -207,9 +250,33 @@ unit-test-release: build-tests-release
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L lib-debug ]; then\
+		rm -r `readlink lib-debug`;\
+	fi
+	if [ -L test-obj-debug ]; then\
+		rm -r `readlink test-obj-debug`;\
+	fi
+	if [ -L test-bin-debug ]; then\
+		rm -r `readlink test-bin-debug`;\
+	fi
 	$(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
+	if [ -L test-obj-release ]; then\
+		rm -r `readlink test-obj-release`;\
+	fi
+	if [ -L test-bin-release ]; then\
+		rm -r `readlink test-bin-release`;\
+	fi
 	$(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml
 
 
diff --git a/alib2data/makefile b/alib2data/makefile
index 25d4a7751d..ced22944d2 100644
--- a/alib2data/makefile
+++ b/alib2data/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 FULL_LIBRARY:=lib$(LIBRARY).so
@@ -29,7 +30,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -79,7 +87,14 @@ obj%/makefile: makefile makefile.conf
 	-include \$$(DEPENDENCIES)" > $@
 
 test-obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -140,11 +155,25 @@ test: unit-test-debug unit-test-release
 
 
 lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -169,11 +198,25 @@ build-release: lib-release/$(FULL_LIBRARY)
 
 
 test-bin-debug/$(TESTBIN): lib-debug/$(FULL_LIBRARY) $(TEST_OBJECTS_DEBUG) test-obj-debug/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG)
 
 test-bin-release/$(TESTBIN): lib-release/$(FULL_LIBRARY) $(TEST_OBJECTS_RELEASE) test-obj-release/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE)
 
 
@@ -207,9 +250,33 @@ unit-test-release: build-tests-release
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L lib-debug ]; then\
+		rm -r `readlink lib-debug`;\
+	fi
+	if [ -L test-obj-debug ]; then\
+		rm -r `readlink test-obj-debug`;\
+	fi
+	if [ -L test-bin-debug ]; then\
+		rm -r `readlink test-bin-debug`;\
+	fi
 	$(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
+	if [ -L test-obj-release ]; then\
+		rm -r `readlink test-obj-release`;\
+	fi
+	if [ -L test-bin-release ]; then\
+		rm -r `readlink test-bin-release`;\
+	fi
 	$(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml
 
 
diff --git a/alib2elgo/makefile b/alib2elgo/makefile
index 25d4a7751d..ced22944d2 100644
--- a/alib2elgo/makefile
+++ b/alib2elgo/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 FULL_LIBRARY:=lib$(LIBRARY).so
@@ -29,7 +30,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -79,7 +87,14 @@ obj%/makefile: makefile makefile.conf
 	-include \$$(DEPENDENCIES)" > $@
 
 test-obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -140,11 +155,25 @@ test: unit-test-debug unit-test-release
 
 
 lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -169,11 +198,25 @@ build-release: lib-release/$(FULL_LIBRARY)
 
 
 test-bin-debug/$(TESTBIN): lib-debug/$(FULL_LIBRARY) $(TEST_OBJECTS_DEBUG) test-obj-debug/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG)
 
 test-bin-release/$(TESTBIN): lib-release/$(FULL_LIBRARY) $(TEST_OBJECTS_RELEASE) test-obj-release/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE)
 
 
@@ -207,9 +250,33 @@ unit-test-release: build-tests-release
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L lib-debug ]; then\
+		rm -r `readlink lib-debug`;\
+	fi
+	if [ -L test-obj-debug ]; then\
+		rm -r `readlink test-obj-debug`;\
+	fi
+	if [ -L test-bin-debug ]; then\
+		rm -r `readlink test-bin-debug`;\
+	fi
 	$(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
+	if [ -L test-obj-release ]; then\
+		rm -r `readlink test-obj-release`;\
+	fi
+	if [ -L test-bin-release ]; then\
+		rm -r `readlink test-bin-release`;\
+	fi
 	$(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml
 
 
diff --git a/alib2std/makefile b/alib2std/makefile
index 25d4a7751d..ced22944d2 100644
--- a/alib2std/makefile
+++ b/alib2std/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 FULL_LIBRARY:=lib$(LIBRARY).so
@@ -29,7 +30,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -79,7 +87,14 @@ obj%/makefile: makefile makefile.conf
 	-include \$$(DEPENDENCIES)" > $@
 
 test-obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -140,11 +155,25 @@ test: unit-test-debug unit-test-release
 
 
 lib-debug/$(FULL_LIBRARY): $(OBJECTS_DEBUG) obj-debug/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 lib-release/$(FULL_LIBRARY): $(OBJECTS_RELEASE) obj-release/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -169,11 +198,25 @@ build-release: lib-release/$(FULL_LIBRARY)
 
 
 test-bin-debug/$(TESTBIN): lib-debug/$(FULL_LIBRARY) $(TEST_OBJECTS_DEBUG) test-obj-debug/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(TEST_OBJECTS_DEBUG) -o $@ $(TEST_LDFLAGS_DEBUG)
 
 test-bin-release/$(TESTBIN): lib-release/$(FULL_LIBRARY) $(TEST_OBJECTS_RELEASE) test-obj-release/
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(TEST_OBJECTS_RELEASE) -o $@ $(TEST_LDFLAGS_RELEASE)
 
 
@@ -207,9 +250,33 @@ unit-test-release: build-tests-release
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L lib-debug ]; then\
+		rm -r `readlink lib-debug`;\
+	fi
+	if [ -L test-obj-debug ]; then\
+		rm -r `readlink test-obj-debug`;\
+	fi
+	if [ -L test-bin-debug ]; then\
+		rm -r `readlink test-bin-debug`;\
+	fi
 	$(RM) -r *.o *.d lib-debug obj-debug test-bin-debug test-obj-debug CppUnitTestResults.xml
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
+	if [ -L test-obj-release ]; then\
+		rm -r `readlink test-obj-release`;\
+	fi
+	if [ -L test-bin-release ]; then\
+		rm -r `readlink test-bin-release`;\
+	fi
 	$(RM) -r *.o *.d lib-release obj-release test-bin-release test-obj-release CppUnitTestResults.xml
 
 
diff --git a/aminimize2/makefile b/aminimize2/makefile
index 2c6fadea10..f19c977454 100644
--- a/aminimize2/makefile
+++ b/aminimize2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/anormalize2/makefile b/anormalize2/makefile
index 2c6fadea10..f19c977454 100644
--- a/anormalize2/makefile
+++ b/anormalize2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/arand2/makefile b/arand2/makefile
index 2c6fadea10..f19c977454 100644
--- a/arand2/makefile
+++ b/arand2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/araw2/makefile b/araw2/makefile
index 2c6fadea10..f19c977454 100644
--- a/araw2/makefile
+++ b/araw2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/arename2/makefile b/arename2/makefile
index 2c6fadea10..f19c977454 100644
--- a/arename2/makefile
+++ b/arename2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/areverse2/makefile b/areverse2/makefile
index 2c6fadea10..f19c977454 100644
--- a/areverse2/makefile
+++ b/areverse2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/arun2/makefile b/arun2/makefile
index 2c6fadea10..f19c977454 100644
--- a/arun2/makefile
+++ b/arun2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/astat2/makefile b/astat2/makefile
index 2c6fadea10..f19c977454 100644
--- a/astat2/makefile
+++ b/astat2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/astringology2/makefile b/astringology2/makefile
index 2c6fadea10..f19c977454 100644
--- a/astringology2/makefile
+++ b/astringology2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/atrim2/makefile b/atrim2/makefile
index 2c6fadea10..f19c977454 100644
--- a/atrim2/makefile
+++ b/atrim2/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
diff --git a/makefile b/makefile
index e13d7abc2b..f8ceb45711 100644
--- a/makefile
+++ b/makefile
@@ -1,4 +1,5 @@
 SHELL = /bin/bash
+USE_RAMDISK ?= 0
 APPPATH = /usr/bin
 LIBPATH = /usr/lib
 BINFOLDER = bin
@@ -75,7 +76,14 @@ all:
 	@echo "What to do master?"
 
 debug: all-debug
-	mkdir -p $(addsuffix -debug, $(BINFOLDER))
+	if [ ! -w $(addsuffix -debug, $(BINFOLDER)) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(addsuffix -debug, $(BINFOLDER)) $(subst /, , $(addsuffix -debug, $(BINFOLDER))) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(addsuffix -debug, $(BINFOLDER))) ]; then\
+		mkdir -p `readlink $(subst /, , $(addsuffix -debug, $(BINFOLDER)))`;\
+	else\
+		mkdir -p $(addsuffix -debug, $(BINFOLDER));\
+	fi
 	rm -rf $(addsuffix -debug, $(BINFOLDER))/*
 	for dir in $(STD_LIB) $(CORE_LIB) $(ALGO_LIB) $(ELGO_LIB); do \
 	    cp $$dir/lib-debug/* $(addsuffix -debug, $(BINFOLDER)); \
@@ -92,7 +100,14 @@ debug: all-debug
 	./tests.aarbology.sh debug
 
 release: all-release
-	mkdir -p $(addsuffix -release, $(BINFOLDER))
+	if [ ! -w $(addsuffix -release, $(BINFOLDER)) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(addsuffix -release, $(BINFOLDER)) $(subst /, , $(addsuffix -release, $(BINFOLDER))) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(addsuffix -release, $(BINFOLDER))) ]; then\
+		mkdir -p `readlink $(subst /, , $(addsuffix -release, $(BINFOLDER)))`;\
+	else\
+		mkdir -p $(addsuffix -release, $(BINFOLDER));\
+	fi
 	rm -rf $(addsuffix -release, $(BINFOLDER))/*
 	for dir in $(STD_LIB) $(CORE_LIB) $(ALGO_LIB) $(ELGO_LIB); do \
 	    cp $$dir/lib-release/* $(addsuffix -release, $(BINFOLDER)); \
diff --git a/tests.aarbology.sh b/tests.aarbology.sh
index bb409e8ffb..a249c8f459 100755
--- a/tests.aarbology.sh
+++ b/tests.aarbology.sh
@@ -14,7 +14,7 @@ RAND_HEIGHT_PATTERN=2
 RAND_ALPHABET=2
 
 EXECUTABLES="arand2 atrim2 adeterminize2 anormalize2 "
-TESTS_DIR="../examples2/tree"
+TESTS_DIR="`pwd`/examples2/tree"
 
 RES_GOOD=0
 RES_FAIL=0
diff --git a/tests.aconversion.sh b/tests.aconversion.sh
index 81d042a845..2558e1214d 100755
--- a/tests.aconversion.sh
+++ b/tests.aconversion.sh
@@ -12,7 +12,7 @@ RAND_DENSITY="2.5"
 RAND_ALPHABET=4
 
 EXECUTABLES="arand2 aepsilon2 atrim2 adeterminize2 aminimize2 anormalize2 acompare2 aconversions2"
-TESTS_DIR="../examples2/automaton"
+TESTS_DIR="`pwd`/examples2/automaton"
 
 RES_GOOD=0
 RES_FAIL=0
diff --git a/tests.aderivation.aintegral.sh b/tests.aderivation.aintegral.sh
index 6c6a62ff94..527d11f221 100755
--- a/tests.aderivation.aintegral.sh
+++ b/tests.aderivation.aintegral.sh
@@ -5,7 +5,7 @@
 set -o pipefail
 
 EXECUTABLES="aepsilon2 atrim2 adeterminize2 aminimize2 anormalize2 acompare2 aderivation2 aintegral2 aconversions2"
-TESTS_DIR="../examples2/regexp"
+TESTS_DIR="`pwd`/examples2/regexp"
 
 # ----------------------------
 
diff --git a/tests.adeterminize.sh b/tests.adeterminize.sh
index 9edc9083c7..6fe0e0e05c 100755
--- a/tests.adeterminize.sh
+++ b/tests.adeterminize.sh
@@ -7,7 +7,7 @@ TESTCASE_TIMEOUT=10
 LOGFILE="log_tests.txt"
 
 EXECUTABLES="aepsilon2 atrim2 adeterminize2 aminimize2 anormalize2 acompare2"
-TESTS_DIR="../examples2/automaton"
+TESTS_DIR="`pwd`/examples2/automaton"
 
 RES_GOOD=0
 RES_FAIL=0
diff --git a/tests.anormalize.sh b/tests.anormalize.sh
index d69423a3fd..52f990d9e6 100755
--- a/tests.anormalize.sh
+++ b/tests.anormalize.sh
@@ -13,7 +13,7 @@ RAND_TERMINALS=4
 STRING_LENGHTS=6
 
 EXECUTABLES="arand2 atrim2 anormalize2 agenerate2 aepsilon2"
-TESTS_DIR="../examples2/grammar"
+TESTS_DIR="`pwd`/examples2/grammar"
 
 RES_GOOD=0
 RES_FAIL=0
diff --git a/tests.astringology.sh b/tests.astringology.sh
index 008b480106..d1a157775c 100755
--- a/tests.astringology.sh
+++ b/tests.astringology.sh
@@ -12,7 +12,7 @@ RAND_SIZE_PATTERN=4
 RAND_ALPHABET=4
 
 EXECUTABLES="arand2 atrim2 adeterminize2 anormalize2 "
-TESTS_DIR="../examples2/string"
+TESTS_DIR="`pwd`/examples2/string"
 
 RES_GOOD=0
 RES_FAIL=0
diff --git a/tests.examples.sh b/tests.examples.sh
index 597b76937f..4f6dc10747 100755
--- a/tests.examples.sh
+++ b/tests.examples.sh
@@ -7,7 +7,7 @@ TESTCASE_TIMEOUT=10
 LOGFILE="log_tests.txt"
 
 EXECUTABLES="aecho2"
-TESTS_DIR="../examples2"
+TESTS_DIR="`pwd`/examples2"
 
 RES_GOOD=0
 RES_FAIL=0
diff --git a/tniceprint/makefile b/tniceprint/makefile
index 2c6fadea10..f19c977454 100644
--- a/tniceprint/makefile
+++ b/tniceprint/makefile
@@ -1,4 +1,5 @@
 SHELL:=/bin/bash
+USE_RAMDISK ?= 0
 -include makefile.conf
 
 define NEW_LINE
@@ -22,7 +23,14 @@ all:
 	@echo "What to do master?"
 
 obj%/makefile: makefile makefile.conf
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	echo "\
 	SHELL:=/bin/bash$${NEW_LINE}\
 	SRCDIR:=$${NEW_LINE}\
@@ -81,11 +89,25 @@ clean: clean-debug clean-release
 
 
 bin-debug/$(EXECUTABLE): obj-debug/ $(OBJECTS_DEBUG)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_DEBUG) -o $@ $(LDFLAGS_DEBUG)
 
 bin-release/$(EXECUTABLE): obj-release/ $(OBJECTS_RELEASE)
-	mkdir -p $(dir $@)
+	if [ ! -w $(dir $@) ] && [ $(USE_RAMDISK) -eq 1 ]; then\
+		ln -s /tmp/`date +'%s%N'`-$(dir $@) $(subst /, , $(dir $@)) 2>/dev/null;\
+	fi;\
+	if [ -L $(subst /, , $(dir $@)) ]; then\
+		mkdir -p `readlink $(subst /, , $(dir $@))`;\
+	else\
+		mkdir -p $(dir $@);\
+	fi
 	$(CXX) $(OBJECTS_RELEASE) -o $@ $(LDFLAGS_RELEASE)
 
 
@@ -110,9 +132,21 @@ build-release: bin-release/$(EXECUTABLE)
 
 
 clean-debug:
+	if [ -L obj-debug ]; then\
+		rm -r `readlink obj-debug`;\
+	fi
+	if [ -L bin-debug ]; then\
+		rm -r `readlink bin-debug`;\
+	fi
 	$(RM) -r *.o *.d bin-debug obj-debug
 
 clean-release:
+	if [ -L obj-release ]; then\
+		rm -r `readlink obj-release`;\
+	fi
+	if [ -L lib-release ]; then\
+		rm -r `readlink lib-release`;\
+	fi
 	$(RM) -r *.o *.d bin-release obj-release
 
 
-- 
GitLab