3 phase motor calculate proper phase voltages
Yes, driving a 3 phases motor is a non-trivial problem, but there is way to make it simpler. 

The basics and defining what we want to do

First, have a look a this wikipedia article and try to get a picture of why you have 3 phases. Your goals is to create a rotating magnetic field, and that will happen if your 3 phases are shifted from 120 degrees. You should see that on your EMF as well. 


  Now I would like to determine the input waveforms to all three phases such that the signal across these same two wires corresponds to the back-emf waveform above.


The waveform will be 3 sinusoids shifted from 120 degrees. The real problem is knowing in what direction you want your magnetic field.


  As far as I understand, the maximum efficiency is achieved when back-emf waveform is precisely in phase with supplied waveform.


I am not so sure this statement holds. I'd say : Maximum torque per amps is obtained when magnetic field is 90 degrees with respoect with to the rotor field. Efficiency is a function of torque and speed (and motor performances). To make the motor turns, you need torque. If you create a magnetic field that is in phase with the rotor field (0 degrees), you get no torque and waste energy in the winding resistance. 

At this point, we have defined what we want. 3 sinusoids shifted from 120 degrees, with a total phase such that the magnetic field is 90 degree from the rotor field. Now the real problem is determining this angle which depends on the position of the rotor.

Controlling the field vector

Let's say you know what angle you want. Your rotor is at say, 38 degrees, you want maximum torque, so you will have to define a vector with an angle of 128 degrees. The amplitude of that vector will control the amount of torque you ask. For the sake of the example, let's say you want a current vector of 1A. 

Since your controller can output a voltage, you would need to make a close loop system that regulates the current to get that 1A. I assume you don't have current sensors, then we will control the voltage and the current will be whatever it will be. The motor will still turn, be we won't know the amount of torque we give precisely.  

Assuming we do voltage control, we can make our previous current vector a voltage vector.  \$\vec{v}=1V\angle128^{\circ}\$

How do we converts that voltage vector into 3 voltage? The answer is the Reverse Clark Transform  The Clark Transform will converts your 3-axis system into a 2-axis system.  Instead of working with \$V_a\$, \$V_b\$, \$V_c\$,   you will work with \$V_\alpha\$ and \$V_\beta\$.  These 2 voltages represents vector components on a 2D planes. The reverse Clark Transform obviously converts \$V_\alpha\$ and \$V_\beta\$ back to \$V_a\$, \$V_b\$, \$V_c\$

The rest of the work only matters of simple vector calculation. 
For \$\vec{v}=1V\angle128^{\circ}\$
$$ V_\alpha = 1V*cos(128^{\circ})$$
$$ V_\beta = 1V*sin(128^{\circ})$$

Then apply the inverse Clark Transform and find \$V_a\$, \$V_b\$, \$V_c\$

Knowing the rotor angle

Our last problem is to deduce the position of the rotor. It is indeed related to the EMF. If you apply the Clark transform on the EMF, you will find its angle in the \$\alpha \beta\$ plan. But you can't read that input, instead you have hall effect sensors that output a digital signal that is high when the EMF is positive and  low when the EMF is negative.  I see that as 3 square waves shifted from 120 degrees. You can apply the Clark transform to these 3 square waves, what you will obtain is a vector with a resolution of 60 degrees. Instead of a smooth rotational movement, you will have a vector that do 60 degrees steps.

You then have everything you need to control your motor

Summary

The way of doing is then as follow:


Read your Hall Effect Sensors
Apply Clark Transform and find the angle of the rotor
Define a command vector that is shifted from 90 degrees
Apply the inverse clark transform
Output voltage on three lines.


Make it easier with FOC

There is a way to make your control even more simple by doing FOC (Field Oriented Control). Even though the Wikipedia article seems complex, the idea is quite simple. Using the Park Transform, you shift your axis \$\alpha\$ and \$\beta\$ so that they align with your rotor. That will yields a new voltage/current vector with two components \$I_d\$ and \$I_q\$ where \$I_d\$ is parralel to the rotor and \$I_q\$ is perpendicular to the rotor. All you have to do then is set \$I_d = 0\$ and control the torque with \$I_q\$.

With FOC, step 3 above becomes: 


Apply Park Transform
Set \$I_d = 0, I_d = 1V\$
Apply Inverse Park transform


There is this very nice video from Texas Instrument that covers the subject of FOC very well. You will pretty much find everything you wan to know in the first half of it. I strongly suggest you watch it.

Good luck!