Replace calls to malloc, realloc and free

Calls to malloc, realloc and free have been replaced by calls to library defined functions.
Improve reference counting of quarks
Improve GNU make build system

The GNU make build system supports now debug and release builds (debug=yes,
debug=no), distributions (make dist) and an improved clean-up (make clean).