Update GNU Makefiles to generate DEBUG binaries

* '-g' has been added for all the build to produce debugging information. '-g' allows to get the symbols when debugging with GDB.
* introduce the macro 'DEBUG' to enable/disable build optimization.

Limitations:
* Support in non-Makefile projects has been added.