A free-trade deal has been agreed by more than 40 African countries for the partial removal of tariffs.