Simply to describe my motivation for understanding, there are times when I get into a dirty build state (genjava and rosjava freaking out about something), and I have to blow away build, devel directories, and maven repos and build from scratch. However if I naively call catkin_make, rosjava and genjava start breaking all over the place because I no longer have a setup.bash file to source other than the ros/indigo/setup.bash. So I end up in this weird place where my first build command has to be ROS_PACKAGE_PATH=/path/to/src:\$ROS_PACKAGE_PATH catkin_make. Then I can source the proper setup.bash file, call catkin_make, and everything builds fine again.
I'd like to understand more about the env hooks because my hope is I can just prefix catkin_make with all the env variables to get an arbitrary set of troubled packages (i.e. rosjava and genjava) happy and have a single command to solve my problems.