People behave ethically because they need to work together. And people that are (too) unethical are ostracized. Unethical societies tend to collapse, and so are dominated by ethical ones. So Natural Selection has given us our moral values, which compete with shallow self interest to an extent that works out surprisingly well in our radically new society.
Natural Selection will and does affect AIs, even before they become intelligent enough to understand the concept. (People only understood it very recently.) The difference is that AIs are not limited to the computational power of a single brain. So they do not have to cooperate with others in the way that people do. So Natural Selection will select for different ethical values for them.
In the short term trying to make computers ethical (in our sense) is a fine goal. But in the longer term Natural Selection will define the ethics of ever more intelligent AIs.
See the following for details
It amazes me that most people have not tweaked to this. But most people do not *really* understand Natural Selection. (Darwin did, and was careful not to dwell on it.)