Layer factory.

Implemented a layer factory that allows one to register a layer more easily. Both the Makefile version and cmake version are changed. Since the test only covers the C++ parts, I cannot guarantee that python and matlab versions are right. However, if you encounter registerer errors, simply do --whole-archive when you link in libcaffe.a.

== Original PR message ==

So I've been wanting to replace the old, sort-of-working layer factory function with a real registrar. This PR implements it, and hopefully makes writing new layers easier (instead of modifying an evergrowing if then statement, simply register a new layer).

A side effect is that, with registration in the code, we cannot use static library any more. For all binaries inside Caffe this is fine - I changed the behavior so that libcaffe.a is gone, and all binaries are linked directly with .o files. ~~I am yet to test if .so works.~~ I also added a test that dynamically links to libcaffe.so to make sure dynamic libraries work with registration.

~~I am not an expert of CMake so I haven't changed the CMake file yet.~~ CMake files are changed accordingly.

~~In terms of documentations, I have written a truly marvellous documentation of this, which this PR message is too short to contain. (Just kidding. I am in the process of finishing the documentation for it.)~~ Documentation of the registration process is written in layer_factory.hpp.

Also, the PR may potentially break Windows builds. Just want to expose it first and see what you guys think about it.
can you put this in doxygen format starting with an `@brief`? (see layer.hpp for example)