bugfix of functions.mk
i) Bugfixes in function.mk
ii) added basic support for testing targets
iii) reorganised test code and samples to look a bit better, more work ok testing has to be done to improve coverage and do not use just compiler output for checking.