If you need that information during the build, then you should always be able to determine the target name because most of the time you're inside a target. So one could add a line of code to the target body that sets the property/ies according to the name. That would be the pure manual approach.
Maybe you want some kind of general (custom) task, say a line of code that can be copied to any target and determines the current target name. I don't know of a build in property that provides this name. But if you write a custom task and subclass org.apache.tools.ant.Task
then you may be able to get the name of the 'parent' target and build the property.
(If apache had published the API on the web then I'd been able to give a more precise answer...)
EDIT
It could be possible from outside. One can implement a listener and attach it to ant. So the listener would get notified when a target is entered. But the problem could be to change a property 'inside' ant. I don't know actually if this listener 'lives' in the same VM as the ant thread.