Group sources for each target and link the common libraries from a varia...

...ble