There are 2 approaches you could take. One is true 5-axis where you need to know the kinematics, and calculate the necessary values for your post. The other method is to use "plane spatial" which basically means that the tool is not tied into the kinematics of the machine, but is linked to the pick-up. This is referred to as "Cycle 19" on some controllers.
The easiest way to take advantage of the "plane spatial" is to use M128 in your code. For example:
% ISO G71
M129 shuts off the "plane spatial" feature.
Does this make sense?