I had a tough time figuring out how to compile mtrace in a cygwin environment, so I thought I'd post what I did to help others.
First, use the gcc from mingw (mingw.org), not the standard gcc that comes with cygwin. After downloading and installing mingw, just put the mingw/bin directory first in your PATH.
Here's the script I used. Obviously you could use a Makefile - the main point is that this set of options works. Without the -D_JNI_IMPLEMENTATION_ option, you'll get a "Could not find Agent_OnLoad function in the agent library: mtrace" error. The paths are Windows-style paths (e.g. "c:/"). And the mtrace.dll does need to be put in your JRE/bin directory.
for i in mtrace.c agent_util.c java_crw_demo.c
gcc -D_JNI_IMPLEMENTATION_ -g -fno-strict-aliasing -fno-omit-frame-pointer -W -Wall -Wno-unused -Wno-parentheses -I. -I$INCLUDE -I$INCLUDE/win32 -shared -c$i