Rework makefiles machinery and list all used licenses in LICENSE file.