My understanding is that the z-axis transformed by the matrix becomes the extrusion vector.

If you want a matrix that is the result of a series of rotations around the z (roll), x (pitch) and y (yaw)-axes: http://www.flipcode.com/documents/matrfaq.html

This page also shows how to set up a matrix that rotates the extrusion from its original z-orientation towards a second vector on the plane formed by the two vectors.